Files
itgmania212121/stepmania/src/RageTexture.h
T

104 lines
3.3 KiB
C++
Raw Normal View History

2002-11-16 07:36:02 +00:00
#ifndef RAGE_TEXTURE_H
#define RAGE_TEXTURE_H
/*
-----------------------------------------------------------------------------
2002-04-28 20:42:32 +00:00
Class: RageTexture
Desc: Abstract class for a texture and metadata.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-04-28 20:42:32 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#include "RageTypes.h"
2001-11-03 10:52:42 +00:00
const int MAX_TEXTURE_FRAMES = 256;
2001-11-03 10:52:42 +00:00
struct RageTexturePrefs
{
bool bForceReload;
int iMaxSize;
int iMipMaps;
int iAlphaBits;
bool bDither;
bool bStretch;
RageTexturePrefs()
{
bForceReload = false;
iMaxSize = 2048;
iMipMaps = 4;
iAlphaBits = 4;
bDither = false;
bStretch = false;
}
};
2001-11-03 10:52:42 +00:00
//-----------------------------------------------------------------------------
// RageTexture Class Declarations
//-----------------------------------------------------------------------------
class RageTexture
{
public:
RageTexture( CString sFilePath, RageTexturePrefs prefs );
2002-04-28 20:42:32 +00:00
virtual ~RageTexture() = 0;
virtual void Update( float fDeltaTime ) {}
virtual void Reload( RageTexturePrefs prefs ) = 0;
virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
2002-04-28 20:42:32 +00:00
// movie texture/animated texture stuff
2002-08-31 07:08:25 +00:00
virtual void Play() {}
virtual void Stop() {}
virtual void Pause() {}
virtual void SetPosition( float fSeconds ) {}
virtual bool IsAMovie() const { return false; }
virtual bool IsPlaying() const { return false; }
void SetLooping(bool looping) { }
2001-11-03 10:52:42 +00:00
2002-08-31 07:08:25 +00:00
int GetSourceWidth() const {return m_iSourceWidth;}
int GetSourceHeight() const {return m_iSourceHeight;}
int GetTextureWidth() const {return m_iTextureWidth;}
int GetTextureHeight() const{return m_iTextureHeight;}
int GetImageWidth() const {return m_iImageWidth;}
int GetImageHeight() const {return m_iImageHeight;}
2001-11-03 10:52:42 +00:00
2002-08-31 07:08:25 +00:00
int GetFramesWide() const {return m_iFramesWide;}
int GetFramesHigh() const {return m_iFramesHigh;}
2002-08-31 07:08:25 +00:00
int GetSourceFrameWidth() const {return GetSourceWidth() / GetFramesWide();}
int GetSourceFrameHeight() const {return GetSourceHeight() / GetFramesHigh();}
int GetTextureFrameWidth() const {return GetTextureWidth() / GetFramesWide();}
int GetTextureFrameHeight() const {return GetTextureHeight() / GetFramesHigh();}
int GetImageFrameWidth() const {return GetImageWidth() / GetFramesWide();}
int GetImageFrameHeight() const {return GetImageHeight() / GetFramesHigh();}
const RectF *GetTextureCoordRect( int frameNo ) const;
int GetNumFrames() const {return m_iFramesWide*m_iFramesHigh;}
2002-08-31 07:08:25 +00:00
CString GetFilePath() const {return m_sFilePath;}
2001-11-03 10:52:42 +00:00
int m_iRefCount;
int m_iTimeOfLastUnload;
2001-11-03 10:52:42 +00:00
protected:
2001-11-25 04:31:44 +00:00
virtual void CreateFrameRects();
virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const;
2001-11-03 10:52:42 +00:00
CString m_sFilePath;
RageTexturePrefs m_prefs;
2001-11-03 10:52:42 +00:00
int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk
int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture
int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture
CArray<RectF,RectF> m_TextureCoordRects; // size = m_iFramesWide * m_iFramesHigh
2001-11-03 10:52:42 +00:00
};
2002-05-27 08:23:27 +00:00
2002-11-16 07:36:02 +00:00
#endif