00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef INDEXBUFFERCONTEXT_H
00016 #define INDEXBUFFERCONTEXT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "bufferContext.h"
00021 #include "geomPrimitive.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 IndexBufferContext : public BufferContext, public AdaptiveLruPage {
00037 public:
00038 INLINE IndexBufferContext(PreparedGraphicsObjects *pgo, GeomPrimitive *data);
00039
00040 PUBLISHED:
00041 INLINE GeomPrimitive *get_data() const;
00042
00043 INLINE bool changed_size(const GeomPrimitivePipelineReader *reader) const;
00044 INLINE bool changed_usage_hint(const GeomPrimitivePipelineReader *reader) const;
00045 INLINE bool was_modified(const GeomPrimitivePipelineReader *reader) const;
00046
00047 public:
00048 INLINE void update_data_size_bytes(size_t new_data_size_bytes);
00049 INLINE void mark_loaded(const GeomPrimitivePipelineReader *reader);
00050 INLINE void mark_unloaded();
00051
00052 virtual void output(ostream &out) const;
00053 virtual void write(ostream &out, int indent_level) const;
00054
00055 private:
00056
00057
00058
00059 GeomPrimitive *_data;
00060 GeomEnums::UsageHint _usage_hint;
00061
00062 public:
00063 static TypeHandle get_class_type() {
00064 return _type_handle;
00065 }
00066 static void init_type() {
00067 BufferContext::init_type();
00068 register_type(_type_handle, "IndexBufferContext",
00069 BufferContext::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 friend class PreparedGraphicsObjects;
00080 };
00081
00082 inline ostream &operator << (ostream &out, const IndexBufferContext &context) {
00083 context.output(out);
00084 return out;
00085 }
00086
00087 #include "indexBufferContext.I"
00088
00089 #endif
00090