Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <aux_texture.h>
Public Member Functions | |
void | FileNotFound (const std::string &) |
GFXBOOL | checkold (const std::string &s, bool shared, std::string &hashname) |
Returns if this texture is actually already loaded. More... | |
void | modold (const std::string &s, bool shared, std::string &hashname) |
void | setold () |
Loads the old texture. More... | |
bool | checkbad (const string &s) |
void | setbad (const string &s) |
void | InitTexture () |
Inits the class with default values. More... | |
int | Bind (Texture *other, int maxdimension=65536, GFXBOOL detailtexture=GFXFALSE) |
Binds this texture to the same name as the given texture - for multipart textures. More... | |
Texture (int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE) | |
Creates an unbounded texture. Set data and dimensions before binding. Or explicitly load a file. More... | |
Texture (const char *, const char *, int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, float alpha=1, int zeroval=0, GFXBOOL force=GFXFALSE, int max_dimension_size=65536, GFXBOOL detail_texture=GFXFALSE, GFXBOOL nocache=false, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE, Texture *main=0) | |
Creates a texture with a single bitmap as color data and another grayscale .bmp as alpha data. More... | |
Texture (const char *FileName, int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, GFXBOOL force=GFXFALSE, int max_dimension_size=65536, GFXBOOL detail_texture=GFXFALSE, GFXBOOL nocache=false, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE, Texture *main=0) | |
Creates a texture with only color data as a single bitmap. More... | |
Texture (VSFileSystem::VSFile *f, int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, GFXBOOL force=GFXFALSE, int max_dimension_size=65536, GFXBOOL detail_texture=GFXFALSE, GFXBOOL nocache=false, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE, Texture *main=0) | |
void | Load (const char *, const char *, int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, float alpha=1, int zeroval=0, GFXBOOL force=GFXFALSE, int max_dimension_size=65536, GFXBOOL detail_texture=GFXFALSE, GFXBOOL nocache=false, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE, Texture *main=0) |
void | Load (const char *FileName, int stage=0, enum FILTER mipmap=MIPMAP, enum TEXTURE_TARGET target=TEXTURE2D, enum TEXTURE_IMAGE_TARGET imagetarget=TEXTURE_2D, GFXBOOL force=GFXFALSE, int max_dimension_size=65536, GFXBOOL detail_texture=GFXFALSE, GFXBOOL nocache=false, enum ADDRESSMODE address_mode=DEFAULT_ADDRESS_MODE, Texture *main=0) |
virtual const Texture * | Original () const |
virtual Texture * | Original () |
virtual Texture * | Clone () |
virtual | ~Texture () |
Texture copy constructor that increases appropriate refcounts. More... | |
virtual unsigned int | numFrames () const |
virtual double | curTime () const |
virtual void | setTime (double tim) |
virtual float | framesPerSecond () const |
virtual unsigned int | numLayers () const |
virtual unsigned int | numPasses () const |
virtual bool | canMultiPass () const |
virtual bool | constFrameRate () const |
int | getStage () const |
int | getFilter () const |
int | getTarget () const |
int | getImageTarget () const |
bool | operator< (const Texture &b) const |
A way to sort the texture by the original address (to make sure like textures stick togehter. More... | |
bool | operator== (const Texture &b) const |
A way to test if the texture is equal to another based on original values. More... | |
void | setReference (Texture *other) |
Make this instance a reference of "other". More... | |
virtual void | MakeActive () |
Binds the texture in the GFX library. More... | |
virtual void | MakeActive (int stage) |
virtual void | MakeActive (int stage, int pass) |
virtual bool | SetupPass (int pass, const enum BLENDFUNC src, const enum BLENDFUNC dst) |
virtual bool | SetupPass (int pass, int stage, const enum BLENDFUNC src, const enum BLENDFUNC dst) |
virtual bool | LoadSuccess () |
If the texture has loaded properly returns true. More... | |
virtual void | Prioritize (float) |
Changes priority of texture. More... | |
Static Public Member Functions | |
static Texture * | Exists (std::string s) |
Whether or not the string exists as a texture. More... | |
static Texture * | Exists (std::string s, std::string a) |
Whether or not the color and alpha data already exist. More... | |
Public Attributes | |
StringPool::Reference | texfilename |
The file name used to load this texture. More... | |
enum FILTER | ismipmapped |
the filter mode of this texture More... | |
unsigned char * | data |
The data of this texture (used in between functions, deleted) More... | |
int | name |
The GFXname of this texture. More... | |
int | stage |
The multitexture stage of this texture. More... | |
Vector | mintcoord |
The minimum/maximum texturing coordinates for this texture (have in mind that it is not always enforce, ie. for meshes) (i=s, j=t, k=u) More... | |
Vector | maxtcoord |
Texture * | original |
The original data that would represent this texture. More... | |
bool | bound |
For re-biding. More... | |
uint | boundSizeX |
uint | boundSizeY |
VSImageMode | boundMode |
int | refcount |
The number of references on the original data. More... | |
enum TEXTURE_TARGET | texture_target |
The target this will go to (cubemap or otherwise) More... | |
enum TEXTURE_IMAGE_TARGET | image_target |
enum ADDRESSMODE | address_mode |
The address mode being used with this texture. More... | |
Protected Member Functions | |
int | Bind (int maxdimension, GFXBOOL detailtexture) |
Binds this texture to GFX library. More... | |
void | UnBind () |
UnBinds from GFX library. More... | |
void | Transfer (int maxdimension, GFXBOOL detailtexture) |
Transfers this texture to GFX library. More... | |
The texture class defines a method of loading bitmap textures It also defines a hash table in which textures are kept and looked up to prevent the loading of duplicate textures
Definition at line 38 of file aux_texture.h.
Texture::Texture | ( | int | stage = 0 , |
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE |
||
) |
Creates an unbounded texture. Set data and dimensions before binding. Or explicitly load a file.
Definition at line 208 of file aux_texture.cpp.
Referenced by AnimatedTexture::LoadAni().
Texture::Texture | ( | const char * | FileNameRGB, |
const char * | FileNameA, | ||
int | stage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
float | alpha = 1 , |
||
int | zeroval = 0 , |
||
GFXBOOL | force = GFXFALSE , |
||
int | max_dimension_size = 65536 , |
||
GFXBOOL | detail_texture = GFXFALSE , |
||
GFXBOOL | nocache = false , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE , |
||
Texture * | main = 0 |
||
) |
Creates a texture with a single bitmap as color data and another grayscale .bmp as alpha data.
Definition at line 388 of file aux_texture.cpp.
Texture::Texture | ( | const char * | FileName, |
int | stage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
GFXBOOL | force = GFXFALSE , |
||
int | max_dimension_size = 65536 , |
||
GFXBOOL | detail_texture = GFXFALSE , |
||
GFXBOOL | nocache = false , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE , |
||
Texture * | main = 0 |
||
) |
Creates a texture with only color data as a single bitmap.
Definition at line 262 of file aux_texture.cpp.
Texture::Texture | ( | VSFileSystem::VSFile * | f, |
int | stage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
GFXBOOL | force = GFXFALSE , |
||
int | max_dimension_size = 65536 , |
||
GFXBOOL | detail_texture = GFXFALSE , |
||
GFXBOOL | nocache = false , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE , |
||
Texture * | main = 0 |
||
) |
|
virtual |
Texture copy constructor that increases appropriate refcounts.
Destructor for texture
DEPRECATED if(data != NULL) { delete [] data;
data = NULL; }
Definition at line 519 of file aux_texture.cpp.
Binds this texture to GFX library.
Definition at line 598 of file aux_texture.cpp.
References DXT1, DXT1RGBA, DXT3, DXT5, GFXCreateTexture(), PALETTE8, RGB24, and RGBA32.
Referenced by AnimatedTexture::LoadVideoSource().
Binds this texture to the same name as the given texture - for multipart textures.
Definition at line 640 of file aux_texture.cpp.
References bound, boundMode, boundSizeX, boundSizeY, and name.
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 218 of file aux_texture.h.
bool Texture::checkbad | ( | const string & | s) |
Definition at line 185 of file aux_texture.cpp.
References badtexHashTable, VSFileSystem::GetHashName(), and VSFileSystem::GetSharedTextureHashName().
Returns if this texture is actually already loaded.
Definition at line 86 of file aux_texture.cpp.
References VSFileSystem::GetHashName(), VSFileSystem::GetSharedTextureHashName(), GFXFALSE, GFXTRUE, and texHashTable.
|
virtual |
Reimplemented in AnimatedTexture, PipelinedTexture, and StreamTexture.
Definition at line 152 of file aux_texture.cpp.
References name, original, refcount, and BaseUtil::Texture().
Referenced by Background::Cache(), AnimatedTexture::Clone(), Flightgroup::operator=(), SpriteStarVlist::SpriteStarVlist(), and VSSprite::VSSprite().
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 223 of file aux_texture.h.
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 196 of file aux_texture.h.
|
static |
Whether or not the string exists as a texture.
Referenced by DecalQueue::AddTexture().
|
static |
Whether or not the color and alpha data already exist.
void Texture::FileNotFound | ( | const std::string & | ) |
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 203 of file aux_texture.h.
|
inline |
Definition at line 233 of file aux_texture.h.
References ismipmapped.
|
inline |
Definition at line 243 of file aux_texture.h.
References image_target.
|
inline |
|
inline |
Definition at line 238 of file aux_texture.h.
References texture_target.
void Texture::InitTexture | ( | ) |
Inits the class with default values.
Definition at line 114 of file aux_texture.cpp.
References DEFAULT_ADDRESS_MODE, f, Mesh::refcount, and Vector.
void Texture::Load | ( | const char * | FileNameRGB, |
const char * | FileNameA, | ||
int | stage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
float | alpha = 1 , |
||
int | zeroval = 0 , |
||
GFXBOOL | force = GFXFALSE , |
||
int | max_dimension_size = 65536 , |
||
GFXBOOL | detail_texture = GFXFALSE , |
||
GFXBOOL | nocache = false , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE , |
||
Texture * | main = 0 |
||
) |
Definition at line 420 of file aux_texture.cpp.
References VSFileSystem::VSFile::Close(), f, VSFileSystem::FileNotFound, g_game, VegaConfig::getVariable(), NEAREST, VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), XMLSupport::parse_bool(), VSFileSystem::Shared, VSFileSystem::TextureFile, VSFileSystem::Unspecified, game_data_t::use_textures, and vs_config.
void Texture::Load | ( | const char * | FileName, |
int | stage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | target = TEXTURE2D , |
||
enum TEXTURE_IMAGE_TARGET | imagetarget = TEXTURE_2D , |
||
GFXBOOL | force = GFXFALSE , |
||
int | max_dimension_size = 65536 , |
||
GFXBOOL | detail_texture = GFXFALSE , |
||
GFXBOOL | nocache = false , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE , |
||
Texture * | main = 0 |
||
) |
Definition at line 278 of file aux_texture.cpp.
References bootstrap_draw(), VSFileSystem::VSFile::Close(), f, VSFileSystem::FileNotFound, g_game, VegaConfig::getVariable(), NEAREST, VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), XMLSupport::parse_bool(), VSFileSystem::Shared, VSFileSystem::TextureFile, VSFileSystem::Unspecified, game_data_t::use_textures, VSFileSystem::VSFile::Valid(), and vs_config.
|
inlinevirtual |
If the texture has loaded properly returns true.
Reimplemented in AnimatedTexture.
Definition at line 287 of file aux_texture.h.
References name.
Referenced by ActivateWhite(), DecalQueue::AddTexture(), Background::Background(), VSSprite::LoadSuccess(), GuiTexture::read(), and VSSprite::VSSprite().
|
inlinevirtual |
Binds the texture in the GFX library.
Reimplemented in AnimatedTexture, PipelinedTexture, and StreamTexture.
Definition at line 264 of file aux_texture.h.
References stage.
Referenced by GameStarSystem::activateLightMap(), ActivateWhite(), SpriteStarVlist::BeginDrawState(), bootstrap_draw(), Bolt::Draw(), Background::Draw(), VSSprite::Draw(), WindowManager::draw(), ParticleTrail::DrawAndUpdate(), DrawHUDSprite(), EndGUIFrame(), AnimatedTexture::MakeActive(), MakeActive(), Halo::ProcessDrawQueue(), Logo::ProcessDrawQueue(), Beam::ProcessDrawQueue(), SetupDamageMapThirdPass(), SetupEnvmapPass(), SetupGlowMapFourthPass(), SetupSpecMapFirstPass(), SetupSpecMapSecondPass(), and TerrainMakeActive().
|
inlinevirtual |
Reimplemented in AnimatedTexture, and StreamTexture.
Definition at line 269 of file aux_texture.h.
References MakeActive().
Reimplemented in AnimatedTexture.
Definition at line 665 of file aux_texture.cpp.
References ActivateWhite(), CLAMP, CUBEMAP, DEFAULT_ADDRESS_MODE, GFXActiveTexture(), GFXSelectTexture(), GFXTextureAddressMode(), TEXTURE1D, TEXTURE2D, TEXTURE3D, TEXTURERECT, and WRAP.
void Texture::modold | ( | const std::string & | s, |
bool | shared, | ||
std::string & | hashname | ||
) |
Definition at line 100 of file aux_texture.cpp.
References data, VSFileSystem::GetHashName(), VSFileSystem::GetSharedTextureHashName(), name, original, refcount, texHashTable, and BaseUtil::Texture().
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 191 of file aux_texture.h.
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 208 of file aux_texture.h.
Referenced by Background::Draw(), and VSSprite::Draw().
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 213 of file aux_texture.h.
Referenced by Background::Draw(), and VSSprite::Draw().
A way to sort the texture by the original address (to make sure like textures stick togehter.
Definition at line 59 of file aux_texture.cpp.
References Original().
A way to test if the texture is equal to another based on original values.
Definition at line 64 of file aux_texture.cpp.
References Original().
|
virtual |
Reimplemented in AnimatedTexture.
Definition at line 136 of file aux_texture.cpp.
References Original().
Referenced by operator<(), operator==(), PipelinedTexture::Original(), AnimatedTexture::Original(), and Original().
|
virtual |
Reimplemented in AnimatedTexture, and PipelinedTexture.
Definition at line 144 of file aux_texture.cpp.
References Original().
|
virtual |
Changes priority of texture.
Definition at line 653 of file aux_texture.cpp.
References GFXPrioritizeTexture().
void Texture::setbad | ( | const string & | s) |
Definition at line 199 of file aux_texture.cpp.
References b, badtexHashTable, bool, VSFileSystem::current_path, VSFileSystem::GetHashName(), and VSFileSystem::GetSharedTextureHashName().
void Texture::setold | ( | ) |
Loads the old texture.
Definition at line 127 of file aux_texture.cpp.
void Texture::setReference | ( | Texture * | other) |
Make this instance a reference of "other".
Definition at line 69 of file aux_texture.cpp.
References bound, boundMode, boundSizeX, boundSizeY, data, image_target, name, refcount, texfilename, and texture_target.
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 201 of file aux_texture.h.
Referenced by VSSprite::SetTime().
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 276 of file aux_texture.h.
References stage.
Referenced by Background::Draw(), and VSSprite::Draw().
|
inlinevirtual |
Reimplemented in AnimatedTexture.
Definition at line 281 of file aux_texture.h.
Transfers this texture to GFX library.
Definition at line 552 of file aux_texture.cpp.
References CUBEMAP_NEGATIVE_X, CUBEMAP_NEGATIVE_Y, CUBEMAP_NEGATIVE_Z, CUBEMAP_POSITIVE_X, CUBEMAP_POSITIVE_Y, CUBEMAP_POSITIVE_Z, DXT1, DXT1RGBA, DXT3, DXT5, GFXTransferTexture(), PALETTE8, RGB24, and RGBA32.
Referenced by AnimatedTexture::MakeActive().
|
protected |
UnBinds from GFX library.
Definition at line 542 of file aux_texture.cpp.
References GFXDeleteTexture(), and texHashTable.
enum ADDRESSMODE Texture::address_mode |
The address mode being used with this texture.
Definition at line 78 of file aux_texture.h.
bool Texture::bound |
For re-biding.
Definition at line 66 of file aux_texture.h.
Referenced by Bind(), AnimatedTexture::Clone(), and setReference().
VSImageMode Texture::boundMode |
Definition at line 68 of file aux_texture.h.
Referenced by Bind(), and setReference().
uint Texture::boundSizeX |
Definition at line 67 of file aux_texture.h.
Referenced by Bind(), Background::Draw(), and setReference().
uint Texture::boundSizeY |
Definition at line 67 of file aux_texture.h.
Referenced by Bind(), Background::Draw(), and setReference().
unsigned char* Texture::data |
The data of this texture (used in between functions, deleted)
Definition at line 51 of file aux_texture.h.
Referenced by PipelinedTexture::beginMutate(), PipelinedTexture::Clone(), PipelinedTexture::endMutate(), AnimatedTexture::LoadVideoSource(), modold(), PipelinedTexture::PipelinedTexture(), setReference(), and AnimatedTexture::~AnimatedTexture().
enum TEXTURE_IMAGE_TARGET Texture::image_target |
Definition at line 75 of file aux_texture.h.
Referenced by getImageTarget(), AnimatedTexture::LoadVideoSource(), PipelinedTexture::PipelinedTexture(), setReference(), and StreamTexture::StreamTexture().
enum FILTER Texture::ismipmapped |
the filter mode of this texture
Definition at line 48 of file aux_texture.h.
Referenced by getFilter(), PipelinedTexture::PipelinedTexture(), and StreamTexture::StreamTexture().
Vector Texture::maxtcoord |
Definition at line 60 of file aux_texture.h.
Referenced by Background::Draw(), VSSprite::Draw(), Animation::DrawAsVSSprite(), Animation::DrawNoTransform(), Animation::DrawNow(), AnimatedTexture::LoadAni(), AnimatedTexture::LoadVideoSource(), and AnimatedTexture::MakeActive().
Vector Texture::mintcoord |
The minimum/maximum texturing coordinates for this texture (have in mind that it is not always enforce, ie. for meshes) (i=s, j=t, k=u)
Definition at line 60 of file aux_texture.h.
Referenced by Background::Draw(), VSSprite::Draw(), Animation::DrawAsVSSprite(), Animation::DrawNoTransform(), Animation::DrawNow(), AnimatedTexture::LoadAni(), AnimatedTexture::LoadVideoSource(), and AnimatedTexture::MakeActive().
int Texture::name |
The GFXname of this texture.
Definition at line 54 of file aux_texture.h.
Referenced by Bind(), PipelinedTexture::Clone(), AnimatedTexture::Clone(), Clone(), PipelinedTexture::endMutate(), LoadSuccess(), StreamTexture::MakeActive(), modold(), PipelinedTexture::PipelinedTexture(), Logo::SetDecal(), setReference(), StreamTexture::StreamTexture(), PipelinedTexture::Swap(), StreamTexture::UnMap(), Logo::~Logo(), PipelinedTexture::~PipelinedTexture(), and StreamTexture::~StreamTexture().
Texture* Texture::original |
The original data that would represent this texture.
Definition at line 63 of file aux_texture.h.
Referenced by Clone(), AnimatedTexture::LoadAni(), AnimatedTexture::LoadFrame(), modold(), PipelinedTexture::Original(), PipelinedTexture::PipelinedTexture(), and StreamTexture::StreamTexture().
int Texture::refcount |
The number of references on the original data.
Definition at line 71 of file aux_texture.h.
Referenced by Clone(), modold(), PipelinedTexture::PipelinedTexture(), setReference(), and StreamTexture::StreamTexture().
int Texture::stage |
The multitexture stage of this texture.
Definition at line 57 of file aux_texture.h.
Referenced by PipelinedTexture::Clone(), getStage(), AnimatedTexture::LoadAni(), PipelinedTexture::MakeActive(), MakeActive(), PipelinedTexture::MakeBothActive(), PipelinedTexture::PipelinedTexture(), SetupPass(), StreamTexture::StreamTexture(), and PipelinedTexture::Swap().
StringPool::Reference Texture::texfilename |
The file name used to load this texture.
Definition at line 45 of file aux_texture.h.
Referenced by buildShipDescription(), and setReference().
enum TEXTURE_TARGET Texture::texture_target |
The target this will go to (cubemap or otherwise)
Definition at line 74 of file aux_texture.h.
Referenced by VSSprite::Draw(), getTarget(), AnimatedTexture::LoadVideoSource(), PipelinedTexture::PipelinedTexture(), setReference(), and StreamTexture::StreamTexture().