Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4278 in orxonox.OLD for orxonox/trunk/src/lib/graphics


Ignore:
Timestamp:
May 24, 2005, 11:27:40 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: cleaned out the abstract_model file. there where many absolete structures from the ancient md2model :)

Location:
orxonox/trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/abstract_model.h

    r4245 r4278  
    103103
    104104
    105 //! This is our 3D point class.  CONFLICTING with Vector.cc
    106 class CVector3
    107 {
    108  public:
    109   float x, y, z;
    110 };
    111 
    112 //! This is our 2D point class.  CONFLICTING with Vector.cc
    113 class CVector2
    114 {
    115  public:
    116   float x, y;
    117 };
    118 
    119 // CONFLICTING with model.h
    120 struct tFace
    121 {
    122   int vertIndex[3];                     // indicies for the verts that make up this triangle
    123   int coordIndex[3];                    // indicies for the tex coords to texture this face
    124 };
    125 
    126 // CONFLICTING with material.cc, there are some small differences, i will use this struct and switch over later
    127 struct tMaterialInfo
    128 {
    129   char  strName[255];                   // The texture name
    130   char  strFile[255];                   // The texture file name (If this is set it's a texture map)
    131   byte  color[3];       // The color of the object (R, G, B)
    132   int   texureId;                               // the texture ID
    133   float uTile;                          // u tiling of texture 
    134   float vTile;                          // v tiling of texture 
    135   float uOffset;                                // u offset of texture
    136   float vOffset;                                // v offset of texture
    137 } ;
    138 
    139 //! properties of a 3D object
    140 struct t3DObject
    141 {
    142   int  numOfVerts;                      // The number of verts in the model
    143   int  numOfFaces;                      // The number of faces in the model
    144   int  numTexVertex;                    // The number of texture coordinates
    145   int  materialID;                      // The texture ID to use, which is the index into our texture array
    146   bool bHasTexture;                     // This is TRUE if there is a texture map for this object
    147   char strName[255];                    // The name of the object
    148   CVector3  *pVerts;                    // The object's vertices
    149   CVector3  *pNormals;                  // The object's normals
    150   CVector2  *pTexVerts;                 // The texture's UV coordinates
    151   tFace *pFaces;                                // The faces information of the object
    152 };
    153 
    154 // CONFLICTING with animation.cc
    155 struct tAnimationInfo
    156 {
    157   char strName[255];                    // This stores the name of the animation (Jump, Pain, etc..)
    158   int startFrame;                               // This stores the first frame number for this animation
    159   int endFrame;                         // This stores the last frame number for this animation
    160 };
    161 
    162 // CONFLICTING with animation.cc and vector.cc
    163 struct t3DModel
    164 {
    165   int numOfObjects;                                     // The number of objects in the model
    166   int numOfMaterials;                                   // The number of materials for the model
    167   int numOfAnimations;                          // The number of animations in this model (NEW)
    168   int currentAnim;                                      // The current index into pAnimations list (NEW)
    169   int currentFrame;                                     // The current frame of the current animation (NEW)
    170   vector<tAnimationInfo> animationList; // The list of animations (NEW)
    171   vector<tMaterialInfo> materialList;   // The list of material information (Textures and colors)
    172   vector<t3DObject> objectList;                 // The object list for our model
    173 };
    174 
    175 
    176 
    177105//! This class defines the basic components of a model
    178106class AbstractModel : public BaseObject {
     
    184112
    185113
    186 /* TESTING TESTING TESTING */
    187 /* some mathematical functions that are already implemented by vector.cc class */
    188 
    189 // magnitude of a normal
    190 #define Mag(Normal) (sqrt(Normal.x*Normal.x + Normal.y*Normal.y + Normal.z*Normal.z))
    191 
    192 class MathHelp {
    193 
    194  public:
    195   // vector between two points
    196   static CVector3 VectorDiff(CVector3 vPoint1, CVector3 vPoint2)
    197     {
    198       CVector3 vVector;                                                 
    199 
    200       vVector.x = vPoint1.x - vPoint2.x;                       
    201       vVector.y = vPoint1.y - vPoint2.y;                       
    202       vVector.z = vPoint1.z - vPoint2.z;                       
    203 
    204       return vVector;                                                           
    205     }
    206 
    207   // adding vectors, returning result
    208   static CVector3 AddVector(CVector3 vVector1, CVector3 vVector2)
    209     {
    210       CVector3 vResult;                                                 
    211        
    212       vResult.x = vVector2.x + vVector1.x;             
    213       vResult.y = vVector2.y + vVector1.y;             
    214       vResult.z = vVector2.z + vVector1.z;             
    215 
    216       return vResult;
    217     }
    218 
    219   // This divides a vector by a single number (scalar) and returns the result
    220   static CVector3 DivideVectorByScaler(CVector3 vVector1, float Scaler)
    221     {
    222       CVector3 vResult;                                                 
    223        
    224       vResult.x = vVector1.x / Scaler;                 
    225       vResult.y = vVector1.y / Scaler;         
    226       vResult.z = vVector1.z / Scaler;
    227 
    228       return vResult;   
    229     }
    230 
    231   // cross product between 2 vectors
    232   static CVector3 CrossProduct(CVector3 vVector1, CVector3 vVector2)
    233     {
    234       CVector3 vCross; 
    235       vCross.x = ((vVector1.y * vVector2.z) - (vVector1.z * vVector2.y));
    236       vCross.y = ((vVector1.z * vVector2.x) - (vVector1.x * vVector2.z));
    237       vCross.z = ((vVector1.x * vVector2.y) - (vVector1.y * vVector2.x));
    238       return vCross;   
    239     }
    240 
    241   // calculate the normal of a vector
    242   static CVector3 NormalizeVector(CVector3 vNormal)
    243     {
    244       double Magnitude;
    245       Magnitude = Mag(vNormal);
    246       vNormal.x /= (float)Magnitude;   
    247       vNormal.y /= (float)Magnitude;   
    248       vNormal.z /= (float)Magnitude;   
    249 
    250       return vNormal;   
    251     }
    252 };
    253114
    254115
  • orxonox/trunk/src/lib/graphics/importer/md2Model.h

    r4277 r4278  
    6666
    6767
    68 //! This is used to store the vertices that are read in for the current frame directly from the file (compressed)
    69 struct tMd2AliasTriangle
    70 {
    71    byte vertex[3];
    72    byte lightNormalIndex;
    73 };
    74 
    75 //! This stores the normals and vertices for the frames (uncompressed)
    76 struct tMd2Triangle
    77 {
    78    float vertex[3];
    79    float normal[3];
    80 };
    81 
    82 //! This stores the indices into the vertex and texture coordinate arrays
    83 struct tMd2Face
    84 {
    85    short vertexIndices[3];
    86    short textureIndices[3];
    87 };
    88 
    89 //! This stores UV coordinates
    90 struct tMd2TexCoord
    91 {
    92    short u, v;
    93 };
    94 
    95 //! This stores the animation scale, translation and name information for a frame, plus verts
    96 struct tMd2AliasFrame
    97 {
    98    float scale[3];
    99    float translate[3];
    100    char name[16];
    101    tMd2AliasTriangle aliasVertices[1];
    102 };
    103 
    104 //! This stores the frames vertices after they have been transformed
    105 struct tMd2Frame
    106 {
    107    char strName[16];
    108    tMd2Triangle *pVertices;
    109 };
    110 
    111 //! This stores a skin name
    112 typedef char tMd2Skin[64];
    11368
    11469typedef enum
Note: See TracChangeset for help on using the changeset viewer.