From: Markus R. <rol...@us...> - 2006-02-23 13:40:29
|
Update of /cvsroot/simspark/simspark/spark/plugin/rosimporter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17195 Modified Files: roselements.cpp roselements.h rosimporter.cpp rosimporter.h Log Message: - create and register TriMeshes from the parsed meshes - parse Physical Representation of complex objects; this needes still some work to get the joint setup right - various small fixes Index: roselements.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/rosimporter/roselements.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roselements.h 22 Feb 2006 19:42:07 -0000 1.4 --- roselements.h 23 Feb 2006 13:40:23 -0000 1.5 *************** *** 97,100 **** --- 97,106 ---- RE_GRAPHICALREPRESENTATION, RE_POLYGON, + RE_TRIANGLESTRIP, + RE_PHYSICALREPRESENTATION, + RE_SIMPLEBOX, + RE_SIMPLESPHERE, + RE_SIMPLECYLINDER, + RE_SIMPLECAPPEDCYLINDER, RE_MACRO, Index: roselements.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/rosimporter/roselements.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roselements.cpp 22 Feb 2006 19:42:07 -0000 1.4 --- roselements.cpp 23 Feb 2006 13:40:23 -0000 1.5 *************** *** 67,71 **** --- 67,78 ---- ROS_DEFINE_ELEMENT(RE_VERTEX,"Vertex"); ROS_DEFINE_ELEMENT(RE_GRAPHICALREPRESENTATION, "GraphicalRepresentation"); + ROS_DEFINE_ELEMENT(RE_PHYSICALREPRESENTATION,"PhysicalRepresentation"); ROS_DEFINE_ELEMENT(RE_POLYGON,"Polygon"); + ROS_DEFINE_ELEMENT(RE_TRIANGLESTRIP,"TriangleStrip"); + + ROS_DEFINE_ELEMENT(RE_SIMPLEBOX,"SimpleBox"); + ROS_DEFINE_ELEMENT(RE_SIMPLESPHERE,"SimpleSphere"); + ROS_DEFINE_ELEMENT(RE_SIMPLECYLINDER,"SimpleCylinder"); + ROS_DEFINE_ELEMENT(RE_SIMPLECAPPEDCYLINDER,"SimpleCappedCylinder"); ROS_DEFINE_ELEMENT(RE_MACRO, "Macro"); Index: rosimporter.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/rosimporter/rosimporter.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rosimporter.cpp 22 Feb 2006 19:42:07 -0000 1.8 --- rosimporter.cpp 23 Feb 2006 13:40:23 -0000 1.9 *************** *** 21,24 **** --- 21,25 ---- */ #include "rosimporter.h" + #include <GL/glu.h> #include <tinyxml/xmlfunctions.h> #include <zeitgeist/logserver/logserver.h> *************** *** 32,35 **** --- 33,37 ---- #include <oxygen/physicsserver/body.h> #include <oxygen/physicsserver/hingejoint.h> + #include <oxygen/geometryserver/geometryserver.h> #include <oxygen/geometryserver/trimesh.h> #include <kerosin/openglserver/glbase.h> *************** *** 39,42 **** --- 41,45 ---- #include <kerosin/sceneserver/sphere.h> #include <kerosin/sceneserver/ccylinder.h> + #include <kerosin/sceneserver/staticmesh.h> #include <kerosin/renderserver/renderserver.h> #include <boost/scoped_array.hpp> *************** *** 56,61 **** --- 59,116 ---- static const string S_UNNAMED("<unnamed>"); + // ------------------- + + boost::shared_array<float> RosImporter::TVertexList::GetPos() + { + if (pos.get() != 0) + { + return pos; + } + + pos = shared_array<float> (new float[vertexRef.size() * 3]); + + int i=0; + for ( + TVertexRef::iterator iter = vertexRef.begin(); + iter != vertexRef.end(); + ++iter + ) + { + TVertex& vertex = (*iter).second; + vertex.idx = i; + + pos[(i*3)+0] = vertex.vec[0]; + pos[(i*3)+1] = vertex.vec[1]; + pos[(i*3)+2] = vertex.vec[2]; + + ++i; + } + + return pos; + } + + int RosImporter::TVertexList::GetIndex(const std::string& name) + { + TVertexRef::const_iterator iter = vertexRef.find(name); + if (iter == vertexRef.end()) + { + return -1; + } + + return (*iter).second.idx; + } + + + void RosImporter::TVertexList::AddVertex(const std::string& name, const TVertex& vertex) + { + pos.reset(); + vertexRef[name] = vertex; + } + + // ------------------- + RosImporter::TMacroMap RosImporter::mMacroMap; + RosImporter::RosImporter() : SceneImporter() { *************** *** 332,336 **** if (materialServer.get() == 0) { ! GetLog()->Error() << "(RosImporter) failed to lookup MaterialServer node\n"; return false; } --- 387,391 ---- if (materialServer.get() == 0) { ! GetLog()->Error() << "(RosImporter) ERROR: failed to lookup MaterialServer node\n"; return false; } *************** *** 392,396 **** if (renderServer.get() == 0) { ! GetLog()->Error() << "(RosImporter) failed to lookup RenderServer node\n"; return false; } --- 447,451 ---- if (renderServer.get() == 0) { ! GetLog()->Error() << "(RosImporter) ERROR: failed to lookup RenderServer node\n"; return false; } *************** *** 557,560 **** --- 612,620 ---- ) { + if (IgnoreNode(node)) + { + continue; + } + TiXmlElement* element = static_cast<TiXmlElement*>(node); if (element == 0) *************** *** 610,613 **** --- 670,679 ---- } + void RosImporter::ApplyTransform(shared_ptr<Transform> transform, const Trans& trans) + { + transform->SetLocalRotationDeg(trans.rotate); + transform->SetLocalPos(trans.translate); + } + shared_ptr<Transform> RosImporter::CreateTransform(shared_ptr<BaseNode> parent, const Trans& trans) { *************** *** 615,620 **** (GetCore()->New("/oxygen/Transform")); ! transform->SetLocalRotationDeg(trans.rotate); ! transform->SetLocalPos(trans.translate); parent->AddChildReference(transform); --- 681,685 ---- (GetCore()->New("/oxygen/Transform")); ! ApplyTransform(transform, trans); parent->AddChildReference(transform); *************** *** 949,952 **** --- 1014,1018 ---- shared_ptr<Body> RosImporter::GetJointParentBody(shared_ptr<BaseNode> parent) { + GetLog()->Debug() << "RosImporter::GetJointParentBody for " << parent->GetFullPath() << "\n"; for ( shared_ptr<BaseNode> node = parent; *************** *** 958,965 **** if (body.get() != 0) { return body; } } ! return shared_ptr<Body>(); } --- 1024,1032 ---- if (body.get() != 0) { + GetLog()->Debug() << "RosImporter::GetJointParentBody found " << body->GetFullPath() << "\n"; return body; } } ! GetLog()->Debug() << "RosImporter::GetJointParentBody not found\n"; return shared_ptr<Body>(); } *************** *** 968,971 **** --- 1035,1040 ---- { // find the body created most recently + GetLog()->Debug() << "RosImporter::GetJointChildBody for " << parent->GetFullPath() << "\n"; + Leaf::TLeafList children; parent->ListChildrenSupportingClass<Transform>(children,false); *************** *** 982,989 **** --- 1051,1060 ---- if (body.get() != 0) { + GetLog()->Debug() << "RosImporter::GetJointChildBody found " << body->GetFullPath() << "\n"; return body; } } + GetLog()->Debug() << "RosImporter::GetJointChildBody not found\n"; return shared_ptr<Body>(); } *************** *** 1086,1090 **** transform->SetName(S_MACRO+instance); ! GetLog()->Debug() << "(RosImporter) START instancing macro " << name << "\n"; shared_ptr<TiXmlElement> tree = (*iter).second; --- 1157,1162 ---- transform->SetName(S_MACRO+instance); ! GetLog()->Debug() << "(RosImporter) START instancing macro " << name ! << " as instance " << instance << "\n"; shared_ptr<TiXmlElement> tree = (*iter).second; *************** *** 1092,1096 **** GetLog()->Debug() << "(RosImporter) END instancing macro " << name << "\n"; - return ok; } --- 1164,1167 ---- *************** *** 1132,1141 **** case RosElements::RE_VERTEX: { ! Vector3f vec; string name; if ( (! ReadAttribute(element, RA_NAME, name)) || ! (! ReadVector(element, vec)) ) { --- 1203,1212 ---- case RosElements::RE_VERTEX: { ! TVertex vertex; string name; if ( (! ReadAttribute(element, RA_NAME, name)) || ! (! ReadVector(element, vertex.vec)) ) { *************** *** 1143,1147 **** } ! vertices[name] = vec; break; } --- 1214,1218 ---- } ! vertices.AddVertex(name, vertex); break; } *************** *** 1155,1163 **** bool RosImporter::ReadComplexShape(shared_ptr<BaseNode> parent, TiXmlElement* element, ENodeContext context) { string name; Trans trans; Appearance appear; Physical physical; - TVertexList vertices; if ( --- 1226,1242 ---- bool RosImporter::ReadComplexShape(shared_ptr<BaseNode> parent, TiXmlElement* element, ENodeContext context) { + shared_ptr<GeometryServer> geometryServer = shared_dynamic_cast<GeometryServer> + (GetCore()->Get("/sys/server/geometry")); + + if (geometryServer.get() == 0) + { + GetLog()->Error() << "(RosImporter) ERROR: failed to lookup GeometryServer node\n"; + return false; + } + string name; Trans trans; Appearance appear; Physical physical; if ( *************** *** 1186,1204 **** transform->SetName(name); ! // TODO: read <Appearance> tag, does ist always 'ref' to the ! // surrounding compley shape? ! TriMesh mesh; ! if (! ReadGraphicalRep(parent, element, mesh)) { return false; } ! GetLog()->Debug() << "(RosImporter) read complex shape " << name << "\n"; ! return true; } ! bool RosImporter::ReadGraphicalRep(shared_ptr<BaseNode> parent, TiXmlElement* element, TriMesh& mesh) { TiXmlElement* graphRepElem = GetFirstChild(element, RosElements::RE_GRAPHICALREPRESENTATION); --- 1265,1293 ---- transform->SetName(name); ! if (! ReadPhysicalRep(transform,element,context)) ! { ! return false; ! } ! shared_ptr<TriMesh> mesh(new TriMesh); ! mesh->SetName(name); ! ! if (! ReadGraphicalRep(element, mesh, appear)) { return false; } ! geometryServer->RegisterMesh(mesh); ! shared_ptr<StaticMesh> staticMesh = shared_dynamic_cast<StaticMesh> ! (GetCore()->New("/kerosin/StaticMesh")); ! transform->AddChildReference(staticMesh); ! staticMesh->Load(name); ! ! GetLog()->Debug() << "(RosImporter) read complex shape " << name << "\n"; ! return ReadChildElements(transform, element, context); } ! bool RosImporter::ReadGraphicalRep(TiXmlElement* element, shared_ptr<TriMesh> mesh, const Appearance& appear) { TiXmlElement* graphRepElem = GetFirstChild(element, RosElements::RE_GRAPHICALREPRESENTATION); *************** *** 1220,1224 **** } ! TVertexListMap::const_iterator iter = mVertexListMap.find(vertexListName); if (iter == mVertexListMap.end()) { --- 1309,1313 ---- } ! TVertexListMap::iterator iter = mVertexListMap.find(vertexListName); if (iter == mVertexListMap.end()) { *************** *** 1232,1237 **** } - const TVertexList& vertexList = (*iter).second; - TComplexGeomList geomList; if (! ReadComplexElements(graphRepElem, geomList)) --- 1321,1324 ---- *************** *** 1240,1243 **** --- 1327,1335 ---- } + TVertexList& vertexList = (*iter).second; + BuildTriMesh(mesh, vertexList, geomList, appear); + + GetLog()->Debug() << "(RosImporter) read graphical representation\n"; + return true; } *************** *** 1245,1256 **** bool RosImporter::ReadComplexElements(TiXmlElement* element, TComplexGeomList& geomList) { - // TODO: read TriangleStrips - for ( ! TiXmlNode* node = GetFirstChild(element, RosElements::RE_POLYGON); node != 0; node = element->IterateChildren(node) ) { TiXmlElement* element = static_cast<TiXmlElement*>(node); --- 1337,1351 ---- bool RosImporter::ReadComplexElements(TiXmlElement* element, TComplexGeomList& geomList) { for ( ! TiXmlNode* node = element->FirstChild(); node != 0; node = element->IterateChildren(node) ) { + if (IgnoreNode(node)) + { + continue; + } + TiXmlElement* element = static_cast<TiXmlElement*>(node); *************** *** 1264,1276 **** case RosElements::RE_POLYGON: ! ComplexGeom geom(CG_Polygon); ! if (! ReadComplexGeom(element, geom)) ! { ! return false; ! } ! GetLog()->Debug() << "(RosImporter) read polygon with " << geom.vertices.size() << " vertices\n"; ! geomList.push_back(geom); ! break; } } --- 1359,1388 ---- case RosElements::RE_POLYGON: ! { ! ComplexGeom geom(CG_Polygon); ! if (! ReadComplexGeom(element, geom)) ! { ! return false; ! } ! GetLog()->Debug() << "(RosImporter) read polygon with " ! << geom.vertices.size() << " vertices\n"; ! geomList.push_back(geom); ! break; ! } ! ! case RosElements::RE_TRIANGLESTRIP: ! { ! ComplexGeom geom(CG_TriangleStrip); ! if (! ReadComplexGeom(element, geom)) ! { ! return false; ! } ! ! GetLog()->Debug() << "(RosImporter) read triangle strip with " ! << geom.vertices.size() << " vertices\n"; ! geomList.push_back(geom); ! break; ! } } } *************** *** 1313,1314 **** --- 1425,1685 ---- return true; } + + void RosImporter::BuildTriMesh(shared_ptr<TriMesh> mesh, TVertexList& vertexList, + const TComplexGeomList& geomList, const Appearance& appear) + { + GetLog()->Debug() << "(RosImporter) building trimesh for " << mesh->GetName() << "\n"; + mesh->SetPos(vertexList.GetPos(), vertexList.GetPosCount()); + + shared_ptr<IndexBuffer> ibuffer(new IndexBuffer); + IndexBuffer& ibufferRef = (*ibuffer); + + // build triangles + for ( + TComplexGeomList::const_iterator iter = geomList.begin(); + iter != geomList.end(); + ++iter + ) + { + const ComplexGeom& geom = (*iter); + + switch (geom.type) + { + default: + continue; + + case CG_Polygon: + BuildPolygon(ibufferRef, vertexList, geom); + break; + } + } + + mesh->AddFace(ibuffer,appear.ref); + } + + void RosImporter::BuildPolygon(IndexBuffer& ibuffer, TVertexList& vertexList, const ComplexGeom& geom) + { + int nVerts = static_cast<int>(geom.vertices.size()); + int j = (nVerts - 2); + + for (int i = 0;i<j;++i) + { + ibuffer.Cache(vertexList.GetIndex(geom.vertices[0])); + ibuffer.Cache(vertexList.GetIndex(geom.vertices[i+1])); + ibuffer.Cache(vertexList.GetIndex(geom.vertices[i+2])); + } + } + + bool RosImporter::ReadPhysicalRep(shared_ptr<Transform> transform, TiXmlElement* element, ENodeContext context) + { + TiXmlElement* physicalRep = GetFirstChild(element, RosElements::RE_PHYSICALREPRESENTATION); + if (physicalRep == 0) + { + string name = S_UNNAMED; + ReadAttribute(element, RA_NAME, name, true); + + GetLog()->Error() << "(RosImporter) ERROR: missing physical representation in " + << GetXMLPath(element) << " name " << name << " \n"; + + return false; + } + + // we currently read only the first physical representation of the + // complex shape and use its translation to modify the parent + // transform under which the static mesh is registered. TODO: + // figure out how to align the graphical representation with the + // physical representation if more than one geom is present + + for ( + TiXmlNode* node = physicalRep->FirstChild(); + node != 0; + node = physicalRep->IterateChildren(node) + ) + { + if (IgnoreNode(node)) + { + continue; + } + + TiXmlElement* element = static_cast<TiXmlElement*>(node); + + RosElements::ERosElement type = GetType(element); + switch (type) + { + default: + GetLog()->Error() << "(RosImporter::ReadPhysicalRep) ERROR: skipping unknown element " + << GetXMLPath(element) << "\n"; + break; + + case RosElements::RE_SIMPLEBOX: + return ReadSimpleBox(transform, element, context); + + case RosElements::RE_SIMPLESPHERE: + return ReadSimpleSphere(transform, element, context); + + case RosElements::RE_SIMPLECYLINDER: + //! simulate cylinder with a capped cylinder + case RosElements::RE_SIMPLECAPPEDCYLINDER: + return ReadSimpleCappedCylinder(transform, element, context); + + + // RE_SIMPLECYLINDER, + // RE_SIMPLECAPPEDCYLINDER, + + } + } + + GetLog()->Debug() << "(RosImporter) read physical representation\n"; + + return true; + } + + bool RosImporter::ReadSimpleBox(shared_ptr<Transform> transform, TiXmlElement* element, ENodeContext context) + { + string name; + double length; + double width; + double height; + Trans trans; + Physical physical; + + if ( + (! ReadAttribute(element, RA_NAME, name, true)) || + (! ReadAttribute(element, RA_LENGTH, length)) || + (! ReadAttribute(element, RA_WIDTH, width)) || + (! ReadAttribute(element, RA_HEIGHT, height)) || + (! ReadTrans(element, trans)) || + (! ReadPhysical(element, physical, context)) + ) + { + return false; + } + + // transform + ApplyTransform(transform, trans); + Vector3f boxDim = Vector3f(length, width, height); + + if (HasBody(physical, context)) + { + shared_ptr<Body> body = shared_dynamic_cast<Body> + (GetCore()->New("/oxygen/Body")); + + transform->AddChildReference(body); + + body->SetName(S_BODY+name); + body->SetBoxTotal(physical.mass, boxDim); + //! TODO: set mass center + } + + // geometry + shared_ptr<BoxCollider> collider = shared_dynamic_cast<BoxCollider> + (GetCore()->New("/oxygen/BoxCollider")); + + transform->AddChildReference(collider); + collider->SetName(S_GEOM+name); + collider->SetBoxLengths(boxDim); + + // collision handler + shared_ptr<ContactJointHandler> handler = CreateContactJointHandler(); + collider->AddChildReference(handler); + + GetLog()->Debug() << "(RosImporter) created simple box " << name << "\n"; + return true; + } + + bool RosImporter::ReadSimpleSphere(shared_ptr<Transform> transform, TiXmlElement* element, ENodeContext context) + { + string name; + double radius; + Trans trans; + Physical physical; + + if ( + (! ReadAttribute(element, RA_NAME, name, true)) || + (! ReadAttribute(element, RA_RADIUS, radius)) || + (! ReadTrans(element, trans)) || + (! ReadPhysical(element, physical, context)) + ) + { + return false; + } + + // transform + ApplyTransform(transform, trans); + + if (HasBody(physical, context)) + { + shared_ptr<Body> body = shared_dynamic_cast<Body> + (GetCore()->New("/oxygen/Body")); + + transform->AddChildReference(body); + + body->SetName(S_BODY+name); + body->SetSphereTotal(physical.mass, radius); + //! TODO: set mass center + } + + // geometry + shared_ptr<SphereCollider> collider = shared_dynamic_cast<SphereCollider> + (GetCore()->New("/oxygen/SphereCollider")); + + transform->AddChildReference(collider); + collider->SetRadius(radius); + + // collision handler + shared_ptr<ContactJointHandler> handler = CreateContactJointHandler(); + collider->AddChildReference(handler); + + GetLog()->Debug() << "(RosImporter) created simple sphere " << name << "\n"; + return true; + } + + bool RosImporter::ReadSimpleCappedCylinder(shared_ptr<Transform> transform, TiXmlElement* element, ENodeContext context) + { + string name; + double radius; + double height; + Trans trans; + Physical physical; + + if ( + (! ReadAttribute(element, RA_NAME, name, true)) || + (! ReadAttribute(element, RA_RADIUS, radius)) || + (! ReadAttribute(element, RA_HEIGHT, height)) || + (! ReadTrans(element, trans)) || + (! ReadPhysical(element, physical, context)) + ) + { + return false; + } + + // transform + ApplyTransform(transform, trans); + + if (HasBody(physical, context)) + { + shared_ptr<Body> body = shared_dynamic_cast<Body> + (GetCore()->New("/oxygen/Body")); + + transform->AddChildReference(body); + + body->SetName(S_BODY+name); + body->SetCappedCylinderTotal(physical.mass, radius, height); + //! TODO: set mass center + } + + // geometry + shared_ptr<CCylinderCollider> collider = shared_dynamic_cast<CCylinderCollider> + (GetCore()->New("/oxygen/CCylinderCollider")); + collider->SetName(S_GEOM+name); + + transform->AddChildReference(collider); + collider->SetParams(radius, height); + + // collision handler + shared_ptr<ContactJointHandler> handler = CreateContactJointHandler(); + collider->AddChildReference(handler); + + GetLog()->Debug() << "(RosImporter) created simple capped cylinder " << name << "\n"; + return true; + } Index: rosimporter.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/rosimporter/rosimporter.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** rosimporter.h 22 Feb 2006 19:42:07 -0000 1.7 --- rosimporter.h 23 Feb 2006 13:40:23 -0000 1.8 *************** *** 24,28 **** --- 24,30 ---- #include <map> + #include <boost/shared_array.hpp> #include <oxygen/sceneserver/sceneimporter.h> + #include <oxygen/geometryserver/trimesh.h> #include <tinyxml/tinyxml.h> #include "roselements.h" *************** *** 34,38 **** class ContactJointHandler; class Body; ! class TriMesh; } --- 36,40 ---- class ContactJointHandler; class Body; ! class Transform; } *************** *** 93,106 **** typedef std::map<std::string, boost::shared_ptr<TiXmlElement> > TMacroMap; /** define a mapping from name to vertex name as defined within a VertexList element */ ! typedef std::map<std::string, salt::Vector3f> TVertexList; /** define a mapping from name to vertex list name */ typedef std::map<std::string, TVertexList> TVertexListMap; ! /** define a list of string references into a vertex list */ ! typedef std::list<std::string> TVertexRefList; /** the possible types of complex geoms that make up a --- 95,142 ---- typedef std::map<std::string, boost::shared_ptr<TiXmlElement> > TMacroMap; + struct TVertex + { + public: + //! the vertex data + salt::Vector3f vec; + + //! the index into an associated flat vertex array as used in + //the TriMesh class + int idx; + public: + TVertex() : idx(-1) {} + }; + /** define a mapping from name to vertex name as defined within a VertexList element */ ! typedef std::map<std::string, TVertex> TVertexRef; ! ! struct TVertexList ! { ! protected: ! /** mapping from vertex name to vector and index into the pos ! array ! */ ! TVertexRef vertexRef; ! ! /** flat array of vertices with 3 consecutive floats ! representing a vertex vector ! */ ! boost::shared_array<float> pos; ! ! public: ! const TVertexRef& GetVertexRef() { return vertexRef; } ! void AddVertex(const std::string& name, const TVertex& vertex); ! boost::shared_array<float> GetPos(); ! int GetIndex(const std::string& name); ! int GetPosCount() const { return static_cast<int>(vertexRef.size()); } ! }; /** define a mapping from name to vertex list name */ typedef std::map<std::string, TVertexList> TVertexListMap; ! /** define a vector of string references into a vertex list */ ! typedef std::vector<std::string> TVertexRefVec; /** the possible types of complex geoms that make up a *************** *** 118,122 **** public: EComplexGeom type; ! TVertexRefList vertices; public: --- 154,158 ---- public: EComplexGeom type; ! TVertexRefVec vertices; public: *************** *** 154,157 **** --- 190,195 ---- std::string GetName(RosElements::ERosElement element) const; + void ApplyTransform(boost::shared_ptr<oxygen::Transform> transform, const Trans& trans); + boost::shared_ptr<oxygen::Transform> CreateTransform (boost::shared_ptr<oxygen::BaseNode> parent, const Trans& trans); *************** *** 201,207 **** bool ReadVertexList(TiXmlElement* element); bool ReadComplexShape(boost::shared_ptr<oxygen::BaseNode> parent, TiXmlElement* element, ENodeContext context); ! bool ReadGraphicalRep(boost::shared_ptr<oxygen::BaseNode> parent, TiXmlElement* element, oxygen::TriMesh& mesh); bool ReadComplexElements(TiXmlElement* element, TComplexGeomList& geomList); bool ReadComplexGeom(TiXmlElement* element, ComplexGeom& geom); protected: --- 239,252 ---- bool ReadVertexList(TiXmlElement* element); bool ReadComplexShape(boost::shared_ptr<oxygen::BaseNode> parent, TiXmlElement* element, ENodeContext context); ! bool ReadGraphicalRep(TiXmlElement* element, boost::shared_ptr<oxygen::TriMesh> mesh, const Appearance& appear); bool ReadComplexElements(TiXmlElement* element, TComplexGeomList& geomList); bool ReadComplexGeom(TiXmlElement* element, ComplexGeom& geom); + void BuildTriMesh(boost::shared_ptr<oxygen::TriMesh> mesh, TVertexList& vertexList, const TComplexGeomList& geomList, const Appearance& appear); + void BuildPolygon(oxygen::IndexBuffer& ibuffer, TVertexList& vertexList, const ComplexGeom& geom); + + bool ReadPhysicalRep(boost::shared_ptr<oxygen::Transform> transform, TiXmlElement* element, ENodeContext context); + bool ReadSimpleBox(boost::shared_ptr<oxygen::Transform> transform, TiXmlElement* element, ENodeContext context); + bool ReadSimpleSphere(boost::shared_ptr<oxygen::Transform> transform, TiXmlElement* element, ENodeContext context); + bool ReadSimpleCappedCylinder(boost::shared_ptr<oxygen::Transform> transform, TiXmlElement* element, ENodeContext context); protected: |