46SCENEGRAPH*
LoadVRML(
const wxString& aFileName,
bool useInline,
bool applyUnitConversion );
59 std::map< std::string, SGNODE* >::iterator iS =
m_inlineModels.begin();
60 std::map< std::string, SGNODE* >::iterator eS =
m_inlineModels.end();
79 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set parent on WRL2BASE node." ) );
112 std::map< std::string, SGNODE* >::iterator dp =
m_inlineModels.find( aName );
119 if( aName.compare( 0, 7,
"file://" ) == 0 )
121 if( aName.length() <= 7 )
124 tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
128 tname = wxString::FromUTF8Unchecked( aName.c_str() );
134 if( fn.IsRelative() && !
m_dir.empty() )
136 wxString fname = wxString::FromUTF8Unchecked(
m_dir.c_str() );
137 fname.append( tname );
167 wxCHECK_MSG(
false, std::string(
"" ), wxT(
"Attempt to extract name from base node." ) );
173 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set name of base node." ) );
180 wxT(
"No open file or file is not a VRML2 file." ) );
185 while(
ReadNode( proc,
this, &node ) && !proc.
eof() );
203 if(
nullptr != aNode )
206 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
214 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
225 " * [INFO] node '%s' not found." ),
226 __FILE__, __FUNCTION__, __LINE__, glob );
235 " * [INFO] failed to add node '%s' (%d) to parent of type %d" ),
236 __FILE__, __FUNCTION__, __LINE__, glob, ref->
GetNodeType(),
242 if(
nullptr != aNode )
251 if(
nullptr != aNode )
254 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
263 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
268 if(
ReadNode( proc, aParent, &lnode ) )
270 if(
nullptr != aNode )
273 if( lnode && !lnode->
SetName( glob ) )
277 " * [INFO] bad formatting (invalid name) %s." ),
298 if(
nullptr != aNode )
301 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
310 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
326 if( !glob.compare(
"USE" ) )
332 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
340 if( !glob.compare(
"DEF" ) )
346 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
355 if( !glob.compare(
"PROTO" ) )
361 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
370 if( !glob.compare(
"EXTERNPROTO" ) )
376 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
385 if( !glob.compare(
"ROUTE" ) )
391 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
401 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Processing node '%s' ID: %d" ), glob, ntype );
417 if( !
readBox( proc, aParent, aNode ) )
433 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
457 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
474 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
491 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
550 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
628 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
648 wxCHECK_MSG(
false,
false, wxT(
"This method must never be invoked on a WRL2BASE object." ) );
654 if(
nullptr != aNode )
659 if( !np->
Read( proc,
this ) )
665 if(
nullptr != aNode )
674 if(
nullptr != aNode )
679 if( !np->
Read( proc,
this ) )
685 if(
nullptr != aNode )
694 if(
nullptr != aNode )
699 if( !np->
Read( proc,
this ) )
705 if(
nullptr != aNode )
714 if(
nullptr != aNode )
719 if( !np->
Read( proc,
this ) )
725 if(
nullptr != aNode )
734 if(
nullptr != aNode )
739 if( !np->
Read( proc,
this ) )
745 if(
nullptr != aNode )
754 if(
nullptr != aNode )
759 if( !np->
Read( proc,
this ) )
765 if(
nullptr != aNode )
774 if(
nullptr != aNode )
779 if( !np->
Read( proc,
this ) )
785 if(
nullptr != aNode )
794 if(
nullptr != aNode )
799 if( !np->
Read( proc,
this ) )
805 if(
nullptr != aNode )
814 if(
nullptr != aNode )
819 if( !np->
Read( proc,
this ) )
825 if(
nullptr != aNode )
834 if(
nullptr != aNode )
839 if( !np->
Read( proc,
this ) )
845 if(
nullptr != aNode )
854 if(
nullptr != aNode )
859 if( !np->
Read( proc,
this ) )
865 if(
nullptr != aNode )
874 if(
nullptr != aNode )
879 if( !np->
Read( proc,
this ) )
885 if(
nullptr != aNode )
894 if(
nullptr != aNode )
901 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard in line node %s." ),
912 if( !np->
Read( proc,
this ) )
918 if(
nullptr != aNode )
932 if(
nullptr != aParent )
951 std::list< WRL2NODE* >::iterator sC =
m_Children.begin();
952 std::list< WRL2NODE* >::iterator eC =
m_Children.end();
960 type = (*sC)->GetNodeType();
969 SGNODE* pshape = (*sC)->TranslateToSG(
wrapper.GetRawPtr() );
971 if(
nullptr != pshape )
984 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().