15 #ifndef SPRITEPARTICLERENDERER_H 16 #define SPRITEPARTICLERENDERER_H 18 #include "pandabase.h" 20 #include "baseParticleRenderer.h" 21 #include "baseParticle.h" 23 #include "pointerTo.h" 25 #include "geomVertexData.h" 26 #include "geomPoints.h" 27 #include "colorInterpolationManager.h" 28 #include "geomVertexWriter.h" 29 #include "textureCollection.h" 30 #include "nodePathCollection.h" 31 #include "vector_int.h" 32 #include "pStatCollector.h" 52 aspect_ratio(copy.aspect_ratio) {
83 void set_source_info(
const string &tex) {
84 _source_type = ST_texture;
88 void set_source_info(
const string &model,
const string &node) {
89 _source_type = ST_from_node;
90 _source_model = model;
94 SourceType get_source_type()
const {
98 string get_tex_source()
const {
102 string get_model_source()
const {
103 return _source_model;
106 string get_node_source()
const {
110 int get_num_frames()
const {
111 return textures.size();
116 textures.push_back(t);
117 this->ll.push_back(ll);
118 this->ur.push_back(ur);
137 Texture *get_frame(
const int n)
const {
152 SourceType _source_type;
153 string _source_tex,_source_model,_source_node;
171 void set_from_node(
const NodePath &node_path,
bool size_from_texels =
false);
172 void set_from_node(
const NodePath &node_path,
const string &model,
const string &node,
bool size_from_texels =
false);
173 void add_from_node(
const NodePath &node_path,
bool size_from_texels =
false,
bool resize =
false);
174 void add_from_node(
const NodePath &node_path,
const string &model,
const string &node,
bool size_from_texels =
false,
bool resize =
false);
176 INLINE
void set_texture(
Texture *tex, PN_stdfloat texels_per_unit = 1.0f);
177 INLINE
void add_texture(
Texture *tex, PN_stdfloat texels_per_unit = 1.0f,
bool resize =
false);
178 INLINE
void remove_animation(
const int n);
179 INLINE
void set_ll_uv(
const LTexCoord &ll_uv);
180 INLINE
void set_ll_uv(
const LTexCoord &ll_uv,
const int anim,
const int frame);
181 INLINE
void set_ur_uv(
const LTexCoord &ur_uv);
182 INLINE
void set_ur_uv(
const LTexCoord &ur_uv,
const int anim,
const int frame);
183 INLINE
void set_size(PN_stdfloat width, PN_stdfloat height);
185 INLINE
void set_x_scale_flag(
bool animate_x_ratio);
186 INLINE
void set_y_scale_flag(
bool animate_y_ratio);
187 INLINE
void set_anim_angle_flag(
bool animate_theta);
188 INLINE
void set_initial_x_scale(PN_stdfloat initial_x_scale);
189 INLINE
void set_final_x_scale(PN_stdfloat final_x_scale);
190 INLINE
void set_initial_y_scale(PN_stdfloat initial_y_scale);
191 INLINE
void set_final_y_scale(PN_stdfloat final_y_scale);
192 INLINE
void set_nonanimated_theta(PN_stdfloat theta);
193 INLINE
void set_alpha_blend_method(ParticleRendererBlendMethod bm);
194 INLINE
void set_alpha_disable(
bool ad);
195 INLINE
void set_animate_frames_enable(
bool an);
196 INLINE
void set_animate_frames_rate(PN_stdfloat r);
197 INLINE
void set_animate_frames_index(
int i);
199 INLINE
Texture *get_texture()
const;
200 INLINE
Texture *get_texture(
const int anim,
const int frame)
const;
201 INLINE
int get_num_anims()
const;
202 INLINE
SpriteAnim *get_anim(
const int n)
const;
203 MAKE_SEQ(get_anims, get_num_anims, get_anim);
207 INLINE
LTexCoord get_ll_uv(
const int anim,
const int frame)
const;
209 INLINE
LTexCoord get_ur_uv(
const int anim,
const int frame)
const;
210 INLINE PN_stdfloat get_width()
const;
211 INLINE PN_stdfloat get_height()
const;
212 INLINE
LColor get_color()
const;
213 INLINE
bool get_x_scale_flag()
const;
214 INLINE
bool get_y_scale_flag()
const;
215 INLINE
bool get_anim_angle_flag()
const;
216 INLINE PN_stdfloat get_initial_x_scale()
const;
217 INLINE PN_stdfloat get_final_x_scale()
const;
218 INLINE PN_stdfloat get_initial_y_scale()
const;
219 INLINE PN_stdfloat get_final_y_scale()
const;
220 INLINE PN_stdfloat get_nonanimated_theta()
const;
221 INLINE ParticleRendererBlendMethod get_alpha_blend_method()
const;
222 INLINE
bool get_alpha_disable()
const;
223 INLINE
bool get_animate_frames_enable()
const;
224 INLINE PN_stdfloat get_animate_frames_rate()
const;
225 INLINE
int get_animate_frames_index()
const;
227 virtual void output(ostream &out)
const;
228 virtual void write(ostream &out,
int indent_level = 0)
const;
242 PN_stdfloat _initial_x_scale;
243 PN_stdfloat _final_x_scale;
244 PN_stdfloat _initial_y_scale;
245 PN_stdfloat _final_y_scale;
247 PN_stdfloat _base_y_scale;
248 PN_stdfloat _aspect_ratio;
249 PN_stdfloat _animate_frames_rate;
250 int _animate_frames_index;
252 bool _animate_x_ratio;
253 bool _animate_y_ratio;
256 bool _animate_frames;
257 bool _animation_removed;
259 ParticleRendererBlendMethod _blend_method;
267 virtual void birth_particle(
int index);
268 virtual void kill_particle(
int index);
269 virtual void init_geoms();
272 virtual void resize_pool(
int new_size);
275 vector_int _anim_size;
277 vector_int _birth_list;
282 #include "spriteParticleRenderer.I" 284 #endif // SPRITEPARTICLERENDERER_H Renders a particle system with high-speed nasty trick sprites.
Helper class used by SpriteParticleRenderer to keep track of its textures and their respective UVs an...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void clear()
Resets the GeomVertexWriter to the initial state.
A body on which physics will be applied.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
This is our own Panda specialization on the default STL vector.
A lightweight class that represents a single element that may be timed and/or counted via stats...
Pure virtual particle renderer base class.
High level class for color interpolation.
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
This is the base class for all three-component vectors and points.
int get_num_textures() const
Returns the number of Textures in the collection.
A base class for all things that want to be reference-counted.
Texture * get_texture(int index) const
Returns the nth Texture in the collection.
This is a two-component point in space.
Helper class used by SpriteParticleRenderer to keep track of the various GeomVertexWriters associated...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
This is a set of zero or more NodePaths.