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