Files
itgmania212121/stepmania/src/ModelTypes.h
T

190 lines
4.2 KiB
C++
Raw Normal View History

2003-05-11 14:47:29 +00:00
#ifndef ModelTypes_H
#define ModelTypes_H
/*
-----------------------------------------------------------------------------
Class: ModelTypes
Desc: Types defined in msLib.h. C arrays converted to use std::vector
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
/**********************************************************************
*
* Constants
*
**********************************************************************/
#define MS_MAX_NAME 32
#define MS_MAX_PATH 256
/**********************************************************************
*
* Types
*
**********************************************************************/
#ifndef byte
typedef unsigned char byte;
#endif /* byte */
#ifndef word
typedef unsigned short word;
#endif /* word */
#include "RageTypes.h"
2003-05-11 14:47:29 +00:00
/* msFlag */
typedef enum {
eSelected = 1, eSelected2 = 2, eHidden = 4, eDirty = 8, eAveraged = 16, eUnused = 32
} msFlag;
/* msVertex */
typedef struct msVertex
{
// byte nFlags; // we don't care about saving this flag
RageVector3 Vertex;
RageVector2 uv;
RageVector3 Normal;
2003-05-11 14:47:29 +00:00
char nBoneIndex;
} msVertex;
/* msTriangle */
typedef struct
{
// word nFlags; // we don't care about saving this flag
2003-05-11 14:47:29 +00:00
word nVertexIndices[3];
// word nNormalIndices[3]; // we don't care about this. Use the normals in each vertex
// msVec3 Normal; // we don't care about per-triangle normals. Each vertex has its own
// byte nSmoothingGroup; // we don't care about this, so don't save it
2003-05-11 14:47:29 +00:00
} msTriangle;
/* msMesh */
typedef struct msMesh
{
// byte nFlags; // we don't care about saving this flag
2003-05-11 14:47:29 +00:00
char szName[MS_MAX_NAME];
char nMaterialIndex;
vector<msVertex> Vertices;
// vector<msVec3> Normals; // each vertex holds its own normal
2003-05-11 14:47:29 +00:00
vector<msTriangle> Triangles;
} msMesh;
/* msMaterial */
class RageTexture;
struct AnimatedTexture
{
AnimatedTexture();
2003-06-21 22:24:48 +00:00
~AnimatedTexture();
2003-05-11 14:47:29 +00:00
void Load( CString sTexOrIniFile );
2003-06-21 22:24:48 +00:00
void Unload();
2003-05-11 14:47:29 +00:00
void Update( float fDelta );
RageTexture* GetCurrentTexture();
void SetState( int iState );
int GetNumStates();
int iCurState;
float fSecsIntoFrame;
struct AnimatedTextureState
{
RageTexture* pTexture;
float fDelaySecs;
};
vector<AnimatedTextureState> vFrames;
};
typedef struct msMaterial
{
int nFlags;
char szName[MS_MAX_NAME];
2003-12-24 21:07:50 +00:00
RageColor Ambient;
RageColor Diffuse;
RageColor Specular;
RageColor Emissive;
2003-05-11 14:47:29 +00:00
float fShininess;
float fTransparency;
char szDiffuseTexture[MS_MAX_PATH];
char szAlphaTexture[MS_MAX_PATH]; // not used in SM. Use alpha in diffuse texture instead
int nName; // not used in SM. What is this for anyway?
AnimatedTexture aniTexture;
} msMaterial;
/* msPositionKey */
typedef struct msPositionKey
{
float fTime;
RageVector3 Position;
2003-05-11 14:47:29 +00:00
} msPositionKey;
/* msRotationKey */
typedef struct msRotationKey
{
float fTime;
RageVector3 Rotation;
2003-05-11 14:47:29 +00:00
} msRotationKey;
/* msBone */
typedef struct msBone
{
int nFlags;
char szName[MS_MAX_NAME];
char szParentName[MS_MAX_NAME];
RageVector3 Position;
RageVector3 Rotation;
2003-05-11 14:47:29 +00:00
vector<msPositionKey> PositionKeys;
int nNumRotationKeys;
int nNumAllocedRotationKeys;
vector<msRotationKey> RotationKeys;
} msBone;
/* msModel */
typedef struct msModel
{
vector<msMesh> Meshes;
vector<msMaterial> Materials;
} msModel;
2003-05-11 14:47:29 +00:00
struct msAnimation
{
2003-05-11 14:47:29 +00:00
vector<msBone> Bones;
int FindBoneByName( const char* szName )
{
for( unsigned i=0; i<Bones.size(); i++ )
if( strcmp(Bones[i].szName, szName)==0 )
return i;
return -1;
}
// int nFrame; // not used in SM. We keep track of this outside this structure.
2003-05-11 14:47:29 +00:00
int nTotalFrames;
RageVector3 Position;
RageVector3 Rotation;
};
2003-05-11 14:47:29 +00:00
typedef struct
{
RageMatrix mRelative;
RageMatrix mAbsolute;
RageMatrix mRelativeFinal;
RageMatrix mFinal;
} myBone_t;
2003-05-11 14:47:29 +00:00
#endif