Removed redundant set_texture() and add_texture() functions

This commit is contained in:
Josh Wilson 2005-11-22 18:38:12 +00:00
parent 27964af494
commit 4c815ef2a3
2 changed files with 3 additions and 28 deletions

View File

@ -28,14 +28,6 @@
// Used to set the size of the particles. Will clear
// all previously loaded textures and animations.
////////////////////////////////////////////////////////////////////
INLINE void SpriteParticleRenderer::
set_texture(Texture *tex, const string &tex_path, float texels_per_unit) {
set_texture(tex,texels_per_unit);
//moved to "set_texture(Texture *tex, float texels_per_unit)" for backwards compatibility
//get_last_anim()->set_source_info(tex_path);
}
INLINE void SpriteParticleRenderer::
set_texture(Texture *tex, float texels_per_unit) {
if (tex != (Texture *)NULL) {
@ -43,10 +35,7 @@ set_texture(Texture *tex, float texels_per_unit) {
_anims.clear();
// Insert the single texture
// For some reason sprite particles are rendering flipped in the horizontal direction.
// This is a hack to fix it for now.
//_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
_anims.push_back(new SpriteAnim(tex,TexCoordf(1.0f, 0.0f),TexCoordf(0.0f, 1.0f)));
_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
// We scale the particle size by the size of the texture.
set_size(tex->get_x_size() / texels_per_unit,
@ -64,16 +53,6 @@ set_texture(Texture *tex, float texels_per_unit) {
// particle birth. This should only be called after
// a previous call to set_texture().
////////////////////////////////////////////////////////////////////
INLINE void SpriteParticleRenderer::
add_texture(Texture *tex, const string &tex_path, float texels_per_unit, bool resize) {
int anim_count = _anims.size();
add_texture(tex,texels_per_unit,resize);
if (anim_count < (int)_anims.size()) {
get_last_anim()->set_source_info(tex_path);
}
}
INLINE void SpriteParticleRenderer::
add_texture(Texture *tex, float texels_per_unit, bool resize) {
if (_anims.size() == 0) {
@ -81,16 +60,14 @@ add_texture(Texture *tex, float texels_per_unit, bool resize) {
} else {
if(tex != (Texture *)NULL) {
if (tex != (Texture *)NULL) {
// For some reason sprite particles are rendering flipped in the horizontal direction.
// This is a hack to fix it for now.
//_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
_anims.push_back(new SpriteAnim(tex,TexCoordf(1.0f, 0.0f),TexCoordf(0.0f, 1.0f)));
_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f)));
}
if(resize) {
// We scale the particle size by the size of the texture.
set_size(tex->get_x_size() / texels_per_unit,
tex->get_y_size() / texels_per_unit);
}
get_last_anim()->set_source_info(tex->get_filename());
init_geoms();
}
}

View File

@ -176,9 +176,7 @@ PUBLISHED:
void add_from_node(const NodePath &node_path, const string &model, const string &node, bool size_from_texels = false, bool resize = false);
INLINE void set_texture(Texture *tex, float texels_per_unit = 1.0f);
INLINE void set_texture(Texture *tex, const string &tex_path, float texels_per_unit = 1.0f);
INLINE void add_texture(Texture *tex, float texels_per_unit = 1.0f, bool resize = false);
INLINE void add_texture(Texture *tex, const string &tex_path, float texels_per_unit = 1.0f, bool resize = false);
INLINE void remove_animation(const int n);
INLINE void set_ll_uv(const TexCoordf &ll_uv);
INLINE void set_ll_uv(const TexCoordf &ll_uv, const int anim, const int frame);