Panda3D
|
00001 // Filename: dxGeomMunger8.h 00002 // Created by: drose (11Mar05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DXGEOMMUNGER8_H 00016 #define DXGEOMMUNGER8_H 00017 00018 #include "pandabase.h" 00019 #include "standardMunger.h" 00020 #include "graphicsStateGuardian.h" 00021 #include "weakPointerTo.h" 00022 #include "weakPointerCallback.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : DXGeomMunger8 00026 // Description : This specialization on GeomMunger finesses vertices 00027 // for DirectX rendering. In particular, it makes sure 00028 // colors are stored in DirectX's packed_argb format, 00029 // and that all relevant components are packed into a 00030 // single array, in the correct order. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDADX DXGeomMunger8 : public StandardMunger, public WeakPointerCallback { 00033 public: 00034 INLINE DXGeomMunger8(GraphicsStateGuardian *gsg, const RenderState *state); 00035 virtual ~DXGeomMunger8(); 00036 ALLOC_DELETED_CHAIN(DXGeomMunger8); 00037 00038 virtual void wp_callback(void *); 00039 00040 protected: 00041 virtual CPT(GeomVertexFormat) munge_format_impl(const GeomVertexFormat *orig, 00042 const GeomVertexAnimationSpec &animation); 00043 virtual CPT(GeomVertexFormat) premunge_format_impl(const GeomVertexFormat *orig); 00044 00045 virtual int compare_to_impl(const GeomMunger *other) const; 00046 virtual int geom_compare_to_impl(const GeomMunger *other) const; 00047 00048 private: 00049 WCPT(TextureAttrib) _texture; 00050 WCPT(TexGenAttrib) _tex_gen; 00051 00052 // This pointer is derived from _texture, above. In the case that 00053 // it is a different pointer, we maintain its reference count 00054 // explicitly. If it is the same pointer, we don't reference count 00055 // it at all (so we won't hold on to the reference count 00056 // unnecessarily). 00057 const TextureAttrib *_filtered_texture; 00058 bool _reffed_filtered_texture; 00059 00060 static GeomMunger *_deleted_chain; 00061 00062 public: 00063 static TypeHandle get_class_type() { 00064 return _type_handle; 00065 } 00066 static void init_type() { 00067 StandardMunger::init_type(); 00068 register_type(_type_handle, "DXGeomMunger8", 00069 StandardMunger::get_class_type()); 00070 } 00071 virtual TypeHandle get_type() const { 00072 return get_class_type(); 00073 } 00074 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00075 00076 private: 00077 static TypeHandle _type_handle; 00078 }; 00079 00080 #include "dxGeomMunger8.I" 00081 00082 #endif