1 #ifndef _WALL_GEOMETRY_H
2 #define _WALL_GEOMETRY_H
12 #include <xercesc/parsers/XercesDOMParser.hpp>
13 #include <xercesc/dom/DOM.hpp>
14 #include <xercesc/sax/HandlerBase.hpp>
15 #include <xercesc/util/XMLString.hpp>
16 #include <xercesc/util/PlatformUtils.hpp>
18 #include <osgDB/ReadFile>
20 #include <osg/Geometry>
22 #include <osg/StateSet>
23 #include <osg/Material>
24 #include <osg/CullFace>
25 #include <osg/LightModel>
36 using namespace vrecko;
37 using namespace vrecko;
38 using namespace WGeometry;
40 namespace APRoomEdit {
48 osg::Geode* pOSGGeode;
51 osg::Vec3Array* pOSGVertexArray;
57 std::vector<osg::ref_ptr<WG_Wall> > walls;
60 std::vector<osg::ref_ptr<WG_Point> > points;
64 std::map<unsigned int, WG_Wall*> wallMap;
65 std::map<unsigned int, WG_Point*> pointMap;
76 osg::Vec3& TCWV, osg::Vec3& TCCWV, osg::Vec3& BCWV, osg::Vec3& BCCWV);
86 virtual void preInitialize();
89 virtual void postInitialize();
92 virtual bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *pParametersNode);
94 inline osg::Geode*
getGeode() {
return pOSGGeode; }
96 void createDefaultRoom();
103 unsigned int index = intersection->indexList.at(0);
104 return (wallMap.find(index) != wallMap.end() ? wallMap[index] : NULL);
108 unsigned int index = intersection->indexList.at(0);
109 WG_Wall* wall = getWall(intersection);
111 osg::Vec2 vectorQ, vectorR;
113 vectorQ = osg::Vec2(intersection->getLocalIntersectPoint().x(), intersection->getLocalIntersectPoint().z()) - wall->
getPoint(
WG_Q_POINT)->
getPosition();
114 vectorR = osg::Vec2(intersection->getLocalIntersectPoint().x(), intersection->getLocalIntersectPoint().z()) - wall->
getPoint(
WG_R_POINT)->
getPosition();
118 point = (pointMap.find(index) != pointMap.end() ? pointMap[index] : NULL);
123 void activateTool(
Tool* tool, osgUtil::LineSegmentIntersector::Intersection* intersection) {
127 selectedWall = getWall(intersection);
128 selectedPoint = getPoint(intersection);
130 if (selectedWall != NULL) {
131 osg::Vec2 tempVector = osg::Vec2(intersection->getLocalIntersectPoint().x(), intersection->getLocalIntersectPoint().z());
134 tempVector = tempVector - tempPoint->
getPosition();
137 angle = angle - selectedWall->getAngle(
WG_Q_POINT);
144 tool->
init(intersection, selectedWall, selectedPoint, selectedType, pEOOwner, &walls, &points, pOSGGeode, pOSGVertexArray);
157 tool->
terminate(intersection, selectedWall, selectedPoint, selectedType, pEOOwner, &walls, &points, pOSGGeode, pOSGVertexArray);
165 void updateTool(
Tool* tool, osgUtil::LineSegmentIntersector::Intersection* intersection, osg::Vec3 movingVector) {
169 tool->
update(intersection, selectedWall, selectedPoint, selectedType, pEOOwner, &walls, &points, pOSGGeode, pOSGVertexArray, movingVector);