diff --git a/panda/src/grutil/meshDrawer.I b/panda/src/grutil/meshDrawer.I index 6c3a877b48..d777914fd1 100644 --- a/panda/src/grutil/meshDrawer.I +++ b/panda/src/grutil/meshDrawer.I @@ -48,7 +48,10 @@ INLINE MeshDrawer:: //////////////////////////////////////////////////////////////////// // Function: MeshDrawer::get_root // Access: Published -// Description: Returns the root NodePath. +// Description: 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. //////////////////////////////////////////////////////////////////// INLINE NodePath MeshDrawer:: get_root() { @@ -59,6 +62,8 @@ get_root() { // Function: MeshDrawer::set_budget // Access: Published // Description: 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 //////////////////////////////////////////////////////////////////// INLINE void MeshDrawer:: set_budget(int total_budget) { diff --git a/panda/src/grutil/meshDrawer.cxx b/panda/src/grutil/meshDrawer.cxx index fd518b996e..df25aee25c 100644 --- a/panda/src/grutil/meshDrawer.cxx +++ b/panda/src/grutil/meshDrawer.cxx @@ -84,6 +84,8 @@ void MeshDrawer::generator(int budget) { // Function: MeshDrawer::begin // Access: Published // Description: Pass the current camera node and the root node. +// Passing the camera is required to generate +// bill boards that face it. //////////////////////////////////////////////////////////////////// void MeshDrawer::begin(NodePath camera, NodePath render) { // sanity check @@ -125,7 +127,7 @@ void MeshDrawer::begin(NodePath camera, NodePath render) { // Function: MeshDrawer::end // Access: Published // Description: Finish the drawing and clearing off the remaining -// vertexes. +// vertexes. //////////////////////////////////////////////////////////////////// void MeshDrawer::end() { @@ -151,6 +153,7 @@ void MeshDrawer::end() { // Access: Published // Description: 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 MeshDrawer::particle(LVector3f pos, LVector4f frame, float size, LVector4f color, float rotation) { @@ -182,6 +185,7 @@ void MeshDrawer::particle(LVector3f pos, LVector4f frame, float size, // Access: Published // Description: 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 MeshDrawer::blended_particle(LVector3f pos, LVector4f frame1, LVector4f frame2, float blend, float size, LVector4f color, float rotation) { @@ -199,6 +203,7 @@ void MeshDrawer::blended_particle(LVector3f pos, LVector4f frame1, // Access: Published // Description: Draws a billboard - particle with no rotation. // Billboards always face the camera. +// Frame contains u,v,u-size,v-size quadruple. //////////////////////////////////////////////////////////////////// void MeshDrawer::billboard(LVector3f pos, LVector4f frame, float size, LVector4f _color) { @@ -229,6 +234,7 @@ void MeshDrawer::billboard(LVector3f pos, LVector4f frame, float size, // Access: Published // Description: Draws a segment a line with a thickness. That has // billboarding effect. +// Frame contains u,v,u-size,v-size quadruple. //////////////////////////////////////////////////////////////////// void MeshDrawer::segment(LVector3f start, LVector3f stop, LVector4f frame, float thickness, LVector4f color) { @@ -242,6 +248,8 @@ void MeshDrawer::segment(LVector3f start, LVector3f stop, LVector4f frame, // Description: 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 MeshDrawer::cross_segment(LVector3f start, LVector3f stop, LVector4f frame, float thickness, LVector4f color) { @@ -285,6 +293,8 @@ void MeshDrawer::cross_segment(LVector3f start, LVector3f stop, LVector4f frame, // Access: Published // Description: 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. //////////////////////////////////////////////////////////////////// void MeshDrawer::uneven_segment(LVector3f start, LVector3f stop, LVector4f frame, float thickness_start, LVector4f color_start, @@ -324,6 +334,7 @@ void MeshDrawer::uneven_segment(LVector3f start, LVector3f stop, // Function: MeshDrawer::explosion // Access: Published // Description: Draws number of particles in a sphere like emitter. +// Frame contains u,v,u-size,v-size quadruple. //////////////////////////////////////////////////////////////////// void MeshDrawer::explosion( LVector3f pos, LVector4f frame, float size, LVector4f _color, @@ -343,6 +354,7 @@ void MeshDrawer::explosion( // Access: Published // Description: 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 MeshDrawer::stream(LVector3f start, LVector3f stop, LVector4f frame, float size, LVector4f _color, int number, float offset) { @@ -366,7 +378,8 @@ void MeshDrawer::stream(LVector3f start, LVector3f stop, LVector4f frame, float // 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. +// like physcal chunks of explosions. +// It can be a little slow //////////////////////////////////////////////////////////////////// void MeshDrawer::geometry(NodePath draw_node) { assert(_render.get_error_type() == NodePath::ET_ok); @@ -432,6 +445,7 @@ void MeshDrawer::geometry(NodePath draw_node) { // Description: Stars or continues linked segment. // Control position, frame, thickness and color with // parameters. +// Frame contains u,v,u-size,v-size quadruple. //////////////////////////////////////////////////////////////////// void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, float thickness, LVector4f color) { @@ -534,6 +548,7 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, // Description: 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 MeshDrawer::link_segment_end(LVector4f frame, LVector4f color) { diff --git a/panda/src/grutil/meshDrawer.h b/panda/src/grutil/meshDrawer.h index b9a26ee90d..17b7dcab2e 100644 --- a/panda/src/grutil/meshDrawer.h +++ b/panda/src/grutil/meshDrawer.h @@ -1,5 +1,6 @@ // Filename: meshDrawer.h // Created by: treeform (19dec08) +// Changes by: treeform (12jan10) // //////////////////////////////////////////////////////////////////// // @@ -41,7 +42,18 @@ //////////////////////////////////////////////////////////////////// // Class : MeshDrawer -// Description : +// Description : 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. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_GRUTIL MeshDrawer : public TypedObject { PUBLISHED: