irrlichtDebugHelper.cpp

00001 
00002 
00003 #include "main.h"
00004 #include "irrlichtDebugHelper.h"
00005 
00006 /* the irrlicht space looks like this:
00007 
00008         y
00009         ^  z
00010         | /
00011         |/
00012         *---->x
00013 
00014 */
00015 
00016 // set by function irrlichtDebugHelperAddArrows( pos )
00017 static vector3df irrlichtDebugHelperArrowPosition;
00018 
00019 
00020 void irrlichtDebugHelperAddArrowX()
00021 {
00022         vector3df xPosition = irrlichtDebugHelperArrowPosition;
00023 
00024         IAnimatedMesh* xArrowMesh;
00025         xArrowMesh = smgr->addArrowMesh("xArryow",      // name
00026                                                                         50,                     // tesselationCylinder
00027                                                                         50,                     // tesselationCone
00028                                                                         100,            // height
00029                                                                         70,                     // cylinderHeight
00030                                                                         3.0f,           // width0
00031                                                                         10.0f,          // width1
00032                                                                         SColor(255, 255, 0, 0),         //  vtxColor0 (red)
00033                                                                         SColor(255, 255, 0, 0) );       //  vtxColor1 (red) 
00034         ISceneNode* xArrowNode;
00035         xArrowNode = smgr->addAnimatedMeshSceneNode( xArrowMesh );
00036         xArrowNode->setMaterialFlag( EMF_LIGHTING, false );     // no dynamic lighting
00037         
00038         xArrowNode->setPosition( xPosition );
00039         // set rotation: -90 degrees around z-axis to indicate the X-AXIS
00040         xArrowNode->setRotation( vector3df(0.0f, 0.0f, -90.0f) );
00041         // add text to the xArrow
00042         xPosition.X += 120.0f;
00043         xPosition.Y += 10.0f;
00044         smgr->addTextSceneNode( guienv->getBuiltInFont(),
00045                                                         L"irr X", 
00046                                                         SColor(255,0,0,0), 
00047                                                         NULL, 
00048                                                         xPosition );
00049 }
00050 
00051 
00052 void irrlichtDebugHelperAddArrowY()
00053 {
00054         vector3df yPosition = irrlichtDebugHelperArrowPosition;
00055 
00056         IAnimatedMesh* yArrowMesh;
00057         yArrowMesh = smgr->addArrowMesh("yArryow",      // name
00058                                                                         50,                     // tesselationCylinder
00059                                                                         50,                     // tesselationCone
00060                                                                         100,            // height
00061                                                                         70,                     // cylinderHeight
00062                                                                         3.0f,           // width0
00063                                                                         10.0f,          // width1
00064                                                                         SColor(255, 0, 255, 0),         //  vtxColor0 (green)
00065                                                                         SColor(255, 0, 255, 0) );       //  vtxColor1 (green) 
00066         ISceneNode* yArrowNode;
00067         yArrowNode = smgr->addAnimatedMeshSceneNode( yArrowMesh );
00068         yArrowNode->setMaterialFlag( EMF_LIGHTING, false );     // no dynamic lighting
00069         
00070         yArrowNode->setPosition( yPosition );
00071         // set rotation: 0 degrees around nothing to indicate the Y-AXIS
00072         yArrowNode->setRotation( vector3df(0.0f, 0.0f, 0.0f) );
00073         // add text to the yArrow
00074         yPosition.Y += 120.0f;
00075         smgr->addTextSceneNode( guienv->getBuiltInFont(),
00076                                                         L"irr Y", 
00077                                                         SColor(255,0,0,0), 
00078                                                         NULL, 
00079                                                         yPosition );
00080 }
00081 
00082 
00083 void irrlichtDebugHelperAddArrowZ()
00084 {
00085         vector3df zPosition = irrlichtDebugHelperArrowPosition;
00086 
00087         IAnimatedMesh* zArrowMesh;
00088         zArrowMesh = smgr->addArrowMesh("zArryow",      // name
00089                                                                         50,                     // tesselationCylinder
00090                                                                         50,                     // tesselationCone
00091                                                                         100,            // height
00092                                                                         70,                     // cylinderHeight
00093                                                                         3.0f,           // width0
00094                                                                         10.0f,          // width1
00095                                                                         SColor(255, 0, 0, 255),         //  vtxColor0 (blue)
00096                                                                         SColor(255, 0, 0, 255) );       //  vtxColor1 (blue) 
00097         ISceneNode* zArrowNode;
00098         zArrowNode = smgr->addAnimatedMeshSceneNode( zArrowMesh );
00099         zArrowNode->setMaterialFlag( EMF_LIGHTING, false );     // no dynamic lighting
00100         
00101         zArrowNode->setPosition( zPosition );
00102         // set rotation: 90 degrees around x-axis to indicate the Z-AXIS
00103         zArrowNode->setRotation( vector3df(90.0f, 0.0f, 0.0f) );
00104         // add text to the zArrow
00105         zPosition.Z += 120.0f;
00106         smgr->addTextSceneNode( guienv->getBuiltInFont(),
00107                                                         L"irr Z", 
00108                                                         SColor(255,0,0,0), 
00109                                                         NULL, 
00110                                                         zPosition );
00111 }
00112 
00113 
00114 void irrlichtDebugHelperAddArrows( vector3df position )
00115 {
00116         irrlichtDebugHelperArrowPosition = position;
00117 
00118         irrlichtDebugHelperAddArrowX();
00119         irrlichtDebugHelperAddArrowY();
00120         irrlichtDebugHelperAddArrowZ();
00121 }

Generated on Sun Dec 2 03:10:23 2007 for TableTop by  doxygen 1.5.4