Browse Source

changed_usage_hint()

David Rose 20 years ago
parent
commit
fba33cb9cf

+ 12 - 0
panda/src/gobj/indexBufferContext.I

@@ -66,6 +66,17 @@ changed_size() const {
   return get_data_size_bytes() != _data->get_data_size_bytes();
   return get_data_size_bytes() != _data->get_data_size_bytes();
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: IndexBufferContext::changed_usage_hint
+//       Access: Public
+//  Description: Returns true if the data has changed its usage hint
+//               since the last time mark_loaded() was called.
+////////////////////////////////////////////////////////////////////
+INLINE bool IndexBufferContext::
+changed_usage_hint() const {
+  return _usage_hint != _data->get_usage_hint();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: IndexBufferContext::was_modified
 //     Function: IndexBufferContext::was_modified
 //       Access: Public
 //       Access: Public
@@ -87,5 +98,6 @@ was_modified() const {
 INLINE void IndexBufferContext::
 INLINE void IndexBufferContext::
 mark_loaded() {
 mark_loaded() {
   _data_size_bytes = _data->get_data_size_bytes();
   _data_size_bytes = _data->get_data_size_bytes();
+  _usage_hint = _data->get_usage_hint();
   _modified = _data->get_modified();
   _modified = _data->get_modified();
 }
 }

+ 2 - 0
panda/src/gobj/indexBufferContext.h

@@ -44,6 +44,7 @@ public:
 
 
   INLINE int get_data_size_bytes() const;
   INLINE int get_data_size_bytes() const;
   INLINE bool changed_size() const;
   INLINE bool changed_size() const;
+  INLINE bool changed_usage_hint() const;
   INLINE bool was_modified() const;
   INLINE bool was_modified() const;
 
 
   INLINE void mark_loaded();
   INLINE void mark_loaded();
@@ -55,6 +56,7 @@ private:
   qpGeomPrimitive *_data;
   qpGeomPrimitive *_data;
   UpdateSeq _modified;
   UpdateSeq _modified;
   int _data_size_bytes;
   int _data_size_bytes;
+  qpGeomEnums::UsageHint _usage_hint;
 
 
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {

+ 2 - 2
panda/src/gobj/qpgeomEnums.h

@@ -199,8 +199,8 @@ PUBLISHED:
 
 
 };
 };
 
 
-ostream &operator << (ostream &out, qpGeomEnums::NumericType numeric_type);
-ostream &operator << (ostream &out, qpGeomEnums::Contents contents);
+EXPCL_PANDA ostream &operator << (ostream &out, qpGeomEnums::NumericType numeric_type);
+EXPCL_PANDA ostream &operator << (ostream &out, qpGeomEnums::Contents contents);
 
 
 #endif
 #endif
 
 

+ 2 - 2
panda/src/gobj/qpgeomVertexReader.I

@@ -404,9 +404,9 @@ inc_pointer() {
   nassertr(_pointer < _pointer_end, empty_buffer);
   nassertr(_pointer < _pointer_end, empty_buffer);
   if (_vertex_data != (const qpGeomVertexData *)NULL){ 
   if (_vertex_data != (const qpGeomVertexData *)NULL){ 
     const qpGeomVertexArrayData *array_data = _vertex_data->get_array(_array);
     const qpGeomVertexArrayData *array_data = _vertex_data->get_array(_array);
-    nassertr(_pointer >= array_data->get_data() && _pointer < array_data->get_data() + array_data->get_data_size_bytes(), empty_buffer);
+    nassertr(_pointer >= array_data->get_data().p() && _pointer < array_data->get_data().p() + array_data->get_data_size_bytes(), empty_buffer);
   } else {
   } else {
-    nassertr(_pointer >= _array_data->get_data() && _pointer < _array_data->get_data() + _array_data->get_data_size_bytes(), empty_buffer);
+    nassertr(_pointer >= _array_data->get_data().p() && _pointer < _array_data->get_data().p() + _array_data->get_data_size_bytes(), empty_buffer);
   }
   }
 #endif
 #endif
 
 

+ 2 - 2
panda/src/gobj/qpgeomVertexWriter.I

@@ -709,9 +709,9 @@ inc_pointer() {
   nassertr(_pointer < _pointer_end, empty_buffer);
   nassertr(_pointer < _pointer_end, empty_buffer);
   if (_vertex_data != (qpGeomVertexData *)NULL){ 
   if (_vertex_data != (qpGeomVertexData *)NULL){ 
     const qpGeomVertexArrayData *array_data = _vertex_data->get_array(_array);
     const qpGeomVertexArrayData *array_data = _vertex_data->get_array(_array);
-    nassertr(_pointer >= array_data->get_data() && _pointer < array_data->get_data() + array_data->get_data_size_bytes(), empty_buffer);
+    nassertr(_pointer >= array_data->get_data().p() && _pointer < array_data->get_data().p() + array_data->get_data_size_bytes(), empty_buffer);
   } else {
   } else {
-    nassertr(_pointer >= _array_data->get_data() && _pointer < _array_data->get_data() + _array_data->get_data_size_bytes(), empty_buffer);
+    nassertr(_pointer >= _array_data->get_data().p() && _pointer < _array_data->get_data().p() + _array_data->get_data_size_bytes(), empty_buffer);
   }
   }
 #endif
 #endif
 
 

+ 12 - 0
panda/src/gobj/vertexBufferContext.I

@@ -66,6 +66,17 @@ changed_size() const {
   return get_data_size_bytes() != _data->get_data_size_bytes();
   return get_data_size_bytes() != _data->get_data_size_bytes();
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: VertexBufferContext::changed_usage_hint
+//       Access: Public
+//  Description: Returns true if the data has changed its usage hint
+//               since the last time mark_loaded() was called.
+////////////////////////////////////////////////////////////////////
+INLINE bool VertexBufferContext::
+changed_usage_hint() const {
+  return _usage_hint != _data->get_usage_hint();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: VertexBufferContext::was_modified
 //     Function: VertexBufferContext::was_modified
 //       Access: Public
 //       Access: Public
@@ -87,5 +98,6 @@ was_modified() const {
 INLINE void VertexBufferContext::
 INLINE void VertexBufferContext::
 mark_loaded() {
 mark_loaded() {
   _data_size_bytes = _data->get_data_size_bytes();
   _data_size_bytes = _data->get_data_size_bytes();
+  _usage_hint = _data->get_usage_hint();
   _modified = _data->get_modified();
   _modified = _data->get_modified();
 }
 }

+ 2 - 0
panda/src/gobj/vertexBufferContext.h

@@ -44,6 +44,7 @@ public:
 
 
   INLINE int get_data_size_bytes() const;
   INLINE int get_data_size_bytes() const;
   INLINE bool changed_size() const;
   INLINE bool changed_size() const;
+  INLINE bool changed_usage_hint() const;
   INLINE bool was_modified() const;
   INLINE bool was_modified() const;
 
 
   INLINE void mark_loaded();
   INLINE void mark_loaded();
@@ -55,6 +56,7 @@ private:
   qpGeomVertexArrayData *_data;
   qpGeomVertexArrayData *_data;
   UpdateSeq _modified;
   UpdateSeq _modified;
   int _data_size_bytes;
   int _data_size_bytes;
+  qpGeomEnums::UsageHint _usage_hint;
 
 
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {