MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / parseNode

Function parseNode

Tools/VRMLConverter/src/VRML2mesh.cpp:165–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void parseNode(Mesh *mesh, const vrmllib::node *n, Matrix4 m)
166{
167 if (const Transform *tr = dynamic_cast<const Transform *>(n)) {
168 // TODO: handle center, scaleOrientation
169
170 Matrix4 trans;
171 trans.makeTrans(vec(tr->translation));
172
173 Matrix4 scale = Matrix4::IDENTITY;
174 scale[0][0] = tr->scale.x;
175 scale[1][1] = tr->scale.y;
176 scale[2][2] = tr->scale.z;
177
178 Matrix3 rot3;
179 rot3.FromAxisAngle(vec(tr->rotation.vector), tr->rotation.radians);
180 Matrix4 rot = Matrix4::IDENTITY;
181 rot = rot3;
182
183 m = m * transMat(tr->translation) * transMat(tr->center)
184 * rotMat(tr->rotation) * rotMat(tr->scaleOrientation) * scaleMat(tr->scale)
185 * rotMat(tr->scaleOrientation, true) * transMat(tr->center, true);
186 }
187
188 if (const grouping_node *gn = dynamic_cast<const grouping_node *>(n)) {
189 for (std::vector<vrmllib::node *>::const_iterator
190 i=gn->children.begin(), e=gn->children.end(); i!=e; ++i)
191 parseNode(mesh, *i, m);
192
193 } else if (const Shape *sh = dynamic_cast<const Shape *>(n))
194 parseShape(mesh, sh, m);
195}
196
197void parseShape(Mesh *mesh, const Shape *sh, Matrix4 mat)
198{

Callers 1

parseFileFunction · 0.85

Calls 7

vecFunction · 0.85
transMatFunction · 0.85
rotMatFunction · 0.85
scaleMatFunction · 0.85
parseShapeFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected