00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef VERTEXBUFFERCONTEXT_H
00016 #define VERTEXBUFFERCONTEXT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "bufferContext.h"
00021 #include "geomVertexArrayData.h"
00022 #include "preparedGraphicsObjects.h"
00023 #include "adaptiveLru.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDA_GOBJ VertexBufferContext : public BufferContext, public AdaptiveLruPage {
00037 public:
00038 INLINE VertexBufferContext(PreparedGraphicsObjects *pgo,
00039 GeomVertexArrayData *data);
00040
00041 PUBLISHED:
00042 INLINE GeomVertexArrayData *get_data() const;
00043
00044 INLINE bool changed_size(const GeomVertexArrayDataHandle *reader) const;
00045 INLINE bool changed_usage_hint(const GeomVertexArrayDataHandle *reader) const;
00046 INLINE bool was_modified(const GeomVertexArrayDataHandle *reader) const;
00047
00048 public:
00049 INLINE void update_data_size_bytes(size_t new_data_size_bytes);
00050 INLINE void mark_loaded(const GeomVertexArrayDataHandle *reader);
00051 INLINE void mark_unloaded();
00052
00053 virtual void output(ostream &out) const;
00054 virtual void write(ostream &out, int indent_level) const;
00055
00056 private:
00057
00058
00059
00060 GeomVertexArrayData *_data;
00061 GeomEnums::UsageHint _usage_hint;
00062
00063 public:
00064 static TypeHandle get_class_type() {
00065 return _type_handle;
00066 }
00067 static void init_type() {
00068 BufferContext::init_type();
00069 register_type(_type_handle, "VertexBufferContext",
00070 BufferContext::get_class_type());
00071 }
00072 virtual TypeHandle get_type() const {
00073 return get_class_type();
00074 }
00075 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00076
00077 private:
00078 static TypeHandle _type_handle;
00079
00080 friend class PreparedGraphicsObjects;
00081 };
00082
00083 inline ostream &operator << (ostream &out, const VertexBufferContext &context) {
00084 context.output(out);
00085 return out;
00086 }
00087
00088 #include "vertexBufferContext.I"
00089
00090 #endif
00091