50SCENEGRAPH*
LoadVRML(
const wxString& aFileName,
bool useInline,
bool applyUnitConversion );
63 std::map< std::string, SGNODE* >::iterator iS =
m_inlineModels.begin();
64 std::map< std::string, SGNODE* >::iterator eS =
m_inlineModels.end();
83 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set parent on WRL2BASE node." ) );
116 std::map< std::string, SGNODE* >::iterator dp =
m_inlineModels.find( aName );
123 if( aName.compare( 0, 7,
"file://" ) == 0 )
125 if( aName.length() <= 7 )
128 tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
132 tname = wxString::FromUTF8Unchecked( aName.c_str() );
138 if( fn.IsRelative() && !
m_dir.empty() )
140 wxString fname = wxString::FromUTF8Unchecked(
m_dir.c_str() );
141 fname.append( tname );
171 wxCHECK_MSG(
false, std::string(
"" ), wxT(
"Attempt to extract name from base node." ) );
177 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set name of base node." ) );
184 wxT(
"No open file or file is not a VRML2 file." ) );
189 while(
ReadNode( proc,
this, &node ) && !proc.
eof() );
207 if(
nullptr != aNode )
210 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
218 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
229 " * [INFO] node '%s' not found." ),
230 __FILE__, __FUNCTION__, __LINE__, glob );
239 " * [INFO] failed to add node '%s' (%d) to parent of type %d" ),
240 __FILE__, __FUNCTION__, __LINE__, glob, ref->
GetNodeType(),
246 if(
nullptr != aNode )
255 if(
nullptr != aNode )
258 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
267 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
272 if(
ReadNode( proc, aParent, &lnode ) )
274 if(
nullptr != aNode )
277 if( lnode && !lnode->
SetName( glob ) )
281 " * [INFO] bad formatting (invalid name) %s." ),
302 if(
nullptr != aNode )
305 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
314 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
330 if( !glob.compare(
"USE" ) )
336 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
344 if( !glob.compare(
"DEF" ) )
350 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
359 if( !glob.compare(
"PROTO" ) )
365 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
374 if( !glob.compare(
"EXTERNPROTO" ) )
380 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
389 if( !glob.compare(
"ROUTE" ) )
395 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
405 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Processing node '%s' ID: %d" ), glob, ntype );
421 if( !
readBox( proc, aParent, aNode ) )
437 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
461 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
478 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
495 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
554 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
632 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
652 wxCHECK_MSG(
false,
false, wxT(
"This method must never be invoked on a WRL2BASE object." ) );
658 if(
nullptr != aNode )
663 if( !np->
Read( proc,
this ) )
669 if(
nullptr != aNode )
678 if(
nullptr != aNode )
683 if( !np->
Read( proc,
this ) )
689 if(
nullptr != aNode )
698 if(
nullptr != aNode )
703 if( !np->
Read( proc,
this ) )
709 if(
nullptr != aNode )
718 if(
nullptr != aNode )
723 if( !np->
Read( proc,
this ) )
729 if(
nullptr != aNode )
738 if(
nullptr != aNode )
743 if( !np->
Read( proc,
this ) )
749 if(
nullptr != aNode )
758 if(
nullptr != aNode )
763 if( !np->
Read( proc,
this ) )
769 if(
nullptr != aNode )
778 if(
nullptr != aNode )
783 if( !np->
Read( proc,
this ) )
789 if(
nullptr != aNode )
798 if(
nullptr != aNode )
803 if( !np->
Read( proc,
this ) )
809 if(
nullptr != aNode )
818 if(
nullptr != aNode )
823 if( !np->
Read( proc,
this ) )
829 if(
nullptr != aNode )
838 if(
nullptr != aNode )
843 if( !np->
Read( proc,
this ) )
849 if(
nullptr != aNode )
858 if(
nullptr != aNode )
863 if( !np->
Read( proc,
this ) )
869 if(
nullptr != aNode )
878 if(
nullptr != aNode )
883 if( !np->
Read( proc,
this ) )
889 if(
nullptr != aNode )
898 if(
nullptr != aNode )
905 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard in line node %s." ),
916 if( !np->
Read( proc,
this ) )
922 if(
nullptr != aNode )
936 if(
nullptr != aParent )
955 std::list< WRL2NODE* >::iterator sC =
m_Children.begin();
956 std::list< WRL2NODE* >::iterator eC =
m_Children.end();
964 type = (*sC)->GetNodeType();
973 SGNODE* pshape = (*sC)->TranslateToSG(
wrapper.GetRawPtr() );
975 if(
nullptr != pshape )
988 if(
nullptr != (*sC)->TranslateToSG( topNode.
GetRawPtr() ) )
SGNODE * GetRawPtr(void) noexcept
Return the raw internal SGNODE pointer.
void Destroy(void)
Delete the object held by this wrapper.
Define the basic data set required to represent a 3D model.
The base class of all Scene Graph nodes.
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool readMaterial(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
std::map< std::string, SGNODE * > m_inlineModels
virtual bool SetName(const std::string &aName) override
void SetEnableInline(bool enable)
bool readTransform(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool GetEnableInline(void)
bool readLineSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readShape(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool implementDef(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readPointSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readInline(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
SGNODE * GetInlineData(const std::string &aName)
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool m_applyUnitConversion
bool implementUse(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readColor(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool SetParent(WRL2NODE *aParent, bool doUnlink=true) override
Set the parent WRL2NODE of this object.
virtual std::string GetName(void) override
void SetApplyUnitConversion(bool apply)
bool readBox(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readAppearance(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool GetApplyUnitConversion(void) const
bool readNorms(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readSwitch(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readCoords(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
bool readFaceSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
virtual bool SetName(const std::string &aName)
WRL2NODES getNodeTypeID(const std::string &aNodeName)
std::list< WRL2NODE * > m_Children
virtual WRL2NODE * FindNode(const std::string &aNodeName, const WRL2NODE *aCaller)
Search the tree of linked nodes and returns a reference to the first node found with the given name.
virtual bool AddRefNode(WRL2NODE *aNode)
WRL2NODES GetNodeType(void) const
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool ReadGlob(std::string &aGlob)
WRLVERSION GetVRMLType(void)
const char * GetParentDir(void)
std::string GetError(void)
bool ReadName(std::string &aName)
std::string GetFilePosition() const
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
collects header files for all SG* wrappers and the API
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Delete the given SG* class node.
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
SCENEGRAPH * LoadVRML(const wxString &aFileName, bool useInline, bool applyUnitConversion)
@ WRL2_POSITIONINTERPOLATOR
@ WRL2_SCALARINTERPOLATOR
@ WRL2_ORIENTATIONINTERPOLATOR
@ WRL2_NORMALINTERPOLATOR
@ WRL2_COORDINATEINTERPOLATOR
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().