Panda3D
standardMunger.h
1 // Filename: standardMunger.h
2 // Created by: drose (21Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef STANDARDMUNGER_H
16 #define STANDARDMUNGER_H
17 
18 #include "pandabase.h"
19 #include "stateMunger.h"
20 #include "graphicsStateGuardian.h"
21 #include "colorAttrib.h"
22 #include "colorScaleAttrib.h"
23 #include "renderModeAttrib.h"
24 #include "pointerTo.h"
25 #include "weakPointerTo.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : StandardMunger
29 // Description : Performs some generic munging that is appropriate for
30 // all GSG types; for instance, applies ColorAttrib and
31 // ColorScaleAttrib to the vertices, and checks for
32 // hardware-accelerated animation capabilities.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_DISPLAY StandardMunger : public StateMunger {
35 public:
37  int num_components, NumericType numeric_type,
38  Contents contents);
39  virtual ~StandardMunger();
40 
41  INLINE GraphicsStateGuardian *get_gsg() const;
42 
43 protected:
44  virtual CPT(GeomVertexData) munge_data_impl(const GeomVertexData *data);
45  virtual int compare_to_impl(const GeomMunger *other) const;
46  virtual void munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data,
47  Thread *current_thread);
48  virtual void premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data);
49  virtual int geom_compare_to_impl(const GeomMunger *other) const;
50  virtual CPT(RenderState) munge_state_impl(const RenderState *state);
51 
52  INLINE RenderModeAttrib::Mode get_render_mode() const;
53 
54 private:
55  int _num_components;
56  NumericType _numeric_type;
57  Contents _contents;
58  CPT(RenderModeAttrib) _render_mode;
59 
60  bool _munge_color;
61  bool _munge_color_scale;
62  bool _auto_shader;
63 
64  LColor _color;
65  LVecBase4 _color_scale;
66 
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  StateMunger::init_type();
73  register_type(_type_handle, "StandardMunger",
74  StateMunger::get_class_type());
75  }
76  virtual TypeHandle get_type() const {
77  return get_class_type();
78  }
79  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
80 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "standardMunger.I"
86 
87 #endif
88 
This is just a simple derivative of GeomMunger that adds the ability to munge states.
Definition: stateMunger.h:30
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
Definition: geomMunger.h:57
Performs some generic munging that is appropriate for all GSG types; for instance, applies ColorAttrib and ColorScaleAttrib to the vertices, and checks for hardware-accelerated animation capabilities.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
Definition: geom.h:58
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates all the communication with a particular instance of a given rendering backend...
Specifies how polygons are to be drawn.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
GraphicsStateGuardianBase * get_gsg() const
Returns a pointer to the GSG that created this munger.
Definition: geomMunger.I:23