Panda3D

dxVertexBufferContext9.h

00001 // Filename: dxVertexBufferContext9.h
00002 // Created by:  drose (18Mar05)
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 DXVERTEXBUFFERCONTEXT9_H
00016 #define DXVERTEXBUFFERCONTEXT9_H
00017 
00018 #include "pandabase.h"
00019 #include "dxgsg9base.h"
00020 #include "vertexBufferContext.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : DXVertexBufferContext9
00024 // Description : Caches a GeomVertexArrayData in the DirectX device as
00025 //               a vertex buffer.
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDADX DXVertexBufferContext9 : public VertexBufferContext {
00028 public:
00029   DXVertexBufferContext9(PreparedGraphicsObjects *pgo, GeomVertexArrayData *data, DXScreenData &scrn);
00030   virtual ~DXVertexBufferContext9();
00031 
00032   virtual void evict_lru();
00033 
00034   void free_vbuffer();
00035   void allocate_vbuffer(DXScreenData &scrn, const GeomVertexArrayDataHandle *reader);
00036   void create_vbuffer(DXScreenData &scrn, const GeomVertexArrayDataHandle *reader, string name);
00037   bool upload_data(const GeomVertexArrayDataHandle *reader, bool force);
00038 
00039   IDirect3DVertexBuffer9 *_vbuffer;
00040   int _fvf;
00041 
00042   int _managed;
00043 
00044   VERTEX_ELEMENT_TYPE *_vertex_element_type_array;
00045   DIRECT_3D_VERTEX_DECLARATION _direct_3d_vertex_declaration;
00046   CLP(ShaderContext) *_shader_context;
00047 
00048 public:
00049   static TypeHandle get_class_type() {
00050     return _type_handle;
00051   }
00052   static void init_type() {
00053     VertexBufferContext::init_type();
00054     register_type(_type_handle, "DXVertexBufferContext9",
00055                   VertexBufferContext::get_class_type());
00056   }
00057   virtual TypeHandle get_type() const {
00058     return get_class_type();
00059   }
00060   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00061 
00062 private:
00063   static TypeHandle _type_handle;
00064 };
00065 
00066 #include "dxVertexBufferContext9.I"
00067 
00068 #endif
 All Classes Functions Variables Enumerations