4 #include "OsgGeometry.h"
16 AnimatBase *m_lpThisAB;
17 MovableItem *m_lpThisMI;
22 osg::Matrix m_osgWorldMatrix;
24 osg::ref_ptr<osg::MatrixTransform> m_osgParent;
25 osg::ref_ptr<osgManipulator::Selection> m_osgMT;
26 osg::ref_ptr<osg::Geometry> m_osgGeometry;
27 osg::ref_ptr<osg::Group> m_osgRoot;
28 osg::ref_ptr<osg::Node> m_osgNode;
29 osg::ref_ptr<osg::Group> m_osgNodeGroup;
30 osg::ref_ptr<osg::Node> m_osgDebugNode;
32 osg::ref_ptr<osg::CullFace> m_osgCull;
33 osg::ref_ptr<osg::Texture2D> m_osgTexture;
35 osg::ref_ptr<osg::StateSet> m_osgStateSet;
36 osg::ref_ptr<osg::Material> m_osgMaterial;
38 osg::ref_ptr<osg::Group> m_osgSelectedGroup;
39 osg::ref_ptr<OsgDragger> m_osgDragger;
41 osg::Matrix m_osgLocalMatrix;
51 osg::Matrix m_osgFinalMatrix;
52 bool m_bCullBackfaces;
53 osg::StateAttribute::GLMode m_eTextureMode;
55 osg::ref_ptr<osg::MatrixTransform> m_osgSelVertexMT;
56 osg::ref_ptr<osg::Geode> m_osgSelVertexNode;
58 virtual void SetThisPointers();
59 virtual void LocalMatrix(osg::Matrix osgLocalMT);
60 virtual void GeometryRotationMatrix(osg::Matrix osgGeometryMT);
62 virtual void CreateSelectedGraphics(std::string strName);
63 virtual void CreateDragger(std::string strName);
64 virtual void CreateSelectedVertex(std::string strName);
65 virtual void DeleteSelectedVertex();
66 virtual void AttachedPartMovedOrRotated(std::string strID);
67 virtual void UpdatePositionAndRotationFromMatrix();
68 virtual void UpdatePositionAndRotationFromMatrix(osg::Matrix osgMT);
69 virtual osg::Matrix CalculateTransformRelativeToParent(osg::Matrix osgLocalMatrix);
71 virtual void InitializeGraphicsGeometry();
72 virtual void CreateGraphicsGeometry();
73 virtual void CreatePhysicsGeometry();
74 virtual void CreateGeometry(
bool bOverrideStatic =
false);
75 virtual void ResizePhysicsGeometry();
76 virtual void ResetPhyiscsAndChildJoints();
78 virtual void UpdateWorldMatrix();
80 virtual void ShowSelectedVertex();
81 virtual void HideSelectedVertex();
89 virtual osg::MatrixTransform *ParentOSG() = 0;
90 virtual osg::Group *RootGroup() {
return m_osgRoot.get();};
91 virtual osg::Group *NodeGroup() {
return m_osgNodeGroup.get();};
92 virtual osg::Matrix LocalMatrix() {
return m_osgLocalMatrix;};
93 virtual osg::Matrix FinalMatrix() {
return m_osgFinalMatrix;};
94 virtual void FinalMatrix(osg::Matrix vFinal);
96 virtual void Physics_SetParent(MovableItem *lpParent)
98 m_lpParentVsMI =
dynamic_cast<OsgMovableItem *
>(lpParent);
100 virtual void Physics_SetChild(MovableItem *lpParent) {};
104 virtual CStdFPoint GetOSGWorldCoords();
105 virtual osg::Matrix GetOSGWorldMatrix(
bool bUpdate =
false);
108 virtual void SetupGraphics();
109 virtual void SetupPhysics() = 0;
110 virtual void DeleteGraphics();
111 virtual void DeletePhysics(
bool bIncludeChildren) = 0;
113 virtual void StartGripDrag();
114 virtual void EndGripDrag();
116 virtual std::string Physics_ID();
117 virtual void Physics_UpdateMatrix();
118 virtual void Physics_ResetGraphicsAndPhysics();
119 virtual void Physics_PositionChanged();
120 virtual void Physics_RotationChanged();
121 virtual void Physics_UpdateAbsolutePosition();
122 virtual void Physics_Selected(
bool bValue,
bool bSelectMultiple);
123 virtual float Physics_GetBoundingRadius();
124 virtual BoundingBox Physics_GetBoundingBox();
125 virtual void Physics_SetColor() {};
126 virtual void Physics_TextureChanged() {};
127 virtual void Physics_CollectData();
128 virtual void Physics_CollectExtraData() {};
129 virtual void Physics_ResetSimulation();
130 virtual void Physics_AfterResetSimulation() {};
131 virtual float *Physics_GetDataPointer(
const std::string &strDataType);
132 virtual void Physics_OrientNewPart(
float fltXPos,
float fltYPos,
float fltZPos,
float fltXNorm,
float fltYNorm,
float fltZNorm);
133 virtual void Physics_SelectedVertex(
float fltXPos,
float fltYPos,
float fltZPos) {};
134 virtual bool Physics_CalculateLocalPosForWorldPos(
float fltWorldX,
float fltWorldY,
float fltWorldZ, CStdFPoint &vLocalPos);
135 virtual void Physics_LoadLocalTransformMatrix(CStdXml &oXml);
136 virtual void Physics_SaveLocalTransformMatrix(CStdXml &oXml);
137 virtual std::string Physics_GetLocalTransformMatrixString();
138 virtual void Physics_ResizeDragHandler(
float fltRadius);
140 virtual void SetTexture(std::string strTexture);
141 virtual void SetCulling();
142 virtual void SetColor(CStdColor &vAmbient, CStdColor &vDiffuse, CStdColor &vSpecular,
float fltShininess);
143 virtual void SetAlpha();
144 virtual void SetMaterialAlpha(osg::Material *osgMat, osg::StateSet *ss,
float fltAlpha);
145 virtual void SetVisible(
bool bVisible);
146 virtual void SetVisible(osg::Node *osgNode,
bool bVisible);
148 virtual void CreateItem();
149 virtual bool AddOsgNodeToParent() {
return true;};
151 virtual osg::Matrix GetWorldMatrix();
152 virtual osg::Matrix GetPhysicsWorldMatrix() {
return GetWorldMatrix();};
153 virtual osg::Matrix GetComMatrix(
bool bInvert =
false);
155 virtual osg::Matrix GetParentWorldMatrix();
156 virtual osg::Matrix GetParentPhysicsWorldMatrix();
157 virtual osg::Matrix GetParentComMatrix(
bool bInvert =
false);
159 virtual osg::MatrixTransform* GetMatrixTransform();
160 virtual osg::MatrixTransform* GetCameraMatrixTransform();
162 virtual void BuildLocalMatrix();
163 virtual void BuildLocalMatrix(CStdFPoint vLocalOffset);
164 virtual void BuildLocalMatrix(CStdFPoint localPos, CStdFPoint vLocalOffset, CStdFPoint localRot, std::string strName);
osg::ref_ptr< osg::MatrixTransform > m_osgGeometryRotationMT
Classes for implementing the cm-labs vortex physics engine for AnimatLab.