54 if (_anims.size() == 0) {
79 nassertv(n < (
int)_anims.size());
82 for (i = 0; i < (int)_anims.size(); ++i) {
83 for (j = 0; j < (int)_anim_size[i]; ++j) {
84 _sprites[i][j]->clear_vertices();
88 _anims.erase(_anims.begin()+n);
89 _animation_removed =
true;
116 if(anim < (
int)_anims.size() && frame < (int)_anims[anim]->get_num_frames()) {
117 _anims[anim]->set_ll(frame,ll_uv);
144 if(anim < (
int)_anims.size() && frame < (int)_anims[anim]->get_num_frames()) {
145 _anims[anim]->set_ur(frame,ur_uv);
165 INLINE
void SpriteParticleRenderer::
168 _color_interpolation_manager->set_default_color(_color);
175 INLINE
void SpriteParticleRenderer::
176 set_x_scale_flag(
bool animate_x_ratio) {
177 _animate_x_ratio = animate_x_ratio;
185 INLINE
void SpriteParticleRenderer::
186 set_y_scale_flag(
bool animate_y_ratio) {
187 _animate_y_ratio = animate_y_ratio;
195 INLINE
void SpriteParticleRenderer::
196 set_anim_angle_flag(
bool animate_theta) {
197 _animate_theta = animate_theta;
205 INLINE
void SpriteParticleRenderer::
206 set_initial_x_scale(PN_stdfloat initial_x_scale) {
207 _initial_x_scale = initial_x_scale;
215 INLINE
void SpriteParticleRenderer::
216 set_final_x_scale(PN_stdfloat final_x_scale) {
217 _final_x_scale = final_x_scale;
224 INLINE
void SpriteParticleRenderer::
225 set_initial_y_scale(PN_stdfloat initial_y_scale) {
226 _initial_y_scale = initial_y_scale;
234 INLINE
void SpriteParticleRenderer::
235 set_final_y_scale(PN_stdfloat final_y_scale) {
236 _final_y_scale = final_y_scale;
243 INLINE
void SpriteParticleRenderer::
244 set_nonanimated_theta(PN_stdfloat theta) {
253 INLINE
void SpriteParticleRenderer::
254 set_alpha_blend_method(ParticleRendererBlendMethod bm) {
262 INLINE
void SpriteParticleRenderer::
263 set_alpha_disable(
bool ad) {
271 INLINE
void SpriteParticleRenderer::
272 set_animate_frames_enable(
bool an) {
273 _animate_frames = an;
280 INLINE
void SpriteParticleRenderer::
281 set_animate_frames_rate(PN_stdfloat r) {
283 _animate_frames_rate = r;
291 INLINE
void SpriteParticleRenderer::
292 set_animate_frames_index(
int i) {
293 nassertv(i < (
int)_anims[0]->get_num_frames());
294 _animate_frames_index = i;
301 INLINE
Texture *SpriteParticleRenderer::
302 get_texture()
const {
303 return get_texture(0,0);
310 INLINE
Texture *SpriteParticleRenderer::
311 get_texture(
const int anim,
const int frame)
const {
312 if(_anims.size() == 0) {
315 nassertr(anim < (
int)_anims.size() && anim >= 0, (
Texture*)NULL);
316 nassertr(frame < (
int)_anims[anim]->get_num_frames() && frame >= 0,_anims[anim]->get_frame(0));
317 return _anims[anim]->get_frame(frame);
320 INLINE
int SpriteParticleRenderer::
321 get_num_anims()
const {
322 return _anims.size();
326 get_anim(
const int n)
const {
327 nassertr(n < (
int)_anims.size(), (
SpriteAnim*)NULL);
332 get_last_anim()
const {
334 return *(_anims.end()-1);
359 int a = anim < (int)_anims.size()?anim:0;
360 int f = frame < (int)_anims[a]->get_num_frames()?frame:0;
361 return _anims[a]->get_ll(f);
383 int a = anim < (int)_anims.size()?anim:0;
384 int f = frame < (int)_anims[a]->get_num_frames()?frame:0;
385 return _anims[a]->get_ur(f);
412 INLINE
LColor SpriteParticleRenderer::
421 INLINE
bool SpriteParticleRenderer::
422 get_x_scale_flag()
const {
423 return _animate_x_ratio;
430 INLINE
bool SpriteParticleRenderer::
431 get_y_scale_flag()
const {
432 return _animate_y_ratio;
439 INLINE
bool SpriteParticleRenderer::
440 get_anim_angle_flag()
const {
441 return _animate_theta;
448 INLINE PN_stdfloat SpriteParticleRenderer::
449 get_initial_x_scale()
const {
450 return _initial_x_scale;
457 INLINE PN_stdfloat SpriteParticleRenderer::
458 get_final_x_scale()
const {
459 return _final_x_scale;
466 INLINE PN_stdfloat SpriteParticleRenderer::
467 get_initial_y_scale()
const {
468 return _initial_y_scale;
475 INLINE PN_stdfloat SpriteParticleRenderer::
476 get_final_y_scale()
const {
477 return _final_y_scale;
484 INLINE PN_stdfloat SpriteParticleRenderer::
485 get_nonanimated_theta()
const {
493 INLINE BaseParticleRenderer::ParticleRendererBlendMethod SpriteParticleRenderer::
494 get_alpha_blend_method()
const {
495 return _blend_method;
502 INLINE
bool SpriteParticleRenderer::
503 get_alpha_disable()
const {
504 return _alpha_disable;
511 INLINE
bool SpriteParticleRenderer::
512 get_animate_frames_enable()
const {
513 return _animate_frames;
520 INLINE PN_stdfloat SpriteParticleRenderer::
521 get_animate_frames_rate()
const {
522 return _animate_frames_rate;
530 INLINE
int SpriteParticleRenderer::
531 get_animate_frames_index()
const {
532 return _animate_frames_index;
540 get_color_interpolation_manager()
const {
541 return _color_interpolation_manager;
void remove_animation(const int n)
Removes an animation texture set from the renderer.
Helper class used by SpriteParticleRenderer to keep track of its textures and their respective UVs an...
void set_ll_uv(const LTexCoord &ll_uv)
Sets the UV coordinate of the lower-left corner of all the sprites generated by this renderer...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
void set_ur_uv(const LTexCoord &ur_uv)
Sets the UV coordinate of the upper-right corner of all the sprites generated by this renderer...
void add_texture(Texture *tex, PN_stdfloat texels_per_unit=1.0f, bool resize=false)
Adds texture to image pool, effectively creating a single frame animation that can be selected at par...
High level class for color interpolation.
LTexCoord get_ll_uv() const
Returns the UV coordinate of the lower-left corner; see set_ll_uv().
This is the base class for all three-component vectors and points.
PN_stdfloat get_height() const
Returns the height of each particle in world units.
PN_stdfloat get_width() const
Returns the width of each particle in world units.
This is a two-component point in space.
void set_texture(Texture *tex, PN_stdfloat texels_per_unit=1.0f)
Sets the renderer up to render the entire texture image.
LTexCoord get_ur_uv() const
Returns the UV coordinate of the lower-left corner; see set_ur_uv().
int get_y_size() const
Returns the height of the texture image in texels.
void set_size(PN_stdfloat width, PN_stdfloat height)
Sets the size of each particle in world units.
int get_x_size() const
Returns the width of the texture image in texels.
const Filename & get_filename() const
Returns the filename that has been set.