Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

BL_BlenderOrientation.cpp

Go to the documentation of this file.
00001 extern "C" void Mat3ToEul(float tmat[][3], float *eul);
00002 extern "C" void get_local_bounds(struct Object* blenderobj, float* bcenter, float* bsize);
00003 extern "C" void where_is_object_simul(struct Object* m_blenderobject);
00004 
00005 #include "BL_BlenderOrientation.h"
00006 
00007 #include "blender.h"
00008 #include "game.h"       // for definition of OB_DYNAMIC
00009 #include "sector.h"
00010 
00011 void            BL_WhereIsObjectSimul(struct Object* blenderobj)

00012 {
00013         where_is_object_simul(blenderobj);
00014 }
00015 
00016 void BL_SetBlenderPosition(struct Object* blenderobj,const MT_Vector3& pos)

00017 {
00018         blenderobj->loc[0] = pos[0];
00019         blenderobj->loc[1] = pos[1];
00020         blenderobj->loc[2] = pos[2];
00021 };
00022 
00023 void BL_SetBlenderRotation(struct Object* blenderobj,const MT_Vector3& euler_rot)

00024 {
00025         blenderobj->rot[0] = euler_rot[0];
00026         blenderobj->rot[1] = euler_rot[1];
00027         blenderobj->rot[2] = euler_rot[2];
00028 
00029 }
00030 
00031 float*  BL_GetTransformationMatrix(struct Object* blenderobj)

00032 {
00033         return (float*)blenderobj->obmat;
00034 }
00035 
00036 
00037 MT_Point3 BL_GetBlenderPosition(struct Object* blenderobj)

00038 {
00039         return MT_Point3(
00040                         blenderobj->loc[0]+blenderobj->dloc[0],
00041                         blenderobj->loc[1]+blenderobj->dloc[1],
00042                         blenderobj->loc[2]+blenderobj->dloc[2]
00043                         );
00044 }
00045 
00046 
00047 MT_Vector3 BL_GetBlenderRotation(struct Object* blenderobj)

00048 {
00049         return MT_Vector3(
00050                 blenderobj->rot[0],
00051                 blenderobj->rot[1],
00052                 blenderobj->rot[2]
00053                 );
00054 
00055 }
00056 
00057         
00058 MT_Vector3 BL_GetBlenderScaling(struct Object* blenderobj)

00059 {
00060 
00061         return MT_Vector3(blenderobj->size[0],blenderobj->size[1],blenderobj->size[2]);
00062 }
00063 
00064 void BL_GetLocalBounds(struct Object* blenderobj,MT_Point3& center,MT_Vector3& size)

00065 {
00066         float bcenter[3],bsize[3];
00067         get_local_bounds(blenderobj, bcenter, bsize);
00068 
00069         size = MT_Vector3(bsize);
00070         center = MT_Point3 (bcenter);
00071 
00072 }
00073 
00074 
00075 
00076 void BL_Mat3ToEul (float tmat[][3],float* eul)

00077 {
00078         Mat3ToEul(tmat,eul);
00079 }
00080 
00081 
00082 
00083 bool    BL_HasParent(struct Object* blenderobject)

00084 {
00085         return (blenderobject->parent != 0);
00086 }
00087 
00088 float*  BL_GetParentInverse(struct Object* blenderobj)

00089 {
00090         return (float*) blenderobj->parentinv;
00091 }
00092 bool BL_IsDynamicObject(struct Object* blenderobj)

00093 {
00094         return (blenderobj->gameflag & OB_DYNAMIC);
00095 }
00096 
00097 bool BL_IsActor(struct Object* blenderobj)

00098 {
00099         return (blenderobj->gameflag & OB_ACTOR);
00100 }
00101 
00102 struct Object* BL_GetParent(struct Object* blenderobj)
00103 {
00104         struct Object* par= blenderobj->parent;
00105         return par;
00106 }
00107 
00108 
00109 struct Object* BL_GetRootParent(struct Object* blenderobj)
00110 {
00111         struct Object* par= blenderobj->parent;
00112         while(par && par->parent) {
00113                 par= par->parent;
00114         }
00115 
00116         //if(par) {
00117         //      if( (par->gameflag & OB_DYNAMIC) || has_robbie(par) ) {
00118         //              blenderobj->gameflag &= ~OB_LIFE;
00119         //              blenderobj->gameflag |= OB_CHILD|OB_ACTOR;
00120         //      }
00121         //}
00122 
00123         return par;
00124 }
00125 
00126 
00127 double          BL_GetDynamicObjectSize(struct Object* blenderobj)

00128 {
00129         double result = 0.0;
00130         if (blenderobj)
00131         {
00132                 if (blenderobj->life)
00133                 {
00134                         result = blenderobj->life->axsize;
00135                 }
00136         }
00137         return result;
00138 }
00139 
00140 //MT_Vector3 rayvec BL_GetFhRay(struct Object* blenderobj)
00141 //{
00142 //      //#define OB_ROT_FH                     128
00143 //      
00144 //
00145 //}
00146 
00147 bool            BL_HasFH(struct Object* blenderobj)

00148 {
00149         return (  (blenderobj->gameflag & OB_DO_FH) != 0);
00150 }

Generated at Thu Feb 1 13:03:01 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000