37 m_Type = WRL2NODES::WRL2_BOX;
46 m_Type = WRL2NODES::WRL2_BOX;
76 char tok = proc.
Peek();
81 " * [INFO] bad file format; unexpected eof %s." ),
91 " * [INFO] bad file format; expecting '{' but got '%s' %s." ),
100 if( proc.
Peek() ==
'}' )
110 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
116 if( !glob.compare(
"size" ) )
121 " * [INFO] invalid size %s\n"
122 " * [INFO] file: '%s'\n"
136 " * [INFO] invalid Box %s\n"
137 " * [INFO] file: '%s'\n" ),
147 " * [INFO] invalid Box size %s\n"
148 " * [INFO] file: '%s'\n" ),
155 if( proc.
Peek() ==
'}' )
162 " * [INFO] invalid size %s (no closing brace).\n"
163 " * [INFO] file: '%s'\n" ),
173 wxCHECK_MSG(
false,
false, wxT(
"AddRefNode is not applicable." ) );
180 wxCHECK_MSG(
false,
false, wxT(
"AddChildNode is not applicable." ) );
189 wxString::Format( wxT(
"Box does not have a Shape parent (parent ID: %s)" ),
198 if(
nullptr != aParent )
216 float x =
size.x / 2.0;
217 float y =
size.y / 2.0;
218 float z =
size.z / 2.0;
219 std::vector< SGPOINT > vertices;
220 std::vector< SGVECTOR > norms;
221 std::vector< int > idx;
224 vertices.reserve( 6 * 4 );
225 norms.reserve( 6 * 4 );
226 idx.reserve( 6 * 6 );
229 vertices.emplace_back( -x, -y, z );
230 vertices.emplace_back( x, -y, z );
231 vertices.emplace_back( x, y, z );
232 vertices.emplace_back( -x, y, z );
233 norms.emplace_back( 0.0, 0.0, 1.0 );
234 norms.emplace_back( 0.0, 0.0, 1.0 );
235 norms.emplace_back( 0.0, 0.0, 1.0 );
236 norms.emplace_back( 0.0, 0.0, 1.0 );
237 idx.push_back( base );
238 idx.push_back( base + 1 );
239 idx.push_back( base + 2 );
240 idx.push_back( base );
241 idx.push_back( base + 2 );
242 idx.push_back( base + 3 );
246 vertices.emplace_back( -x, -y, -z );
247 vertices.emplace_back( x, -y, -z );
248 vertices.emplace_back( x, y, -z );
249 vertices.emplace_back( -x, y, -z );
250 norms.emplace_back( 0.0, 0.0, -1.0 );
251 norms.emplace_back( 0.0, 0.0, -1.0 );
252 norms.emplace_back( 0.0, 0.0, -1.0 );
253 norms.emplace_back( 0.0, 0.0, -1.0 );
254 idx.push_back( base );
255 idx.push_back( base + 2 );
256 idx.push_back( base + 1 );
257 idx.push_back( base );
258 idx.push_back( base + 3 );
259 idx.push_back( base + 2 );
263 vertices.emplace_back( -x, -y, z );
264 vertices.emplace_back( -x, -y, -z );
265 vertices.emplace_back( x, -y, -z );
266 vertices.emplace_back( x, -y, z );
267 norms.emplace_back( 0.0, -1.0, 0.0 );
268 norms.emplace_back( 0.0, -1.0, 0.0 );
269 norms.emplace_back( 0.0, -1.0, 0.0 );
270 norms.emplace_back( 0.0, -1.0, 0.0 );
271 idx.push_back( base );
272 idx.push_back( base + 1 );
273 idx.push_back( base + 2 );
274 idx.push_back( base );
275 idx.push_back( base + 2 );
276 idx.push_back( base + 3 );
280 vertices.emplace_back( -x, y, z );
281 vertices.emplace_back( -x, y, -z );
282 vertices.emplace_back( x, y, -z );
283 vertices.emplace_back( x, y, z );
284 norms.emplace_back( 0.0, 1.0, 0.0 );
285 norms.emplace_back( 0.0, 1.0, 0.0 );
286 norms.emplace_back( 0.0, 1.0, 0.0 );
287 norms.emplace_back( 0.0, 1.0, 0.0 );
288 idx.push_back( base );
289 idx.push_back( base + 2 );
290 idx.push_back( base + 1 );
291 idx.push_back( base );
292 idx.push_back( base + 3 );
293 idx.push_back( base + 2 );
297 vertices.emplace_back( -x, -y, -z );
298 vertices.emplace_back( -x, -y, z );
299 vertices.emplace_back( -x, y, z );
300 vertices.emplace_back( -x, y, -z );
301 norms.emplace_back( -1.0, 0.0, 0.0 );
302 norms.emplace_back( -1.0, 0.0, 0.0 );
303 norms.emplace_back( -1.0, 0.0, 0.0 );
304 norms.emplace_back( -1.0, 0.0, 0.0 );
305 idx.push_back( base );
306 idx.push_back( base + 1 );
307 idx.push_back( base + 2 );
308 idx.push_back( base );
309 idx.push_back( base + 2 );
310 idx.push_back( base + 3 );
314 vertices.emplace_back( x, -y, -z );
315 vertices.emplace_back( x, -y, z );
316 vertices.emplace_back( x, y, z );
317 vertices.emplace_back( x, y, -z );
318 norms.emplace_back( 1.0, 0.0, 0.0 );
319 norms.emplace_back( 1.0, 0.0, 0.0 );
320 norms.emplace_back( 1.0, 0.0, 0.0 );
321 norms.emplace_back( 1.0, 0.0, 0.0 );
322 idx.push_back( base );
323 idx.push_back( base + 2 );
324 idx.push_back( base + 1 );
325 idx.push_back( base );
326 idx.push_back( base + 3 );
327 idx.push_back( base + 2 );
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
IFSG_COORDS is the wrapper for SGCOORDS.
bool SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
IFSG_FACESET is the wrapper for the SGFACESET class.
bool SetIndices(size_t nIndices, int *aIndexList)
Function SetIndices sets the number of indices and creates a copy of the given index data.
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
IFSG_NORMALS is the wrapper for the SGNORMALS class.
bool SetNormalList(size_t aListSize, const SGVECTOR *aNormalList)
The base class of all Scene Graph nodes.
The top node of a VRML2 model.
bool AddRefNode(WRL2NODE *aNode) override
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
bool AddChildNode(WRL2NODE *aNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
WRL2NODES GetNodeType(void) const
virtual bool AddChildNode(WRL2NODE *aNode)
std::string GetFileName(void)
std::string GetError(void)
bool ReadName(std::string &aName)
std::string GetFilePosition() const
bool ReadSFVec3f(WRLVEC3F &aSFVec3f)
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
collects header files for all SG* wrappers and the API
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)