aboutsummaryrefslogtreecommitdiff
path: root/tool_src/BspLib/OutputData3D.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
committerFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
commitc068f22329d5cc722622a2183bbb22eef2093df7 (patch)
tree12d56c1aede67988a55e241364606bfbb4dba933 /tool_src/BspLib/OutputData3D.cpp
downloadopenparsec-main.tar.xz
openparsec-main.zip
initial importHEADmain
Diffstat (limited to 'tool_src/BspLib/OutputData3D.cpp')
-rw-r--r--tool_src/BspLib/OutputData3D.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/tool_src/BspLib/OutputData3D.cpp b/tool_src/BspLib/OutputData3D.cpp
new file mode 100644
index 0000000..f4e27d5
--- /dev/null
+++ b/tool_src/BspLib/OutputData3D.cpp
@@ -0,0 +1,105 @@
+//-----------------------------------------------------------------------------
+// BSPLIB MODULE: OutputData3D.cpp
+//
+// Copyright (c) 1997 by Markus Hadwiger
+// All Rights Reserved.
+//-----------------------------------------------------------------------------
+
+// bsplib header files
+#include "OutputData3D.h"
+#include "AodOutput.h"
+#include "BspOutput.h"
+//#include "VrmlOutput.h"
+
+//#define VRML_OUTPUT_POSSIBLE
+
+
+BSPLIB_NAMESPACE_BEGIN
+
+
+// "virtual" constructor for different output format objects ------------------
+//
+OutputData3D::OutputData3D( BspObjectList objectlist, const char *filename, int format ) :
+ IOData3D( objectlist, String( filename ) ),
+ m_data( NULL )
+{
+ // create "real" output object according to specified format of output file
+ if ( format != DONT_CREATE_OBJECT ) {
+ switch ( m_objectformat = format ) {
+
+ case AOD_FORMAT_1_1:
+ m_data = new AodOutput( objectlist, filename );
+ break;
+
+ case BSP_FORMAT_1_1:
+ m_data = new BspOutput( objectlist, filename );
+ break;
+
+#ifdef VRML_OUTPUT_POSSIBLE
+ case VRML_FORMAT_1_0:
+ m_data = new VrmlFile( objectlist, filename );
+ break;
+#endif
+ default:
+ ErrorMessage( "[OutputData3D]: Unrecognized output file format." );
+ m_objectformat = UNKNOWN_FORMAT;
+ }
+ } else {
+ m_objectformat = DONT_CREATE_OBJECT;
+ }
+}
+
+
+// constructor using an InputData3D object directly to get data ---------------
+//
+OutputData3D::OutputData3D( const InputData3D& inputdata, int format ) :
+ IOData3D( inputdata.getObjectList(), inputdata.getFileName() ),
+ m_data( NULL )
+{
+ // create "real" output object according to specified format of output file
+ if ( format != DONT_CREATE_OBJECT ) {
+ switch ( m_objectformat = format ) {
+
+ case AOD_FORMAT_1_1:
+ m_data = new AodOutput( inputdata );
+ break;
+
+ case BSP_FORMAT_1_1:
+ m_data = new BspOutput( inputdata );
+ break;
+
+#ifdef VRML_OUTPUT_POSSIBLE
+ case VRML_FORMAT_1_0:
+ m_data = new VrmlFile( inputdata );
+ break;
+#endif
+ default:
+ ErrorMessage( "[OutputData3D]: Unrecognized output file format." );
+ m_objectformat = UNKNOWN_FORMAT;
+ }
+ } else {
+ m_objectformat = DONT_CREATE_OBJECT;
+ }
+}
+
+
+// virtual destructor ---------------------------------------------------------
+//
+OutputData3D::~OutputData3D()
+{
+ // delete "real" object
+ delete m_data;
+}
+
+
+// redirection to WriteOutputFile() of "real" object --------------------------
+//
+int OutputData3D::WriteOutputFile()
+{
+ return m_data ? m_data->WriteOutputFile() : FALSE;
+}
+
+
+BSPLIB_NAMESPACE_END
+
+//-----------------------------------------------------------------------------