54 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Destroying Material node." ) );
57 for(
int i = 0; i < 2; ++i )
64 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] destroyed SGCOLOR #%d" ), i );
73 wxCHECK_MSG(
false,
false, wxT(
"AddRefNode is not applicable." ) );
80 wxCHECK_MSG(
false,
false, wxT(
"AddChildNode is not applicable." ) );
86 wxCHECK_MSG( aTopNode,
false, wxT(
"aTopNode is nullptr." ) );
88 char tok = proc.
Peek();
93 " * [INFO] bad file format; unexpected eof %s." ),
103 " * [INFO] bad file format; expecting '{' but got '%s' %s" ),
114 if( proc.
Peek() ==
'}' )
124 __FILE__, __FUNCTION__, __LINE__, proc.
GetError() );
137 if( !glob.compare(
"specularColor" ) )
143 " * [INFO] invalid specularColor %s\n"
144 " * [INFO] file: '%s'\n"
152 else if( !glob.compare(
"diffuseColor" ) )
157 " * [INFO] invalid diffuseColor %s\n"
158 " * [INFO] file: '%s'\n"
159 " * [INFO] error: '%s'." ),
166 else if( !glob.compare(
"emissiveColor" ) )
171 " * [INFO] invalid emissiveColor %s\n"
172 " * [INFO] file: '%s'\n"
180 else if( !glob.compare(
"shininess" ) )
186 " * [INFO] invalid shininess %s\n"
187 " * [INFO] file: '%s'\n"
188 " * [INFO] error: '%s'." ),
189 __FILE__, __FUNCTION__, __LINE__, proc.
GetFileName(),
195 else if( !glob.compare(
"transparency" ) )
201 " * [INFO] invalid transparency %s\n"
202 " * [INFO] file: '%s'\n"
203 " * [INFO] error: '%s'." ),
210 else if( !glob.compare(
"ambientColor" ) )
216 " * [INFO] invalid ambientColor %s\n"
217 " * [INFO] file: '%s'\n"
218 " * [INFO] error: '%s'." ),
228 "* [INFO] bad Material %s.\n"
229 "* [INFO] file: '%s'." ),
243 wxCHECK_MSG( sp,
nullptr, wxT(
"Bad model: no base data given." ) );
256 if( aIndex != 0 && aIndex != 1 )
259 if(
nullptr !=
colors[ aIndex ] )
362 if(
nullptr == aColor )
373 float dRed, dBlue, dGreen;
374 float eRed, eBlue, eGreen;
375 float aRed, aBlue, aGreen;
376 float sRed, sBlue, sGreen;
379 if( aIndex < 0 || ( aIndex >= (
int)
diffuseColor.size() ) )
427 if( aIndex < 0 || ( aIndex >= (
int)
ambientColor.size() ) )
475 if( aIndex < 0 || ( aIndex >= (
int)
shininess.size() ) )
502 if( aRed + aGreen + aBlue > 0.01f )
505 if( eRed + eGreen + eBlue > 0.01f )
508 if( dRed + dGreen + dBlue > 0.01f )
511 if( ( sRed + sGreen + sBlue ) * shiny > 0.01f )
519 red = (eRed + aRed + dRed + sRed * shiny) / n;
520 green = (eGreen + aGreen + dGreen + sGreen * shiny) / n;
521 blue = (eBlue + aBlue + dBlue + sBlue * shiny) / n;
533 else if( aValue > 1.0 )
540 if(
nullptr == aColor )
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
bool SetEmissive(float aRVal, float aGVal, float aBVal)
bool SetSpecular(float aRVal, float aGVal, float aBVal)
bool SetShininess(float aShininess) noexcept
bool SetAmbient(float aRVal, float aGVal, float aBVal)
bool SetTransparency(float aTransparency) noexcept
SGNODE * GetRawPtr(void) noexcept
Return the raw internal SGNODE pointer.
bool SetColor(float aRedVal, float aGreenVal, float aBlueVal)
The base class of all Scene Graph nodes.
Represent the top node of a VRML1 model.
std::vector< WRLVEC3F > emissiveColor
bool AddChildNode(WRL1NODE *aNode) override
std::vector< WRLVEC3F > ambientColor
void Reclaim(SGNODE *aColor)
Destroy the given color node if it does not have a parent.
bool AddRefNode(WRL1NODE *aNode) override
SGNODE * TranslateToSG(SGNODE *aParent, WRL1STATUS *sp) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
void checkRange(float &aValue)
std::vector< WRLVEC3F > diffuseColor
WRL1MATERIAL(NAMEREGISTER *aDictionary)
std::vector< float > transparency
void GetColor(SGCOLOR *aColor, int aIndex)
Compute an SGCOLOR representing the appearance of a vertex or face.
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
std::vector< WRLVEC3F > specularColor
std::vector< float > shininess
SGNODE * GetAppearance(int aIndex)
Return an SGAPPEARANCE node representing the appearance for an IndexedFaceSet.
WRL1NODE(NAMEREGISTER *aDictionary)
std::string GetFileName(void)
bool ReadMFFloat(std::vector< float > &aMFFloat)
std::string GetError(void)
bool ReadMFVec3f(std::vector< WRLVEC3F > &aMFVec3f)
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.