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