zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::Textures Class Reference

A Texture Database Singleton. More...

#include <Textures.h>

Inherits Zeni::Singleton< Textures >, and Zeni::Database< Texture >.

Public Member Functions

void apply_Texture (const String &name)
 Apply a texture for upcoming polygons (Called by Video::apply_Texture) More...
 
void apply_Texture (const unsigned long &id)
 Apply a texture for upcoming polygons. More...
 
int get_current_frame (const unsigned long &id)
 Get the currently selected frame number for a Sprite. More...
 
int get_num_frames (const unsigned long &id)
 Get the number of frames; returns 0 if it is not a Sprite. More...
 
bool is_Sprite (const unsigned long &id)
 Does this id point to a Sprite. More...
 
void set_current_frame (const unsigned long &id, const int &frame_number)
 Set the frame number for a Sprite. More...
 
- Public Member Functions inherited from Zeni::Singleton< Textures >
void fax_post_reinit (Event::Handler *const &handler)
 
void fax_pre_uninit (Event::Handler *const &handler)
 
void give_post_reinit (Event::Handler *const &handler)
 
void give_pre_uninit (Event::Handler *const &handler)
 
void lend_post_reinit (Event::Handler *const &handler)
 
void lend_pre_uninit (Event::Handler *const &handler)
 
- Public Member Functions inherited from Zeni::Database< Texture >
 Database (const String &filename, const String &xml_identifier)
 
virtual ~Database ()
 
void clear (const String &name, const String &filename="")
 Clear an entry. More...
 
void clear ()
 Permanently clear all resources. More...
 
unsigned long find (const String &name) const
 Get an id by name, without throwing an Error. More...
 
bool find (const unsigned long &id) const
 Check to see that an id is valid. More...
 
unsigned long get_id (const String &name) const
 Get an id by name, possibly throwing an Error. More...
 
unsigned long give (const String &name, Texture *const &type, const bool &keep, const String &filename="")
 Add an entry (which it will later delete) More...
 
unsigned long lend (const String &name, Texture *const &type, const bool &keep)
 Add an entry (which it will NEVER delete) More...
 
void load_file (const String &filename)
 Load all resources from a given file, giving them highest priority. More...
 
void lose_resources ()
 Wipe losable resources and prepare to reload them when they are next needed. More...
 
const bool & lost_resources ()
 Check to see if resources have been lost. More...
 
Textureoperator[] (const String &name) const
 Get a TYPE by name. More...
 
Textureoperator[] (const unsigned long &id) const
 Get a TYPE by id. More...
 
void reload ()
 lose_resources + init More...
 
void unload_file (const String &filename)
 Unload all resources from a given file, reloading lower priority resources. More...
 
void unlose_resources ()
 If resources have been lost, then reload them. More...
 

Static Public Member Functions

static int get_anisotropic_filtering ()
 Check the current level of anisotropy. More...
 
static bool get_bilinear_filtering ()
 Check if bilinear filtering is in use. More...
 
static bool get_lazy_loading ()
 
static bool get_mipmapping ()
 Check if mipmapping is in use. More...
 
static bool get_trilinear_filtering ()
 Check if trilinear filtering (the combination of bilinear filtering and mipmapping) is in use. More...
 
static void set_lazy_loading (const bool &lazy_loading=true)
 Set whether Textures should use lazy loading if possible, or if it should always load Textures immediately. More...
 
static void set_texturing_mode (const int &anisotropic_filtering_, const bool &bilinear_filtering_, const bool &mipmapping_)
 Check to see if Textures is set to use lazy loading if possible. More...
 
- Static Public Member Functions inherited from Zeni::Singleton< Textures >
static void completely_destroy ()
 
static void destroy ()
 
static Texturesget ()
 
static bool is_initialized ()
 
static void remove_post_reinit (Event::Handler *const &handler)
 
static void remove_pre_uninit (Event::Handler *const &handler)
 

