Browse Source

Added better doc comments to meshDrawer

treeform 16 years ago
parent
commit
b373379e59
3 changed files with 36 additions and 4 deletions
  1. 6 1
      panda/src/grutil/meshDrawer.I
  2. 17 2
      panda/src/grutil/meshDrawer.cxx
  3. 13 1
      panda/src/grutil/meshDrawer.h

+ 6 - 1
panda/src/grutil/meshDrawer.I

@@ -48,7 +48,10 @@ INLINE MeshDrawer::
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: MeshDrawer::get_root
 //     Function: MeshDrawer::get_root
 //       Access: Published
 //       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::
 INLINE NodePath MeshDrawer::
 get_root() {
 get_root() {
@@ -59,6 +62,8 @@ get_root() {
 //     Function: MeshDrawer::set_budget
 //     Function: MeshDrawer::set_budget
 //       Access: Published
 //       Access: Published
 //  Description: Sets the total triangle budget of the drawer.
 //  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::
 INLINE void MeshDrawer::
 set_budget(int total_budget) {
 set_budget(int total_budget) {

+ 17 - 2
panda/src/grutil/meshDrawer.cxx

@@ -84,6 +84,8 @@ void MeshDrawer::generator(int budget) {
 //     Function: MeshDrawer::begin
 //     Function: MeshDrawer::begin
 //       Access: Published
 //       Access: Published
 //  Description: Pass the current camera node and the root node.
 //  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) {
 void MeshDrawer::begin(NodePath camera, NodePath render) {
   // sanity check
   // sanity check
@@ -125,7 +127,7 @@ void MeshDrawer::begin(NodePath camera, NodePath render) {
 //     Function: MeshDrawer::end
 //     Function: MeshDrawer::end
 //       Access: Published
 //       Access: Published
 //  Description: Finish the drawing and clearing off the remaining
 //  Description: Finish the drawing and clearing off the remaining
-//               vertexes.
+//               vertexes.  
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::end() {
 void MeshDrawer::end() {
 
 
@@ -151,6 +153,7 @@ void MeshDrawer::end() {
 //       Access: Published
 //       Access: Published
 //  Description: Draws a particle that is sort of like a bill board
 //  Description: Draws a particle that is sort of like a bill board
 //               but has an extra rotation component.
 //               but has an extra rotation component.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::particle(LVector3f pos, LVector4f frame, float size, 
 void MeshDrawer::particle(LVector3f pos, LVector4f frame, float size, 
   LVector4f color, float rotation) {
   LVector4f color, float rotation) {
@@ -182,6 +185,7 @@ void MeshDrawer::particle(LVector3f pos, LVector4f frame, float size,
 //       Access: Published
 //       Access: Published
 //  Description: Works just like particle but accepts 2 frames and
 //  Description: Works just like particle but accepts 2 frames and
 //               a blend (from 0 to 1) component between them
 //               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, 
 void MeshDrawer::blended_particle(LVector3f pos, LVector4f frame1, 
   LVector4f frame2, float blend, float size, LVector4f color, float rotation) {
   LVector4f frame2, float blend, float size, LVector4f color, float rotation) {
@@ -199,6 +203,7 @@ void MeshDrawer::blended_particle(LVector3f pos, LVector4f frame1,
 //       Access: Published
 //       Access: Published
 //  Description: Draws a billboard - particle with no rotation.
 //  Description: Draws a billboard - particle with no rotation.
 //               Billboards always face the camera.
 //               Billboards always face the camera.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::billboard(LVector3f pos, LVector4f frame, float size, 
 void MeshDrawer::billboard(LVector3f pos, LVector4f frame, float size, 
   LVector4f _color) {
   LVector4f _color) {
@@ -229,6 +234,7 @@ void MeshDrawer::billboard(LVector3f pos, LVector4f frame, float size,
 //       Access: Published
 //       Access: Published
 //  Description: Draws a segment a line with a thickness. That has
 //  Description: Draws a segment a line with a thickness. That has
 //               billboarding effect.
 //               billboarding effect.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::segment(LVector3f start, LVector3f stop, LVector4f frame,
 void MeshDrawer::segment(LVector3f start, LVector3f stop, LVector4f frame,
                          float thickness, LVector4f color) {
                          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
 //  Description: Draws a segment a line with a thickness.  This
 //               segment does not use the bill boarding behavior
 //               segment does not use the bill boarding behavior
 //               and instead draws 2 planes in a cross.
 //               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,
 void MeshDrawer::cross_segment(LVector3f start, LVector3f stop, LVector4f frame,
                                float thickness, LVector4f color) {
                                float thickness, LVector4f color) {
@@ -285,6 +293,8 @@ void MeshDrawer::cross_segment(LVector3f start, LVector3f stop, LVector4f frame,
 //       Access: Published
 //       Access: Published
 //  Description: Draws a segment a line with different thickness
 //  Description: Draws a segment a line with different thickness
 //               and color on both sides.
 //               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,
 void MeshDrawer::uneven_segment(LVector3f start, LVector3f stop,
   LVector4f frame, float thickness_start, LVector4f color_start,
   LVector4f frame, float thickness_start, LVector4f color_start,
@@ -324,6 +334,7 @@ void MeshDrawer::uneven_segment(LVector3f start, LVector3f stop,
 //     Function: MeshDrawer::explosion
 //     Function: MeshDrawer::explosion
 //       Access: Published
 //       Access: Published
 //  Description: Draws number of particles in a sphere like emitter.
 //  Description: Draws number of particles in a sphere like emitter.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::explosion(
 void MeshDrawer::explosion(
   LVector3f pos, LVector4f frame, float size, LVector4f _color,
   LVector3f pos, LVector4f frame, float size, LVector4f _color,
@@ -343,6 +354,7 @@ void MeshDrawer::explosion(
 //       Access: Published
 //       Access: Published
 //  Description: Draws a number of particles in a big line with a
 //  Description: Draws a number of particles in a big line with a
 //               shift dictated by the offset.
 //               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,
 void MeshDrawer::stream(LVector3f start, LVector3f stop, LVector4f frame, float size, LVector4f _color,
         int number, float offset) {
         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
 //               the MeshDrawer object.  This performs a similar
 //               functions as RigidBodyCombiner but for very
 //               functions as RigidBodyCombiner but for very
 //               dynamic situations that share the same texture
 //               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) {
 void MeshDrawer::geometry(NodePath draw_node) {
   assert(_render.get_error_type() == NodePath::ET_ok);
   assert(_render.get_error_type() == NodePath::ET_ok);
@@ -432,6 +445,7 @@ void MeshDrawer::geometry(NodePath draw_node) {
 //  Description: Stars or continues linked segment.
 //  Description: Stars or continues linked segment.
 //               Control position, frame, thickness and color with
 //               Control position, frame, thickness and color with
 //               parameters.
 //               parameters.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
 void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
         float thickness, LVector4f color) {
         float thickness, LVector4f color) {
@@ -534,6 +548,7 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame,
 //  Description: Finish drawing linked segments, needs at least
 //  Description: Finish drawing linked segments, needs at least
 //               two calls to link_segment before it can end
 //               two calls to link_segment before it can end
 //               the linked segment.
 //               the linked segment.
+//               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::link_segment_end(LVector4f frame, LVector4f color)
 void MeshDrawer::link_segment_end(LVector4f frame, LVector4f color)
 {
 {

+ 13 - 1
panda/src/grutil/meshDrawer.h

@@ -1,5 +1,6 @@
 // Filename: meshDrawer.h
 // Filename: meshDrawer.h
 // Created by:  treeform (19dec08)
 // Created by:  treeform (19dec08)
+// Changes by:  treeform (12jan10)
 //
 //
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //
 //
@@ -41,7 +42,18 @@
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : MeshDrawer
 //       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 {
 class EXPCL_PANDA_GRUTIL MeshDrawer : public TypedObject {
 PUBLISHED:
 PUBLISHED: