62 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 ) 63 wxLogTrace(
MASK_VRML,
" * [INFO] Destroying Box node\n" );
86 char tok = proc.
Peek();
90 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 92 std::ostringstream ostr;
93 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
94 ostr <<
" * [INFO] bad file format; unexpected eof at line ";
95 ostr << line <<
", column " << column;
96 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
105 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 107 std::ostringstream ostr;
109 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
110 ostr <<
" * [INFO] bad file format; expecting '{' but got '" << tok;
111 ostr <<
"' at line " << line <<
", column " << column;
112 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
122 if( proc.
Peek() ==
'}' )
130 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 132 std::ostringstream ostr;
133 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
135 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
145 if( !glob.compare(
"size" ) )
149 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 151 std::ostringstream ostr;
152 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
153 ostr <<
" * [INFO] invalid size at line " << line <<
", column ";
154 ostr << column <<
"\n";
155 ostr <<
" * [INFO] file: '" << proc.
GetFileName() <<
"'\n";
156 ostr <<
" * [INFO] message: '" << proc.
GetError() <<
"'";
157 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
169 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 171 std::ostringstream ostr;
172 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
173 ostr <<
" * [INFO] bad Box at line " << line <<
", column ";
174 ostr << column <<
"\n";
175 ostr <<
" * [INFO] file: '" << proc.
GetFileName() <<
"'";
176 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
185 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 187 std::ostringstream ostr;
188 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
189 ostr <<
" * [INFO] bad Box (invalid size) at line " << line <<
", column ";
190 ostr << column <<
"\n";
191 ostr <<
" * [INFO] file: '" << proc.
GetFileName() <<
"'";
192 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
197 if( proc.
Peek() ==
'}' )
205 #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 ) 207 std::ostringstream ostr;
208 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
209 ostr <<
" * [INFO] bad Box at line " << line <<
", column ";
210 ostr << column <<
" (no closing brace)\n";
211 ostr <<
" * [INFO] file: '" << proc.
GetFileName() <<
"'";
212 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
226 std::ostringstream ostr;
227 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
228 ostr <<
" * [BUG] AddRefNode is not applicable";
229 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
243 std::ostringstream ostr;
244 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
245 ostr <<
" * [BUG] AddChildNode is not applicable";
246 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
262 std::ostringstream ostr;
263 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
264 ostr <<
" * [BUG] Box does not have a Shape parent (parent ID: ";
265 ostr << ptype <<
")";
266 wxLogTrace(
MASK_VRML,
"%s\n", ostr.str().c_str() );
279 if(
NULL != aParent )
297 float x =
size.x / 2.0;
298 float y =
size.y / 2.0;
299 float z =
size.z / 2.0;
300 std::vector< SGPOINT > vertices;
301 std::vector< SGVECTOR > norms;
302 std::vector< int > idx;
305 vertices.emplace_back( -x, -y, z );
306 vertices.emplace_back( x, -y, z );
307 vertices.emplace_back( x, y, z );
308 vertices.emplace_back( -x, y, z );
309 norms.emplace_back( 0.0, 0.0, 1.0 );
310 norms.emplace_back( 0.0, 0.0, 1.0 );
311 norms.emplace_back( 0.0, 0.0, 1.0 );
312 norms.emplace_back( 0.0, 0.0, 1.0 );
313 idx.push_back( base );
314 idx.push_back( base + 1 );
315 idx.push_back( base + 2 );
316 idx.push_back( base );
317 idx.push_back( base + 2 );
318 idx.push_back( base + 3 );
321 vertices.emplace_back( -x, -y, -z );
322 vertices.emplace_back( x, -y, -z );
323 vertices.emplace_back( x, y, -z );
324 vertices.emplace_back( -x, y, -z );
325 norms.emplace_back( 0.0, 0.0, -1.0 );
326 norms.emplace_back( 0.0, 0.0, -1.0 );
327 norms.emplace_back( 0.0, 0.0, -1.0 );
328 norms.emplace_back( 0.0, 0.0, -1.0 );
329 idx.push_back( base );
330 idx.push_back( base + 2 );
331 idx.push_back( base + 1 );
332 idx.push_back( base );
333 idx.push_back( base + 3 );
334 idx.push_back( base + 2 );
337 vertices.emplace_back( -x, -y, z );
338 vertices.emplace_back( -x, -y, -z );
339 vertices.emplace_back( x, -y, -z );
340 vertices.emplace_back( x, -y, z );
341 norms.emplace_back( 0.0, -1.0, 0.0 );
342 norms.emplace_back( 0.0, -1.0, 0.0 );
343 norms.emplace_back( 0.0, -1.0, 0.0 );
344 norms.emplace_back( 0.0, -1.0, 0.0 );
345 idx.push_back( base );
346 idx.push_back( base + 1 );
347 idx.push_back( base + 2 );
348 idx.push_back( base );
349 idx.push_back( base + 2 );
350 idx.push_back( base + 3 );
353 vertices.emplace_back( -x, y, z );
354 vertices.emplace_back( -x, y, -z );
355 vertices.emplace_back( x, y, -z );
356 vertices.emplace_back( x, y, z );
357 norms.emplace_back( 0.0, 1.0, 0.0 );
358 norms.emplace_back( 0.0, 1.0, 0.0 );
359 norms.emplace_back( 0.0, 1.0, 0.0 );
360 norms.emplace_back( 0.0, 1.0, 0.0 );
361 idx.push_back( base );
362 idx.push_back( base + 2 );
363 idx.push_back( base + 1 );
364 idx.push_back( base );
365 idx.push_back( base + 3 );
366 idx.push_back( base + 2 );
369 vertices.emplace_back( -x, -y, -z );
370 vertices.emplace_back( -x, -y, z );
371 vertices.emplace_back( -x, y, z );
372 vertices.emplace_back( -x, y, -z );
373 norms.emplace_back( -1.0, 0.0, 0.0 );
374 norms.emplace_back( -1.0, 0.0, 0.0 );
375 norms.emplace_back( -1.0, 0.0, 0.0 );
376 norms.emplace_back( -1.0, 0.0, 0.0 );
377 idx.push_back( base );
378 idx.push_back( base + 1 );
379 idx.push_back( base + 2 );
380 idx.push_back( base );
381 idx.push_back( base + 2 );
382 idx.push_back( base + 3 );
385 vertices.emplace_back( x, -y, -z );
386 vertices.emplace_back( x, -y, z );
387 vertices.emplace_back( x, y, z );
388 vertices.emplace_back( x, y, -z );
389 norms.emplace_back( 1.0, 0.0, 0.0 );
390 norms.emplace_back( 1.0, 0.0, 0.0 );
391 norms.emplace_back( 1.0, 0.0, 0.0 );
392 norms.emplace_back( 1.0, 0.0, 0.0 );
393 idx.push_back( base );
394 idx.push_back( base + 2 );
395 idx.push_back( base + 1 );
396 idx.push_back( base );
397 idx.push_back( base + 3 );
398 idx.push_back( base + 2 );
WRL2NODE represents the base class of all VRML2 nodes.
IFSG_COORDS is the wrapper for SGCOORDS.
bool isDangling(void) override
Function isDangling returns true if the object does not have a parent which is a logical container fo...
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
bool GetFilePosData(size_t &line, size_t &column)
bool ReadSFVec3f(WRLVEC3F &aSFVec3f)
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
The base class of all Scene Graph nodes.
collects header files for all SG* wrappers and the API
bool AddChildNode(WRL2NODE *aNode) override
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
IFSG_NORMALS is the wrapper for the SGNORMALS class.
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
WRL2NODES GetNodeType(void) const
Function GetNodeType returns the type of this node instance.
std::string GetFileName(void)
WRL2BASE represents the top node of a VRML2 model.
bool SetIndices(size_t nIndices, int *aIndexList)
Function SetIndices sets the number of indices and creates a copy of the given index data.
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
virtual bool AddChildNode(WRL2NODE *aNode)
bool SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
bool ReadName(std::string &aName)
bool AddRefNode(WRL2NODE *aNode) override
bool SetNormalList(size_t aListSize, const SGVECTOR *aNormalList)
IFSG_FACESET is the wrapper for the SGFACESET class.
std::string GetError(void)
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
SGNODE * TranslateToSG(SGNODE *aParent) override
Function TranslateToSG produces a representation of the data using the intermediate scenegraph struct...