Friends

class Singleton< Textures >
 

Additional Inherited Members

- Protected Member Functions inherited from Zeni::Singleton< Textures >
 Singleton ()
 
virtual ~Singleton ()
 
- Protected Member Functions inherited from Zeni::Database< Texture >
bool give_priority (const String &name, const bool &lent, const bool &keep, const String &filename="")
 If 'lent', 'keep', and 'filename' match, give priority over other 'name' entries. More...
 
void init ()
 
void uninit ()
 

Detailed Description

A Texture Database Singleton.

Note
Textures will be reloaded automatically if settings are changed with a call to set_texturing_mode.
Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 52 of file Textures.h.

Member Function Documentation

void Zeni::Textures::apply_Texture ( const String name)
void Zeni::Textures::apply_Texture ( const unsigned long &  id)

Apply a texture for upcoming polygons.

Definition at line 72 of file Textures.cpp.

int Zeni::Textures::get_anisotropic_filtering ( )
inlinestatic

Check the current level of anisotropy.

Definition at line 40 of file Textures.hxx.

Referenced by Zeni::Video::save().

bool Zeni::Textures::get_bilinear_filtering ( )
inlinestatic

Check if bilinear filtering is in use.

Definition at line 28 of file Textures.hxx.

Referenced by Zeni::Video::save(), and Zeni::Video_GL_Shader::unset_render_target().

int Zeni::Textures::get_current_frame ( const unsigned long &  id)

Get the currently selected frame number for a Sprite.

Definition at line 88 of file Textures.cpp.

References Zeni::Sprite::get_current_frame().

bool Zeni::Textures::get_lazy_loading ( )
inlinestatic

Definition at line 44 of file Textures.hxx.

bool Zeni::Textures::get_mipmapping ( )
inlinestatic

Check if mipmapping is in use.

Definition at line 32 of file Textures.hxx.

Referenced by Zeni::Video::save(), and Zeni::Video_GL_Shader::unset_render_target().

int Zeni::Textures::get_num_frames ( const unsigned long &  id)

Get the number of frames; returns 0 if it is not a Sprite.

Definition at line 80 of file Textures.cpp.

References Zeni::Sprite::get_num_frames().

Referenced by Zeni::sprite_num_frames().

bool Zeni::Textures::get_trilinear_filtering ( )
inlinestatic

Check if trilinear filtering (the combination of bilinear filtering and mipmapping) is in use.

Definition at line 36 of file Textures.hxx.

bool Zeni::Textures::is_Sprite ( const unsigned long &  id)

Does this id point to a Sprite.

Definition at line 76 of file Textures.cpp.

Referenced by Zeni::is_sprite().

void Zeni::Textures::set_current_frame ( const unsigned long &  id,
const int frame_number 
)

Set the frame number for a Sprite.

Definition at line 96 of file Textures.cpp.

References Zeni::Sprite::set_current_frame().

Referenced by Zeni::set_sprite_frame().

void Zeni::Textures::set_lazy_loading ( const bool &  lazy_loading = true)
inlinestatic

Set whether Textures should use lazy loading if possible, or if it should always load Textures immediately.

Definition at line 48 of file Textures.hxx.

void Zeni::Textures::set_texturing_mode ( const int anisotropic_filtering_,
const bool &  bilinear_filtering_,
const bool &  mipmapping_ 
)
static

Check to see if Textures is set to use lazy loading if possible.

Set the texturing mode

Definition at line 104 of file Textures.cpp.

References Zeni::Video::get_maximum_anisotropy(), Zeni::get_Textures(), Zeni::get_Video(), Zeni::Database< TYPE >::lost_resources(), and Zeni::Database< TYPE >::reload().

Referenced by load_config(), and Zeni::Video::set_failsafe_defaults().

Friends And Related Function Documentation

friend class Singleton< Textures >
friend

Definition at line 53 of file Textures.h.


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