00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef VERTEXDATABUFFER_H
00016 #define VERTEXDATABUFFER_H
00017
00018 #include "pandabase.h"
00019 #include "vertexDataBook.h"
00020 #include "vertexDataBlock.h"
00021 #include "pointerTo.h"
00022 #include "virtualFile.h"
00023 #include "pStatCollector.h"
00024 #include "lightMutex.h"
00025 #include "lightMutexHolder.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 class EXPCL_PANDA_GOBJ VertexDataBuffer {
00062 public:
00063 INLINE VertexDataBuffer();
00064 INLINE VertexDataBuffer(size_t size);
00065 INLINE VertexDataBuffer(const VertexDataBuffer ©);
00066 void operator = (const VertexDataBuffer ©);
00067 INLINE ~VertexDataBuffer();
00068
00069 INLINE const unsigned char *get_read_pointer(bool force) const;
00070 INLINE unsigned char *get_write_pointer();
00071
00072 INLINE size_t get_size() const;
00073 INLINE size_t get_reserved_size() const;
00074 INLINE void set_size(size_t size);
00075 INLINE void clean_realloc(size_t reserved_size);
00076 INLINE void unclean_realloc(size_t reserved_size);
00077 INLINE void clear();
00078
00079 INLINE void page_out(VertexDataBook &book);
00080
00081 void swap(VertexDataBuffer &other);
00082
00083 private:
00084 void do_clean_realloc(size_t size);
00085 void do_unclean_realloc(size_t size);
00086
00087 void do_page_out(VertexDataBook &book);
00088 void do_page_in();
00089
00090 unsigned char *_resident_data;
00091 size_t _size;
00092 size_t _reserved_size;
00093 PT(VertexDataBlock) _block;
00094 LightMutex _lock;
00095
00096 public:
00097 static TypeHandle get_class_type() {
00098 return _type_handle;
00099 }
00100 static void init_type() {
00101 register_type(_type_handle, "VertexDataBuffer");
00102 }
00103
00104 private:
00105 static TypeHandle _type_handle;
00106 };
00107
00108 #include "vertexDataBuffer.I"
00109
00110 #endif