Panda3D
dxGeomMunger9.h
1 // Filename: dxGeomMunger9.h
2 // Created by: drose (11Mar05)
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 DXGEOMMUNGER9_H
16 #define DXGEOMMUNGER9_H
17 
18 #include "pandabase.h"
19 #include "standardMunger.h"
20 #include "graphicsStateGuardian.h"
21 #include "weakPointerTo.h"
22 #include "weakPointerCallback.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : DXGeomMunger9
26 // Description : This specialization on GeomMunger finesses vertices
27 // for DirectX rendering. In particular, it makes sure
28 // colors are stored in DirectX's packed_argb format,
29 // and that all relevant components are packed into a
30 // single array, in the correct order.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDADX DXGeomMunger9 : public StandardMunger, public WeakPointerCallback {
33 public:
34  INLINE DXGeomMunger9(GraphicsStateGuardian *gsg, const RenderState *state);
35  virtual ~DXGeomMunger9();
36  ALLOC_DELETED_CHAIN(DXGeomMunger9);
37 
38  virtual void wp_callback(void *);
39 
40 protected:
41  virtual CPT(GeomVertexFormat) munge_format_impl(const GeomVertexFormat *orig,
42  const GeomVertexAnimationSpec &animation);
43  virtual CPT(GeomVertexFormat) premunge_format_impl(const GeomVertexFormat *orig);
44 
45  virtual int compare_to_impl(const GeomMunger *other) const;
46  virtual int geom_compare_to_impl(const GeomMunger *other) const;
47 
48 private:
49  WCPT(TextureAttrib) _texture;
50  WCPT(TexGenAttrib) _tex_gen;
51 
52  // This pointer is derived from _texture, above. In the case that
53  // it is a different pointer, we maintain its reference count
54  // explicitly. If it is the same pointer, we don't reference count
55  // it at all (so we won't hold on to the reference count
56  // unnecessarily).
57  const TextureAttrib *_filtered_texture;
58  bool _reffed_filtered_texture;
59 
60  static GeomMunger *_deleted_chain;
61 
62 public:
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  StandardMunger::init_type();
68  register_type(_type_handle, "DXGeomMunger9",
69  StandardMunger::get_class_type());
70  }
71  virtual TypeHandle get_type() const {
72  return get_class_type();
73  }
74  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
75 
76 private:
77  static TypeHandle _type_handle;
78 };
79 
80 #include "dxGeomMunger9.I"
81 
82 #endif
83 
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.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Definition: textureAttrib.h:34
Derive from this class and override the callback() method if you want to get an immediate callback fr...
This specialization on GeomMunger finesses vertices for DirectX rendering.
Definition: dxGeomMunger9.h:32
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
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
Definition: texGenAttrib.h:36