#include <ttable.h>
Public Types | |
| enum | TransformMode { TRANSFORM_RELATIVE = 0, TRANSFORM_ABSOLUTE = 1, TRANSFORM_ROTATION = 2, TRANSFORM_TRANSLATION = 3, TRANSFORM_USE_RELATIVE = 4, TRANSFORM_USE_ROTATION = 5, TRANSFORM_USE_TRANSLATION = 6, WORLD_TRANSFORM_RELATIVE = 7, WORLD_TRANSFORM_ROTATION = 8, WORLD_TRANSFORM_TRANSLATION = 9, WORLD_TRANSFORM_USE_RELATIVE = 10, WORLD_TRANSFORM_USE_ROTATION = 11, WORLD_TRANSFORM_USE_TRANSLATION = 12 } |
| Mode of transformation. More... | |
Public Member Functions | |
| TTableEntry (int BodyID, Body::BodyType type, int IDscene, int IDsceneNode, Condition condition=Condition(), TransformMode mod=TRANSFORM_RELATIVE, float scale=1) | |
| Constructor. | |
| ~TTableEntry () | |
| Destructor. | |
| void | SetScale (float scale) |
| Set another value of scale parameter. | |
| void | SetTransformMode (TransformMode mod) |
| Set another mode of transformation. | |
| void | SetSceneNode (int scene, int node) |
| assign a node of a scene to transformation | |
| void | SetCondition (Condition condition) |
| Set another condition. | |
| float | GetScale () |
| Returns scale parameter. | |
| TTableEntry::TransformMode | GetTransformationMode () |
| Returns transformation mode. | |
| int | GetSceneID () |
| Returns ID of the scene. | |
| int | GetSceneNodeID () |
| Returns id of the node. | |
| void | GetSceneNode (int &scene, int &node) |
| Returns id of the scene and node. | |
| Condition | GetCondition () |
| Returns condition object. | |
| bool | EvaluateCondition (int buttons, float c1=0, float c2=0) |
| Evaluate assigned condition whether it is satisfied by parameters. Returns true if condition is satisfied. | |
| void | generateEvent (MATRIX bodyMatrix, int buttons, float c1, float c2, VRUT::SceneModule *module) |
| Generates event and send it to Kernel. | |
| int | GetBodyID () |
| returns tracked device number identificator | |
| Body::BodyType | GetBodyType () |
| Returns tracked device type. | |
| MATRIX | PrevMatrix () |
| returns previous matrix | |
| wxString | GetAsString () |
| Returns Entry as string with elements separated by separator. | |
Private Member Functions | |
| void | relativeMatrix (MATRIX &prev, MATRIX &curr) |
| Creates relative transformation matrix and save it to curr matrix. | |
| MATRIX | transformMatrix (const MATRIX *relative, const MATRIX *nodeCurrentMatrix) |
| returns transform matrix that rotates node around original (not current) local matrix of the node | |
| MATRIX | transformMatrixRegardWorld (const MATRIX *relative, const MATRIX *nodeLocalMatrix, const MATRIX *nodeWorldMatrix) |
| returns transform matrix that rotates node around original (not current) local matrix of the node | |
Private Attributes | |
| int | idBody |
| Tracked device Identificator in pair with bodyType it fully specify the tracked device. | |
| Body::BodyType | bodyType |
| Tracked device Type in pair with idBody it fully specify the tracked device. | |
| int | idScene |
| Identificator of scene (in pair with idSceneNode it fully specify the node to be transformed). | |
| int | idSceneNode |
| identificator of node (in pair with idScene it fully specify the node to be transformed) | |
| TransformMode | mode |
| transformation mode | |
| MATRIX | prevMatrix |
| Matrix history. | |
| Condition | transformCondition |
| Condition of transformation. | |
| float | scale |
| A scale of transformation. | |
| bool | changed |
| internal flag | |
Definition at line 74 of file ttable.h.
Mode of transformation.
Be carefull while making decision which mode to use!
Use TRANSFORM_RELATIVE, TRANSFORM_ABSOLUTE, TRANSFORM_ROTATION or TRANSFORM_TRANSLATION in case that events carry absolute position of the tracked device (All Dtrack devices) Use TRANSFORM_USE_RELATIVE, TRANSFORM_USE_ROTATION, TRANSFORM_USE_TRANSLATION in case that event carry relative transformation matrix. (Tracked device or Event emitor do not use absolute position but only relative moves)
| TRANSFORM_RELATIVE | transform coordinates relative to previous position based (Event carry Metrix with absolute position of tracked device) |
| TRANSFORM_ABSOLUTE | transform coordinates to absolute position (Event carry Metrix with absolute position of tracked device) |
| TRANSFORM_ROTATION | transform coordinates by using only rotation (do not translate object) (Event carry Metrix with absolute position of tracked device) |
| TRANSFORM_TRANSLATION | transform coordinates by using only relative translation (Event carry Metrix with absolute position of tracked device) |
| TRANSFORM_USE_RELATIVE | transform coordinates relative by using matrix from event(Event carry Matrix with relative position) |
| TRANSFORM_USE_ROTATION | transform coordinates relative by using only rotation part of the matrix from event. (Event carry Matrix with relative position) |
| TRANSFORM_USE_TRANSLATION | transform coordinates relative by using only translation part of the matrix from event. (Event carry Matrix with relative position) |
| WORLD_TRANSFORM_RELATIVE | transform coordinates relative to previous position based (Event carry Metrix with absolute position of tracked device) and use world axes |
| WORLD_TRANSFORM_ROTATION | transform coordinates by using only rotation (do not translate object) (Event carry Metrix with absolute position of tracked device)and use world axes |
| WORLD_TRANSFORM_TRANSLATION | transform coordinates by using only relative translation (Event carry Metrix with absolute position of tracked device)and use world axes |
| WORLD_TRANSFORM_USE_RELATIVE | transform coordinates relative by using matrix from event(Event carry Matrix with relative position)and use world axes |
| WORLD_TRANSFORM_USE_ROTATION | transform coordinates relative by using only rotation part of the matrix from event. (Event carry Matrix with relative position)and use world axes |
| WORLD_TRANSFORM_USE_TRANSLATION | transform coordinates relative by using only translation part of the matrix from event. (Event carry Matrix with relative position)and use world axes |
Definition at line 82 of file ttable.h.
00083 { 00084 TRANSFORM_RELATIVE = 0, 00085 TRANSFORM_ABSOLUTE = 1, 00086 TRANSFORM_ROTATION = 2, 00087 TRANSFORM_TRANSLATION = 3, 00088 TRANSFORM_USE_RELATIVE = 4, 00089 TRANSFORM_USE_ROTATION = 5, 00090 TRANSFORM_USE_TRANSLATION = 6, 00091 WORLD_TRANSFORM_RELATIVE = 7, 00092 WORLD_TRANSFORM_ROTATION = 8, 00093 WORLD_TRANSFORM_TRANSLATION = 9, 00094 WORLD_TRANSFORM_USE_RELATIVE = 10, 00095 WORLD_TRANSFORM_USE_ROTATION = 11, 00096 WORLD_TRANSFORM_USE_TRANSLATION = 12 00097 00098 };
| TTableEntry::TTableEntry | ( | int | BodyID, | |
| Body::BodyType | type, | |||
| int | IDscene, | |||
| int | IDsceneNode, | |||
| Condition | condition = Condition(), |
|||
| TTableEntry::TransformMode | mod = TRANSFORM_RELATIVE, |
|||
| float | scale = 1 | |||
| ) |
Constructor.
| BodyID | Number identificator of tracked device of given type | |
| type | The type of tracked device (in connection with BodyID compleetly describes trakced device) | |
| IDscene | The scene Identificator | |
| IDsceneNode | Identificator of node in defined Scene. | |
| condition | a condition specification (see class Condition description). | |
| mod | Mode of transformation (see TransformMode enum description). | |
| scale | a scale of transformation. |
Definition at line 45 of file ttable.cpp.
00046 { 00047 this->bodyType = type; 00048 this->idBody = BodyID; 00049 this->idScene = IDscene; 00050 this->idSceneNode= IDsceneNode; 00051 transformCondition = condition; 00052 this->scale = scale; 00053 mode = mod; 00054 changed = false; 00055 }
| TTableEntry::~TTableEntry | ( | ) |
| void TTableEntry::SetScale | ( | float | scale | ) |
Set another value of scale parameter.
| scale | New value of scale. |
Definition at line 59 of file ttable.cpp.
| void TTableEntry::SetTransformMode | ( | TTableEntry::TransformMode | mod | ) |
Set another mode of transformation.
see TransformMode description
Definition at line 64 of file ttable.cpp.
| void TTableEntry::SetSceneNode | ( | int | scene, | |
| int | node | |||
| ) |
assign a node of a scene to transformation
| scene | Scene identificator | |
| node | Identificator of Node in specified scene graph |
Definition at line 69 of file ttable.cpp.
00070 { 00071 changed = true; 00072 idScene = scene; 00073 idSceneNode = node; 00074 }
| void TTableEntry::SetCondition | ( | Condition | condition | ) |
Set another condition.
| condition | New value of condition. (see Condition class description) |
Definition at line 75 of file ttable.cpp.
00076 { 00077 changed = true; 00078 transformCondition = condition; 00079 }
| float TTableEntry::GetScale | ( | ) |
Returns scale parameter.
Definition at line 80 of file ttable.cpp.
00081 { 00082 return scale; 00083 }
| TTableEntry::TransformMode TTableEntry::GetTransformationMode | ( | ) |
Returns transformation mode.
Definition at line 84 of file ttable.cpp.
00085 { 00086 return mode; 00087 }
| int TTableEntry::GetSceneID | ( | ) |
Returns ID of the scene.
Definition at line 89 of file ttable.cpp.
00090 { 00091 return idScene; 00092 }
| int TTableEntry::GetSceneNodeID | ( | ) |
Returns id of the node.
Definition at line 93 of file ttable.cpp.
00094 { 00095 return idSceneNode; 00096 }
| void TTableEntry::GetSceneNode | ( | int & | scene, | |
| int & | node | |||
| ) |
Returns id of the scene and node.
| scene | Variable where to put value of scene identificator | |
| node | Variable where to put value of node identificator |
Definition at line 97 of file ttable.cpp.
00098 { 00099 scene = idScene; 00100 node = idSceneNode; 00101 }
| Condition TTableEntry::GetCondition | ( | ) |
Returns condition object.
Definition at line 102 of file ttable.cpp.
00103 { 00104 return transformCondition; 00105 }
| bool TTableEntry::EvaluateCondition | ( | int | buttons, | |
| float | c1 = 0, |
|||
| float | c2 = 0 | |||
| ) |
Evaluate assigned condition whether it is satisfied by parameters. Returns true if condition is satisfied.
| buttons | Mask of buttons currently pressed | |
| c1 | Analog control n.1 (i.e. Flystick 2 joystick direction left or right). | |
| c2 | Analog control n.2 (i.e. Flystick 2 joystick direction up or down). |
Definition at line 114 of file ttable.cpp.
00115 { 00116 return this->transformCondition.Evaluate(buttons, c1, c2); 00117 }
| void TTableEntry::generateEvent | ( | MATRIX | bodyMatrix, | |
| int | buttons, | |||
| float | c1, | |||
| float | c2, | |||
| VRUT::SceneModule * | module | |||
| ) |
Generates event and send it to Kernel.
| bodyMatrix | current matrix of tracked device | |
| module | Pointer to module TODO: rebuild this method | |
| buttons | - Button mask (to evaluate condition) | |
| c1 | - Control 1 value (to evaluate condition) | |
| c2 | - Control 2 value (to evaluate condition) |
Definition at line 144 of file ttable.cpp.
00145 { 00146 // testovaci 00147 00148 00149 // 00150 if (changed && EvaluateCondition(buttons, c1,c2)) 00151 { 00152 MATRIX tempMatrix = bodyMatrix; 00153 MATRIX scaleMatrix; scaleMatrix._m11 = scaleMatrix._m22 = scaleMatrix._m33 = scale; 00154 scaleMatrix._m44=1; 00155 Scene * scene = module->GetSceneMgr()->GetScene(this->idScene); 00156 const SceneNode * node =scene->GetNode(this->idSceneNode); 00157 scene->UpdateTransformation(this->idSceneNode); 00158 switch(mode) 00159 { 00160 case TRANSFORM_RELATIVE: 00161 { 00162 relativeMatrix(prevMatrix, tempMatrix); 00163 const MATRIX * curr = node->GetLocalTransMatrix(); 00164 tempMatrix._m41 *= scale; 00165 tempMatrix._m42 *= scale; 00166 tempMatrix._m43 *= scale; 00167 MATRIX transform = this->transformMatrix(&tempMatrix, curr); 00168 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00169 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00170 module->PostToKernel(evt); 00171 module->PostToKernel(ev); 00172 break; 00173 } 00174 case TRANSFORM_TRANSLATION: 00175 { 00176 relativeMatrix(prevMatrix, tempMatrix); 00177 tempMatrix._m11 = tempMatrix._m22 = tempMatrix._m33 = tempMatrix._m44 = 1; 00178 tempMatrix._m12 = tempMatrix._m13 = tempMatrix._m14 = tempMatrix._m21 = tempMatrix._m23 = tempMatrix._m24 = tempMatrix._m31 = tempMatrix._m32 = tempMatrix._m34 = 0; 00179 tempMatrix._m41 *= scale; 00180 tempMatrix._m42 *= scale; 00181 tempMatrix._m43 *= scale; 00182 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,tempMatrix); 00183 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00184 module->PostToKernel(evt); 00185 module->PostToKernel(ev); 00186 break; 00187 } 00188 case TRANSFORM_ABSOLUTE: 00189 { 00190 tempMatrix._m41 *= scale; 00191 tempMatrix._m42 *= scale; 00192 tempMatrix._m43 *= scale; 00193 wxCommandEvent evt = VRUT::Event::GET_EVT_SCENE_NODE_TRANSFORM_SET(this->idScene, this->idSceneNode, tempMatrix); 00194 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00195 module->PostToKernel(evt); 00196 module->PostToKernel(ev); 00197 break; 00198 } 00199 case TRANSFORM_ROTATION: 00200 { 00201 relativeMatrix(prevMatrix, tempMatrix); 00202 tempMatrix = tempMatrix.ExtractRotation(); 00203 const MATRIX * curr = node->GetLocalTransMatrix(); 00204 MATRIX transform = this->transformMatrix(&tempMatrix, curr); 00205 wxCommandEvent evt = VRUT::Event::GET_EVT_SCENE_NODE_TRANSFORM(this->idScene, this->idSceneNode, transform); 00206 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00207 module->PostToKernel(evt); 00208 module->PostToKernel(ev); 00209 break; 00210 } 00211 case TRANSFORM_USE_RELATIVE: 00212 { 00213 tempMatrix._m41 *= scale; 00214 tempMatrix._m42 *= scale; 00215 tempMatrix._m43 *= scale; 00216 const MATRIX * curr = node->GetLocalTransMatrix(); 00217 MATRIX transform = this->transformMatrix(&tempMatrix, curr); 00218 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00219 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00220 module->PostToKernel(evt); 00221 module->PostToKernel(ev); 00222 break; 00223 } 00224 case TRANSFORM_USE_ROTATION: 00225 { 00226 tempMatrix = tempMatrix.ExtractRotation(); 00227 const MATRIX * curr = node->GetLocalTransMatrix(); 00228 MATRIX transform = this->transformMatrix(&tempMatrix, curr); 00229 wxCommandEvent evt = VRUT::Event::GET_EVT_SCENE_NODE_TRANSFORM(this->idScene, this->idSceneNode, transform); 00230 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00231 module->PostToKernel(evt); 00232 module->PostToKernel(ev); 00233 break; 00234 } 00235 case TRANSFORM_USE_TRANSLATION: 00236 { 00237 tempMatrix._m11 = tempMatrix._m22 = tempMatrix._m33 = tempMatrix._m44 = 1; 00238 tempMatrix._m12 = tempMatrix._m13 = tempMatrix._m14 = tempMatrix._m21 = tempMatrix._m23 = tempMatrix._m24 = tempMatrix._m31 = tempMatrix._m32 = tempMatrix._m34 = 0; 00239 tempMatrix._m41 *= scale; 00240 tempMatrix._m42 *= scale; 00241 tempMatrix._m43 *= scale; 00242 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,tempMatrix); 00243 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00244 module->PostToKernel(evt); 00245 module->PostToKernel(ev); 00246 break; 00247 } 00248 case WORLD_TRANSFORM_RELATIVE: 00249 { 00250 relativeMatrix(prevMatrix, tempMatrix); 00251 const MATRIX * curr = node->GetLocalTransMatrix(); 00252 const MATRIX * w = node->GetWorldTransMatrix(); 00253 tempMatrix._m41 *= scale; 00254 tempMatrix._m42 *= scale; 00255 tempMatrix._m43 *= scale; 00256 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00257 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00258 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00259 module->PostToKernel(evt); 00260 module->PostToKernel(ev); 00261 break; 00262 } 00263 case WORLD_TRANSFORM_ROTATION: 00264 { 00265 relativeMatrix(prevMatrix, tempMatrix); 00266 tempMatrix = tempMatrix.ExtractRotation(); 00267 const MATRIX * curr = node->GetLocalTransMatrix(); 00268 const MATRIX * w = node->GetWorldTransMatrix(); 00269 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00270 wxCommandEvent evt = VRUT::Event::GET_EVT_SCENE_NODE_TRANSFORM(this->idScene, this->idSceneNode, transform); 00271 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00272 module->PostToKernel(evt); 00273 module->PostToKernel(ev); 00274 break; 00275 } 00276 case WORLD_TRANSFORM_TRANSLATION: 00277 { 00278 relativeMatrix(prevMatrix, tempMatrix); 00279 tempMatrix._m11 = tempMatrix._m22 = tempMatrix._m33 = tempMatrix._m44 = 1; 00280 tempMatrix._m12 = tempMatrix._m13 = tempMatrix._m14 = tempMatrix._m21 = tempMatrix._m23 = tempMatrix._m24 = tempMatrix._m31 = tempMatrix._m32 = tempMatrix._m34 = 0; 00281 tempMatrix._m41 *= scale; 00282 tempMatrix._m42 *= scale; 00283 tempMatrix._m43 *= scale; 00284 const MATRIX * curr = node->GetLocalTransMatrix(); 00285 const MATRIX * w = node->GetWorldTransMatrix(); 00286 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00287 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00288 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00289 module->PostToKernel(evt); 00290 module->PostToKernel(ev); 00291 break; 00292 } 00293 case WORLD_TRANSFORM_USE_RELATIVE: 00294 { 00295 tempMatrix._m41 *= scale; 00296 tempMatrix._m42 *= scale; 00297 tempMatrix._m43 *= scale; 00298 const MATRIX * curr = node->GetLocalTransMatrix(); 00299 const MATRIX * w = node->GetWorldTransMatrix(); 00300 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00301 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00302 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00303 module->PostToKernel(evt); 00304 module->PostToKernel(ev); 00305 break; 00306 } 00307 case WORLD_TRANSFORM_USE_ROTATION: 00308 { 00309 tempMatrix = tempMatrix.ExtractRotation(); 00310 const MATRIX * curr = node->GetLocalTransMatrix(); 00311 const MATRIX * w = node->GetWorldTransMatrix(); 00312 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00313 wxCommandEvent evt = VRUT::Event::GET_EVT_SCENE_NODE_TRANSFORM(this->idScene, this->idSceneNode, transform); 00314 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00315 module->PostToKernel(evt); 00316 module->PostToKernel(ev); 00317 break; 00318 } 00319 case WORLD_TRANSFORM_USE_TRANSLATION: 00320 { 00321 tempMatrix._m11 = tempMatrix._m22 = tempMatrix._m33 = tempMatrix._m44 = 1; 00322 tempMatrix._m12 = tempMatrix._m13 = tempMatrix._m14 = tempMatrix._m21 = tempMatrix._m23 = tempMatrix._m24 = tempMatrix._m31 = tempMatrix._m32 = tempMatrix._m34 = 0; 00323 tempMatrix._m41 *= scale; 00324 tempMatrix._m42 *= scale; 00325 tempMatrix._m43 *= scale; 00326 const MATRIX * curr = node->GetLocalTransMatrix(); 00327 const MATRIX * w = node->GetWorldTransMatrix(); 00328 MATRIX transform = this->transformMatrixRegardWorld(&tempMatrix,curr, w); 00329 wxCommandEvent evt = Event::GET_EVT_SCENE_NODE_TRANSFORM(idScene,idSceneNode,transform); 00330 wxCommandEvent ev = Event::GET_EVT_RENDER_UPDATE(idScene); 00331 module->PostToKernel(evt); 00332 module->PostToKernel(ev); 00333 break; 00334 } 00335 default: 00336 { 00337 LOGWARNING(wxString::Format(wxT("<TrackingManipulator> Bad TransformMode used: %i"), mode)); 00338 // LOG(wxT("DEFAULT")); 00339 } 00340 break; 00341 } 00342 } 00343 prevMatrix = bodyMatrix; 00344 changed = true; 00345 return; 00346 }
| int TTableEntry::GetBodyID | ( | ) |
returns tracked device number identificator
Definition at line 106 of file ttable.cpp.
00107 { 00108 return idBody; 00109 }
| Body::BodyType TTableEntry::GetBodyType | ( | ) |
Returns tracked device type.
Definition at line 110 of file ttable.cpp.
00111 { 00112 return bodyType; 00113 }
| MATRIX TTableEntry::PrevMatrix | ( | ) |
| wxString TTableEntry::GetAsString | ( | ) |
Returns Entry as string with elements separated by separator.
| separator | character (or possible string) that will separate elements of the entry |
Definition at line 347 of file ttable.cpp.
00348 { 00349 wxString dump = wxT(""); 00350 dump << idScene << wxT(" ") << idSceneNode << wxT(" ") << idBody << wxT(" ") << bodyType 00351 << wxT(" ") << mode << wxT(" ") << transformCondition.PressedMask()<< wxT(" ") 00352 << transformCondition.ReleasedMask() << wxT(" ") << transformCondition.Control1() 00353 << wxT(" ") << transformCondition.Control2() << wxT(" ") << scale; 00354 return dump; 00355 }
Creates relative transformation matrix and save it to curr matrix.
| prev | Previous matrix | |
| curr | Current matrix. This matrix will be overwritten by relative matrix. (it means this parameter is also return type) As previous matrix use preferably prevMatrix |
Definition at line 118 of file ttable.cpp.
00119 { 00120 float cy2 = cosf(asinf(curr._m13)); 00121 float cy1 = cosf(asinf(prev._m13)); // cosinus of Ry angle 00122 float sinX = ((curr._m23 / (-1 * cy2)) * (prev._m33 / cy1)) - ((curr._m33 / cy2) * (prev._m23 / (-1 * cy1))); 00123 float cosX = (curr._m33 / cy2)*(prev._m33 / cy1) + (curr._m23 / (-1 * cy2)) * (prev._m23 / (-1 * cy1)); 00124 float sinY = (curr._m13 * cy1) - (cy2 * prev._m13); 00125 float cosY = (cy2 * cy1) + (curr._m13 * prev._m13); 00126 float sinZ = ((curr._m12 / (-1 * cy2)) * (prev._m11 / cy1)) - ((curr._m11 / cy2) * (prev._m12 / (-1 * cy1))); 00127 float cosZ = ((curr._m11 / cy2) * (prev._m11 / cy1)) + ((curr._m12 / (-1 * cy2)) * (prev._m12 / (-1 * cy1))); 00128 // rebuild rotation matrix 00129 //row1 00130 curr._m11 = cosZ * cosY; 00131 curr._m12 = (-1 * sinZ) * cosY; 00132 curr._m13 = sinY; 00133 //row2 00134 curr._m21 = (sinZ * cosX) + (cosZ * sinY * sinX); 00135 curr._m22 = (cosZ * cosX) - (sinZ * sinY * sinX); 00136 curr._m23 = (-1 * cosY) * sinX; 00137 //row3 00138 curr._m31 = (sinZ * sinX) - (cosZ * sinY * cosX); 00139 curr._m32 = (cosZ * sinX) + (sinZ * sinY * cosX); 00140 curr._m33 = cosY * cosX; 00141 // translation 00142 curr._m41 -= prev._m41; curr._m42 -= prev._m42; curr._m43 -= prev._m43; 00143 }
| MATRIX TTableEntry::transformMatrix | ( | const MATRIX * | relative, | |
| const MATRIX * | nodeCurrentMatrix | |||
| ) | [private] |
returns transform matrix that rotates node around original (not current) local matrix of the node
| relatice | - a relative matrix (means relative movement of the device | |
| nodeCurrentMatrix | - local matrix of the node of the secene |
Definition at line 587 of file ttable.cpp.
00588 { 00589 MATRIX cur_trans = MATRIX::Translation(current->ExtractTranslation()); // translation matrix of current 00590 MATRIX curr_rot = current->ExtractRotation(); 00591 MATRIX cur_inv = cur_trans.Inverse(); // inverse matrix; 00592 MATRIX rel_trans = MATRIX::Translation(relative->ExtractTranslation()); 00593 MATRIX rel_rot = relative->ExtractRotation(); 00594 MATRIX ret = (cur_inv * rel_rot) *(cur_trans * rel_trans); 00595 return ret; 00596 }
| MATRIX TTableEntry::transformMatrixRegardWorld | ( | const MATRIX * | relative, | |
| const MATRIX * | nodeLocalMatrix, | |||
| const MATRIX * | nodeWorldMatrix | |||
| ) | [private] |
returns transform matrix that rotates node around original (not current) local matrix of the node
this method works nearly the same way as transformMatrix() method, but rotation axes of relative are related to world axes
| relatice | - a relative matrix (means relative movement of the device | |
| nodeCurrentMatrix | - local matrix of the node of the secene | |
| nodeWorldMatrix | - transformation matrix of the node in world axes. |
Definition at line 597 of file ttable.cpp.
00598 { 00599 /* 00600 MATRIX rot = nodeWorldMatrix->ExtractRotation(); 00601 MATRIX rot_back = nodeLocalMatrix->ExtractRotation(); 00602 relativeMatrix(rot_back, rot); 00603 relativeMatrix(nodeWorldMatrix->ExtractRotation(), rot_back); 00604 00605 MATRIX cur_trans = MATRIX::Translation(nodeLocalMatrix->ExtractTranslation()); // translation matrix of current 00606 MATRIX cur_inv = cur_trans.Inverse(); // inverse matrix; 00607 MATRIX rel_trans = MATRIX::Translation(relative->ExtractTranslation()); 00608 MATRIX rel_rot = relative->ExtractRotation(); 00609 //MATRIX ret = (cur_inv * rel_rot) *(cur_trans * rel_trans); 00610 MATRIX transform = (((cur_inv * rot_back) * (*relative)) * rot) * cur_trans; 00611 return transform; 00612 */ 00613 MATRIX wrld_rot = nodeWorldMatrix->ExtractRotation(); 00614 MATRIX wrld_inv = wrld_rot; 00615 wrld_inv.InvertThisPrecise(); 00616 MATRIX cur_trans = MATRIX::Translation(nodeLocalMatrix->ExtractTranslation()); // translation matrix of current 00617 MATRIX cur_inv = cur_trans.Inverse(); // inverse matrix; 00618 MATRIX rel_trans = MATRIX::Translation(relative->ExtractTranslation()); 00619 MATRIX rel_rot = relative->ExtractRotation(); 00620 //MATRIX ret = (cur_inv * rel_rot) *(cur_trans * rel_trans); 00621 MATRIX transform = ((((cur_inv * wrld_rot) * rel_rot) * rel_trans) * wrld_inv) * cur_trans; 00622 return transform; 00623 00624 }
int TTableEntry::idBody [private] |
Body::BodyType TTableEntry::bodyType [private] |
int TTableEntry::idScene [private] |
int TTableEntry::idSceneNode [private] |
TransformMode TTableEntry::mode [private] |
MATRIX TTableEntry::prevMatrix [private] |
Condition TTableEntry::transformCondition [private] |
float TTableEntry::scale [private] |
bool TTableEntry::changed [private] |
1.5.5