Changeset 4278 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- May 24, 2005, 11:27:40 AM (19 years ago)
- 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 103 103 104 104 105 //! This is our 3D point class. CONFLICTING with Vector.cc106 class CVector3107 {108 public:109 float x, y, z;110 };111 112 //! This is our 2D point class. CONFLICTING with Vector.cc113 class CVector2114 {115 public:116 float x, y;117 };118 119 // CONFLICTING with model.h120 struct tFace121 {122 int vertIndex[3]; // indicies for the verts that make up this triangle123 int coordIndex[3]; // indicies for the tex coords to texture this face124 };125 126 // CONFLICTING with material.cc, there are some small differences, i will use this struct and switch over later127 struct tMaterialInfo128 {129 char strName[255]; // The texture name130 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 ID133 float uTile; // u tiling of texture134 float vTile; // v tiling of texture135 float uOffset; // u offset of texture136 float vOffset; // v offset of texture137 } ;138 139 //! properties of a 3D object140 struct t3DObject141 {142 int numOfVerts; // The number of verts in the model143 int numOfFaces; // The number of faces in the model144 int numTexVertex; // The number of texture coordinates145 int materialID; // The texture ID to use, which is the index into our texture array146 bool bHasTexture; // This is TRUE if there is a texture map for this object147 char strName[255]; // The name of the object148 CVector3 *pVerts; // The object's vertices149 CVector3 *pNormals; // The object's normals150 CVector2 *pTexVerts; // The texture's UV coordinates151 tFace *pFaces; // The faces information of the object152 };153 154 // CONFLICTING with animation.cc155 struct tAnimationInfo156 {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 animation159 int endFrame; // This stores the last frame number for this animation160 };161 162 // CONFLICTING with animation.cc and vector.cc163 struct t3DModel164 {165 int numOfObjects; // The number of objects in the model166 int numOfMaterials; // The number of materials for the model167 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 model173 };174 175 176 177 105 //! This class defines the basic components of a model 178 106 class AbstractModel : public BaseObject { … … 184 112 185 113 186 /* TESTING TESTING TESTING */187 /* some mathematical functions that are already implemented by vector.cc class */188 189 // magnitude of a normal190 #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 points196 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 result208 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 result220 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 vectors232 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 vector242 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 };253 114 254 115 -
orxonox/trunk/src/lib/graphics/importer/md2Model.h
r4277 r4278 66 66 67 67 68 //! This is used to store the vertices that are read in for the current frame directly from the file (compressed)69 struct tMd2AliasTriangle70 {71 byte vertex[3];72 byte lightNormalIndex;73 };74 75 //! This stores the normals and vertices for the frames (uncompressed)76 struct tMd2Triangle77 {78 float vertex[3];79 float normal[3];80 };81 82 //! This stores the indices into the vertex and texture coordinate arrays83 struct tMd2Face84 {85 short vertexIndices[3];86 short textureIndices[3];87 };88 89 //! This stores UV coordinates90 struct tMd2TexCoord91 {92 short u, v;93 };94 95 //! This stores the animation scale, translation and name information for a frame, plus verts96 struct tMd2AliasFrame97 {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 transformed105 struct tMd2Frame106 {107 char strName[16];108 tMd2Triangle *pVertices;109 };110 111 //! This stores a skin name112 typedef char tMd2Skin[64];113 68 114 69 typedef enum
Note: See TracChangeset
for help on using the changeset viewer.