dataContext.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Filename: dataContext.h
  2. // Created by: drose (17Mar05)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef DATACONTEXT_H
  19. #define DATACONTEXT_H
  20. #include "pandabase.h"
  21. #include "savedContext.h"
  22. #include "updateSeq.h"
  23. class qpGeomVertexArrayData;
  24. ////////////////////////////////////////////////////////////////////
  25. // Class : DataContext
  26. // Description : This is a special class object that holds all the
  27. // information returned by a particular GSG to indicate
  28. // the vertex data array's internal context identifier.
  29. //
  30. // This allows the GSG to cache the vertex data array in
  31. // whatever way makes sense. For instance, DirectX can
  32. // allocate a vertex buffer for the array. OpenGL can
  33. // create a buffer object.
  34. ////////////////////////////////////////////////////////////////////
  35. class EXPCL_PANDA DataContext : public SavedContext {
  36. public:
  37. INLINE DataContext(qpGeomVertexArrayData *data);
  38. // This cannot be a PT(qpGeomVertexArrayData), because the data and
  39. // the GSG both own their DataContexts! That would create a
  40. // circular reference count.
  41. qpGeomVertexArrayData *_data;
  42. UpdateSeq _modified;
  43. public:
  44. static TypeHandle get_class_type() {
  45. return _type_handle;
  46. }
  47. static void init_type() {
  48. SavedContext::init_type();
  49. register_type(_type_handle, "DataContext",
  50. SavedContext::get_class_type());
  51. }
  52. virtual TypeHandle get_type() const {
  53. return get_class_type();
  54. }
  55. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  56. private:
  57. static TypeHandle _type_handle;
  58. };
  59. #include "dataContext.I"
  60. #endif