Panda3D
 All Classes Functions Variables Enumerations
tinyGeomMunger.cxx
1 // Filename: tinyGeomMunger.cxx
2 // Created by: drose (29Apr08)
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 #include "tinyGeomMunger.h"
16 #include "dcast.h"
17 
18 TypeHandle TinyGeomMunger::_type_handle;
19 
20 ALLOC_DELETED_CHAIN_DEF(TinyGeomMunger);
21 
22 ////////////////////////////////////////////////////////////////////
23 // Function: TinyGeomMunger::Constructor
24 // Access: Public
25 // Description:
26 ////////////////////////////////////////////////////////////////////
27 TinyGeomMunger::
28 TinyGeomMunger(GraphicsStateGuardian *gsg, const RenderState *state) :
29  StandardMunger(gsg, state, 4, NT_uint8, C_color)
30 {
31  // The TinyGSG can apply the color and color scale at runtime.
32  // _munge_color = false;
33  // _munge_color_scale = false;
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: TinyGeomMunger::Destructor
38 // Access: Public, Virtual
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 TinyGeomMunger::
42 ~TinyGeomMunger() {
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: TinyGeomMunger::munge_format_impl
47 // Access: Protected, Virtual
48 // Description: Given a source GeomVertexFormat, converts it if
49 // necessary to the appropriate format for rendering.
50 ////////////////////////////////////////////////////////////////////
51 CPT(GeomVertexFormat) TinyGeomMunger::
52 munge_format_impl(const GeomVertexFormat *orig,
53  const GeomVertexAnimationSpec &animation) {
54  PT(GeomVertexFormat) new_format = new GeomVertexFormat(*orig);
55  new_format->set_animation(animation);
56 
57  CPT(GeomVertexFormat) format = GeomVertexFormat::register_format(new_format);
58 
59  return format;
60 }
61 
62 ////////////////////////////////////////////////////////////////////
63 // Function: TinyGeomMunger::premunge_format_impl
64 // Access: Protected, Virtual
65 // Description: Given a source GeomVertexFormat, converts it if
66 // necessary to the appropriate format for rendering.
67 ////////////////////////////////////////////////////////////////////
68 CPT(GeomVertexFormat) TinyGeomMunger::
69 premunge_format_impl(const GeomVertexFormat *orig) {
70  return orig;
71 }
72 
73 ////////////////////////////////////////////////////////////////////
74 // Function: TinyGeomMunger::compare_to_impl
75 // Access: Protected, Virtual
76 // Description: Called to compare two GeomMungers who are known to be
77 // of the same type, for an apples-to-apples comparison.
78 // This will never be called on two pointers of a
79 // different type.
80 ////////////////////////////////////////////////////////////////////
81 int TinyGeomMunger::
82 compare_to_impl(const GeomMunger *other) const {
83  return StandardMunger::compare_to_impl(other);
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function: TinyGeomMunger::geom_compare_to_impl
88 // Access: Protected, Virtual
89 // Description: Called to compare two GeomMungers who are known to be
90 // of the same type, for an apples-to-apples comparison.
91 // This will never be called on two pointers of a
92 // different type.
93 ////////////////////////////////////////////////////////////////////
94 int TinyGeomMunger::
95 geom_compare_to_impl(const GeomMunger *other) const {
96  return StandardMunger::compare_to_impl(other);
97 }
This object describes how the vertex animation, if any, represented in a GeomVertexData is encoded...
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 specialization on GeomMunger finesses vertices for TinyPanda rendering.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
Encapsulates all the communication with a particular instance of a given rendering backend...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85