Panda3D

standardMunger.h

00001 // Filename: standardMunger.h
00002 // Created by:  drose (21Mar05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef STANDARDMUNGER_H
00016 #define STANDARDMUNGER_H
00017 
00018 #include "pandabase.h"
00019 #include "stateMunger.h"
00020 #include "graphicsStateGuardian.h"
00021 #include "colorAttrib.h"
00022 #include "colorScaleAttrib.h"
00023 #include "renderModeAttrib.h"
00024 #include "pointerTo.h"
00025 #include "weakPointerTo.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : StandardMunger
00029 // Description : Performs some generic munging that is appropriate for
00030 //               all GSG types; for instance, applies ColorAttrib and
00031 //               ColorScaleAttrib to the vertices, and checks for
00032 //               hardware-accelerated animation capabilities.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA_DISPLAY StandardMunger : public StateMunger {
00035 public:
00036   StandardMunger(GraphicsStateGuardianBase *gsg, const RenderState *state,
00037                  int num_components, NumericType numeric_type,
00038                  Contents contents);
00039   virtual ~StandardMunger();
00040 
00041   INLINE GraphicsStateGuardian *get_gsg() const;
00042 
00043 protected:
00044   virtual CPT(GeomVertexData) munge_data_impl(const GeomVertexData *data);
00045   virtual int compare_to_impl(const GeomMunger *other) const;
00046   virtual void munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data,
00047                                Thread *current_thread);
00048   virtual void premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data);
00049   virtual int geom_compare_to_impl(const GeomMunger *other) const;
00050   virtual CPT(RenderState) munge_state_impl(const RenderState *state);
00051 
00052 private:
00053   int _num_components;
00054   NumericType _numeric_type;
00055   Contents _contents;
00056   CPT(RenderModeAttrib) _render_mode;
00057 
00058   bool _munge_color;
00059   bool _munge_color_scale;
00060 
00061   LColor _color;
00062   LVecBase4 _color_scale;
00063 
00064 public:
00065   static TypeHandle get_class_type() {
00066     return _type_handle;
00067   }
00068   static void init_type() {
00069     StateMunger::init_type();
00070     register_type(_type_handle, "StandardMunger",
00071                   StateMunger::get_class_type());
00072   }
00073   virtual TypeHandle get_type() const {
00074     return get_class_type();
00075   }
00076   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00077 
00078 private:
00079   static TypeHandle _type_handle;
00080 };
00081 
00082 #include "standardMunger.I"
00083 
00084 #endif
00085 
 All Classes Functions Variables Enumerations