Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StreamTexture Class Reference

#include <stream_texture.h>

Inheritance diagram for StreamTexture:
Texture

Public Member Functions

 StreamTexture (int width, int height, enum FILTER filtertype, unsigned char *origdata)
 
 ~StreamTexture ()
 
unsigned char * Map ()
 
void UnMap (bool changed=true)
 
void MakeActive (int stage)
 
void MakeActive ()
 Binds the texture in the GFX library. More...
 
StreamTextureClone ()
 
- Public Member Functions inherited from Texture
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 TextureOriginal () const
 
virtual TextureOriginal ()
 
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 (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...
 

Additional Inherited Members

- Static Public Member Functions inherited from Texture
static TextureExists (std::string s)
 Whether or not the string exists as a texture. More...
 
static TextureExists (std::string s, std::string a)
 Whether or not the color and alpha data already exist. More...
 
- Public Attributes inherited from Texture
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
 
Textureoriginal
 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 inherited from Texture
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...
 

Detailed Description

Definition at line 3 of file stream_texture.h.

Constructor & Destructor Documentation

StreamTexture::StreamTexture ( int  width,
int  height,
enum FILTER  filtertype,
unsigned char *  origdata 
)

Definition at line 11 of file stream_texture.cpp.

References GFXCreateTexture(), GFXTransferTexture(), height, Texture::image_target, Texture::ismipmapped, VsnetOSS::memcpy(), Texture::name, Texture::original, Texture::refcount, RGBA32, Texture::stage, TEXTURE2D, TEXTURE_2D, Texture::texture_target, and width.

Referenced by Clone().

12 {
13  /*
14  * img_type=Unrecognized;
15  * img_depth=8;
16  * img_color_type=(PNG_HAS_COLOR&PNG_HAS_ALPHA);
17  * img_alpha=true;
18  * strip_16=true;
19  */
20  mode = _24BITRGBA;
21  this->stage = 0;
22  this->sizeX = width;
23  this->sizeY = height;
24  this->original = NULL;
25  this->palette = NULL;
26  this->refcount = 0;
29  ismipmapped = filtertype;
30  GFXCreateTexture( width, height, RGBA32, &name, 0, 0, filtertype );
31  this->mutabledata = (unsigned char*) malloc( sizeof (unsigned char)*width*height*4 );
32  if (origdata) {
33  memcpy( this->mutabledata, origdata, sizeof (unsigned char)*width*height*4 );
34  GFXTransferTexture( mutabledata, name, sizeX, sizeY, RGBA32 );
35  }
36 }
StreamTexture::~StreamTexture ( )

Definition at line 51 of file stream_texture.cpp.

References GFXDeleteTexture(), and Texture::name.

52 {
54  name = -1;
55  if (this->mutabledata)
56  free( this->mutabledata );
57  this->mutabledata = NULL;
58 }

Member Function Documentation

StreamTexture * StreamTexture::Clone ( )
virtual

Reimplemented from Texture.

Definition at line 3 of file stream_texture.cpp.

References Map(), StreamTexture(), UnMap(), and x.

4 {
5  unsigned char *x = Map();
6  StreamTexture *ret = new StreamTexture( sizeX, sizeY, filtertype, x );
7  UnMap( false );
8  return ret;
9 }
void StreamTexture::MakeActive ( int  stage)
virtual

Reimplemented from Texture.

Definition at line 60 of file stream_texture.cpp.

References GFXSelectTexture(), and Texture::name.

Referenced by AnimationDraw().

61 {
63 }
void StreamTexture::MakeActive ( )
inlinevirtual

Binds the texture in the GFX library.

Reimplemented from Texture.

Definition at line 13 of file stream_texture.h.

Referenced by UnMap().

14  {
15  MakeActive( this->stage );
16  }
unsigned char * StreamTexture::Map ( )

Definition at line 38 of file stream_texture.cpp.

Referenced by AnimationDraw(), and Clone().

39 {
40  return mutabledata;
41 }
void StreamTexture::UnMap ( bool  changed = true)

Definition at line 43 of file stream_texture.cpp.

References GFXTransferTexture(), MakeActive(), Texture::name, and RGBA32.

Referenced by AnimationDraw(), and Clone().

44 {
45  if (changed) {
46  MakeActive( 0 );
47  GFXTransferTexture( mutabledata, name, sizeX, sizeY, RGBA32 );
48  }
49 }

The documentation for this class was generated from the following files: