MeshDrawer

class MeshDrawer

Bases: TypedObject

Mesh drawer creates a single geom object that can be shaped with different draw commands. This is an efficient way to render bunch of billboards, particles, fast changing triangles. Its implemented by recycling same geom over and over again. Max budget specifies how many triangles are allowed. Some uses of this class can be : particle system, radar icons, health bars, 2d icons, 2d ui, bullets, missile trails. Any that can be drawn with triangles can be drawn with this class. At the low level this uses the GeomVertexRewriter’s. The internal geom consists of vertex, normal, uv and color channels.

Inheritance diagram

Inheritance diagram of MeshDrawer

MeshDrawer(void)

Creates the MeshDrawer low level system.

void begin(NodePath camera, NodePath render)

Pass the current camera node and the root node. Passing the camera is required to generate bill boards that face it.

void billboard(LVector3 const &pos, LVector4 const &frame, PN_stdfloat size, LVector4 const &color)

Draws a billboard - particle with no rotation. Billboards always face the camera. Frame contains u,v,u-size,v-size quadruple.

void blended_particle(LVector3 const &pos, LVector4 const &frame1, LVector4 const &frame2, PN_stdfloat blend, PN_stdfloat size, LVector4 const &color, PN_stdfloat rotation)

Works just like particle but accepts 2 frames and a blend (from 0 to 1) component between them Frame contains u,v,u-size,v-size quadruple.

void cross_segment(LVector3 const &start, LVector3 const &stop, LVector4 const &frame, PN_stdfloat thickness, LVector4 const &color)

Draws a segment a line with a thickness. This segment does not use the bill boarding behavior and instead draws 2 planes in a cross. Stars at start and ends at stop. Frame contains u,v,u-size,v-size quadruple.

void end(void)

Finish the drawing and clearing off the remaining vertexes.

void explosion(LVector3 const &pos, LVector4 const &frame, PN_stdfloat size, LVector4 const &color, int seed, int number, PN_stdfloat distance)

Draws number of particles in a sphere like emitter. Frame contains u,v,u-size,v-size quadruple.

void geometry(NodePath node)

Draws the geometry that is inside this node path into the MeshDrawer object. This performs a similar functions as RigidBodyCombiner but for very dynamic situations that share the same texture like physcal chunks of explosions. It can be a little slow

int get_budget(void)

Gets the total triangle budget of the drawer

static TypeHandle get_class_type(void)
NodePath get_root(void)

Returns the root NodePath. You should use this node to reparent mesh drawer onto the scene might also want to disable depth draw or enable transparency.

Stars or continues linked segment. Control position, frame, thickness and color with parameters. Frame contains u,v,u-size,v-size quadruple.

Finish drawing linked segments, needs at least two calls to link_segment() before it can end the linked segment. Frame contains u,v,u-size,v-size quadruple.

void particle(LVector3 const &pos, LVector4 const &frame, PN_stdfloat size, LVector4 const &color, PN_stdfloat rotation)

Draws a particle that is sort of like a bill board but has an extra rotation component. Frame contains u,v,u-size,v-size quadruple.

void segment(LVector3 const &start, LVector3 const &stop, LVector4 const &frame, PN_stdfloat thickness, LVector4 const &color)

Draws a segment a line with a thickness. That has billboarding effect. Frame contains u,v,u-size,v-size quadruple.

void set_budget(int budget)

Sets the total triangle budget of the drawer. This will not be exceeded. Don’t set some thing too large because it will be slow

void stream(LVector3 const &start, LVector3 const &stop, LVector4 const &frame, PN_stdfloat size, LVector4 const &color, int number, PN_stdfloat offset)

Draws a number of particles in a big line with a shift dictated by the offset. Frame contains u,v,u-size,v-size quadruple.

void tri(LVector3 const &v1, LVector4 const &c1, LVector2 const &uv1, LVector3 const &v2, LVector4 const &c2, LVector2 const &uv2, LVector3 const &v3, LVector4 const &c3, LVector2 const &uv3)

Draws a triangle with the given parameters.

void uneven_segment(LVector3 const &start, LVector3 const &stop, LVector4 const &frame, PN_stdfloat thickness_start, LVector4 const &color_start, PN_stdfloat thickness_stop, LVector4 const &color_stop)

Draws a segment a line with different thickness and color on both sides. Stars at start and ends at stop. Frame contains u,v,u-size,v-size quadruple.