SpriteParticleRenderer
-
class SpriteParticleRenderer
Bases:
BaseParticleRenderer
Renders a particle system with high-speed nasty trick sprites.
Inheritance diagram
-
SpriteParticleRenderer(SpriteParticleRenderer const ©)
constructor
copy constructor
-
void add_from_node(NodePath const &node_path, std::string const &model, std::string const &node, bool size_from_texels = false, bool resize = false)
This will allow the renderer to randomly choose from more than one texture or sequence at particle birth.
If the source type is important, use this one.
model and node should lead to node_path like this: node_path = loader.loadModel(model).find(node)
If resize is true, or if there are no textures currently on the renderer, it will force the renderer to use the size information from this node from now on. (Default is false)
This will allow the renderer to randomly choose from more than one texture or sequence at particle birth.
If resize is true, or if there are no textures currently on the renderer, it will force the renderer to use the size information from this node from now on. (Default is false)
-
void add_texture(Texture *tex, PN_stdfloat texels_per_unit = 1.0, bool resize = false)
Adds texture to image pool, effectively creating a single frame animation that can be selected at particle birth. This should only be called after a previous call to
set_texture()
.
-
BaseParticleRenderer::ParticleRendererBlendMethod get_alpha_blend_method(void) const
-
bool get_alpha_disable(void) const
-
SpriteAnim *get_anim(int const n) const
-
bool get_anim_angle_flag(void) const
-
bool get_animate_frames_enable(void) const
-
int get_animate_frames_index(void) const
-
PN_stdfloat get_animate_frames_rate(void) const
-
ColorInterpolationManager *get_color_interpolation_manager(void) const
-
PN_stdfloat get_final_x_scale(void) const
-
PN_stdfloat get_final_y_scale(void) const
-
PN_stdfloat get_height(void) const
Returns the height of each particle in world units.
-
PN_stdfloat get_initial_x_scale(void) const
-
PN_stdfloat get_initial_y_scale(void) const
-
SpriteAnim *get_last_anim(void) const
-
LTexCoord get_ll_uv(int const anim, int const frame) const
Returns the UV coordinate of the lower-left corner; see
set_ll_uv()
.
-
PN_stdfloat get_nonanimated_theta(void) const
-
int get_num_anims(void) const
-
LTexCoord get_ur_uv(int const anim, int const frame) const
Returns the UV coordinate of the lower-left corner; see
set_ur_uv()
.Returns the UV coordinate of the upper-right corner; see
set_ur_uv()
.
-
PN_stdfloat get_width(void) const
Returns the width of each particle in world units.
-
bool get_x_scale_flag(void) const
-
bool get_y_scale_flag(void) const
-
void remove_animation(int const n)
Removes an animation texture set from the renderer.
-
void set_alpha_blend_method(BaseParticleRenderer::ParticleRendererBlendMethod bm)
-
void set_alpha_disable(bool ad)
-
void set_anim_angle_flag(bool animate_theta)
-
void set_animate_frames_enable(bool an)
-
void set_animate_frames_index(int i)
-
void set_animate_frames_rate(PN_stdfloat r)
-
void set_final_x_scale(PN_stdfloat final_x_scale)
-
void set_final_y_scale(PN_stdfloat final_y_scale)
-
void set_from_node(NodePath const &node_path, std::string const &model, std::string const &node, bool size_from_texels = false)
If the source type is important, use this one.
model and node should lead to node_path like this: node_path = loader.loadModel(model).find(node)
This will remove all previously add textures and resize the renderer to match the new geometry.
Sets the properties on this renderer from the geometry referenced by the indicated
NodePath
. This should be a reference to aGeomNode
or aSequenceNode
; it extracts out the texture and UV range from the node.This will remove all previously added textures and animations. It will also resize the renderer to match this new geometry.
If node_path refers to a GeomNode(or has one beneath it) the texture, its size, and UV data will be extracted from that.
If node_path references a SequenceNode(or has one beneath it) with multiple
GeomNodes
beneath it, the size data will correspond only to the firstGeomNode
found with a valid texture, while the texture and UV information will be stored for each individual node.If size_from_texels is true, the particle size is based on the number of texels in the source image; otherwise, it is based on the size of the first polygon found in the node.
model and node are the two items used to construct node_path. If the source type is important, use set_from_node(NodePath,string,string,bool) instead.
-
void set_initial_x_scale(PN_stdfloat initial_x_scale)
-
void set_initial_y_scale(PN_stdfloat initial_y_scale)
-
void set_ll_uv(LTexCoord const &ll_uv, int const anim, int const frame)
Sets the UV coordinate of the lower-left corner of all the sprites generated by this renderer. Normally this is (0, 0), but it might be set to something else to use only a portion of the texture.
-
void set_nonanimated_theta(PN_stdfloat theta)
-
void set_size(PN_stdfloat width, PN_stdfloat height)
Sets the size of each particle in world units.
-
void set_texture(Texture *tex, PN_stdfloat texels_per_unit = 1.0)
Sets the renderer up to render the entire texture image. The scale of each particle is based on the size of the texture in each dimension, modified by texels_per_unit.
Used to set the size of the particles. Will clear all previously loaded textures and animations.
-
void set_ur_uv(LTexCoord const &ur_uv, int const anim, int const frame)
Sets the UV coordinate of the upper-right corner of all the sprites generated by this renderer. Normally this is (1, 1), but it might be set to something else to use only a portion of the texture.
-
void set_x_scale_flag(bool animate_x_ratio)
-
void set_y_scale_flag(bool animate_y_ratio)
-
SpriteParticleRenderer(SpriteParticleRenderer const ©)