Files
itgmania212121/stepmania/src/ModelTypes.h
T

184 lines
4.2 KiB
C++
Raw Normal View History

2004-06-08 00:47:53 +00:00
/* ModelTypes - Types defined in msLib.h. C arrays converted to use std::vector */
2003-05-11 14:47:29 +00:00
2004-06-08 00:47:53 +00:00
#ifndef MODEL_TYPES_H
#define MODEL_TYPES_H
2003-05-11 14:47:29 +00:00
#include "RageTypes.h"
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct msTriangle
2003-05-11 14:47:29 +00:00
{
2004-08-19 00:42:31 +00:00
uint16_t nVertexIndices[3];
};
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct msMesh
2003-05-11 14:47:29 +00:00
{
msMesh();
~msMesh();
2005-10-21 05:23:50 +00:00
CString sName;
char nMaterialIndex;
vector<RageModelVertex> Vertices;
2003-05-11 14:47:29 +00:00
// OPTIMIZATION: If all verts in a mesh are transformed by the same bone,
// then send the transform to the graphics card for the whole mesh instead
// of transforming each vertex on the CPU;
char nBoneIndex; // -1 = no bone
vector<msTriangle> Triangles;
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
class RageTexture;
2004-01-28 08:53:40 +00:00
// merge this into Sprite?
class AnimatedTexture
2003-05-11 14:47:29 +00:00
{
public:
2003-05-11 14:47:29 +00:00
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();
int GetNumStates() const;
void SetState( int iNewState );
float GetAnimationLengthSeconds() const;
void SetSecondsIntoAnimation( float fSeconds );
float GetSecondsIntoAnimation() const;
RageVector2 GetTextureTranslate();
2003-05-11 14:47:29 +00:00
bool m_bSphereMapped;
BlendMode m_BlendMode;
bool NeedsNormals() const { return m_bSphereMapped; }
private:
RageVector2 m_vTexOffset;
RageVector2 m_vTexVelocity;
int m_iCurState;
float m_fSecsIntoFrame;
2003-05-11 14:47:29 +00:00
struct AnimatedTextureState
{
AnimatedTextureState(
RageTexture* pTexture_,
float fDelaySecs_,
RageVector2 vTranslate_
)
{
pTexture = pTexture_;
fDelaySecs = fDelaySecs_;
vTranslate = vTranslate_;
}
2003-05-11 14:47:29 +00:00
RageTexture* pTexture;
float fDelaySecs;
RageVector2 vTranslate;
2003-05-11 14:47:29 +00:00
};
vector<AnimatedTextureState> vFrames;
};
2004-08-19 00:42:31 +00:00
struct msMaterial
2003-05-11 14:47:29 +00:00
{
int nFlags;
2004-08-18 06:04:53 +00:00
CString sName;
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;
int nName; // not used in SM. What is this for anyway?
2004-01-28 08:53:40 +00:00
AnimatedTexture diffuse;
AnimatedTexture alpha;
bool NeedsNormals() const { return diffuse.NeedsNormals() || alpha.NeedsNormals() ; }
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct msPositionKey
2003-05-11 14:47:29 +00:00
{
float fTime;
RageVector3 Position;
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct msRotationKey
2003-05-11 14:47:29 +00:00
{
float fTime;
RageVector3 Rotation;
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct msBone
2003-05-11 14:47:29 +00:00
{
2005-10-21 05:23:50 +00:00
int nFlags;
CString sName;
CString sParentName;
RageVector3 Position;
RageVector3 Rotation;
2003-05-11 14:47:29 +00:00
2005-10-21 05:23:50 +00:00
vector<msPositionKey> PositionKeys;
2003-05-11 14:47:29 +00:00
2005-10-21 05:23:50 +00:00
int nNumRotationKeys;
int nNumAllocedRotationKeys;
vector<msRotationKey> RotationKeys;
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
struct msAnimation
{
2003-05-11 14:47:29 +00:00
vector<msBone> Bones;
2005-10-21 05:23:50 +00:00
int FindBoneByName( const CString &sName ) const
2003-05-11 14:47:29 +00:00
{
for( unsigned i=0; i<Bones.size(); i++ )
2005-10-21 05:23:50 +00:00
if( Bones[i].sName == sName )
2003-05-11 14:47:29 +00:00
return i;
return -1;
}
bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath );
2005-10-21 05:23:50 +00:00
int nTotalFrames;
2003-05-11 14:47:29 +00:00
2005-10-21 05:23:50 +00:00
RageVector3 Position;
RageVector3 Rotation;
};
2003-05-11 14:47:29 +00:00
2004-08-19 00:42:31 +00:00
struct myBone_t
{
RageMatrix mRelative;
RageMatrix mAbsolute;
RageMatrix mRelativeFinal;
RageMatrix mFinal;
2004-08-19 00:42:31 +00:00
};
2003-05-11 14:47:29 +00:00
#endif
2004-06-08 00:47:53 +00:00
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/