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;
225 vertices.emplace_back( -x, -y, z );
226 vertices.emplace_back( x, -y, z );
227 vertices.emplace_back( x, y, z );
228 vertices.emplace_back( -x, y, z );
229 norms.emplace_back( 0.0, 0.0, 1.0 );
230 norms.emplace_back( 0.0, 0.0, 1.0 );
231 norms.emplace_back( 0.0, 0.0, 1.0 );
232 norms.emplace_back( 0.0, 0.0, 1.0 );
233 idx.push_back( base );
234 idx.push_back( base + 1 );
235 idx.push_back( base + 2 );
236 idx.push_back( base );
237 idx.push_back( base + 2 );
238 idx.push_back( base + 3 );
242 vertices.emplace_back( -x, -y, -z );
243 vertices.emplace_back( x, -y, -z );
244 vertices.emplace_back( x, y, -z );
245 vertices.emplace_back( -x, y, -z );
246 norms.emplace_back( 0.0, 0.0, -1.0 );
247 norms.emplace_back( 0.0, 0.0, -1.0 );
248 norms.emplace_back( 0.0, 0.0, -1.0 );
249 norms.emplace_back( 0.0, 0.0, -1.0 );
250 idx.push_back( base );
251 idx.push_back( base + 2 );
252 idx.push_back( base + 1 );
253 idx.push_back( base );
254 idx.push_back( base + 3 );
255 idx.push_back( base + 2 );
259 vertices.emplace_back( -x, -y, z );
260 vertices.emplace_back( -x, -y, -z );
261 vertices.emplace_back( x, -y, -z );
262 vertices.emplace_back( x, -y, z );
263 norms.emplace_back( 0.0, -1.0, 0.0 );
264 norms.emplace_back( 0.0, -1.0, 0.0 );
265 norms.emplace_back( 0.0, -1.0, 0.0 );
266 norms.emplace_back( 0.0, -1.0, 0.0 );
267 idx.push_back( base );
268 idx.push_back( base + 1 );
269 idx.push_back( base + 2 );
270 idx.push_back( base );
271 idx.push_back( base + 2 );
272 idx.push_back( base + 3 );
276 vertices.emplace_back( -x, y, z );
277 vertices.emplace_back( -x, y, -z );
278 vertices.emplace_back( x, y, -z );
279 vertices.emplace_back( x, y, z );
280 norms.emplace_back( 0.0, 1.0, 0.0 );
281 norms.emplace_back( 0.0, 1.0, 0.0 );
282 norms.emplace_back( 0.0, 1.0, 0.0 );
283 norms.emplace_back( 0.0, 1.0, 0.0 );
284 idx.push_back( base );
285 idx.push_back( base + 2 );
286 idx.push_back( base + 1 );
287 idx.push_back( base );
288 idx.push_back( base + 3 );
289 idx.push_back( base + 2 );
293 vertices.emplace_back( -x, -y, -z );
294 vertices.emplace_back( -x, -y, z );
295 vertices.emplace_back( -x, y, z );
296 vertices.emplace_back( -x, y, -z );
297 norms.emplace_back( -1.0, 0.0, 0.0 );
298 norms.emplace_back( -1.0, 0.0, 0.0 );
299 norms.emplace_back( -1.0, 0.0, 0.0 );
300 norms.emplace_back( -1.0, 0.0, 0.0 );
301 idx.push_back( base );
302 idx.push_back( base + 1 );
303 idx.push_back( base + 2 );
304 idx.push_back( base );
305 idx.push_back( base + 2 );
306 idx.push_back( base + 3 );
310 vertices.emplace_back( x, -y, -z );
311 vertices.emplace_back( x, -y, z );
312 vertices.emplace_back( x, y, z );
313 vertices.emplace_back( x, y, -z );
314 norms.emplace_back( 1.0, 0.0, 0.0 );
315 norms.emplace_back( 1.0, 0.0, 0.0 );
316 norms.emplace_back( 1.0, 0.0, 0.0 );
317 norms.emplace_back( 1.0, 0.0, 0.0 );
318 idx.push_back( base );
319 idx.push_back( base + 2 );
320 idx.push_back( base + 1 );
321 idx.push_back( base );
322 idx.push_back( base + 3 );
323 idx.push_back( base + 2 );
IFSG_COORDS is the wrapper for SGCOORDS.
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
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)
std::string GetFilePosition() const
WRL2NODES GetNodeType(void) const
std::string GetFileName(void)
The top node of a VRML2 model.
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
bool SetIndices(size_t nIndices, int *aIndexList)
Function SetIndices sets the number of indices and creates a copy of the given index data.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...