Browse Source

make interfaces to move raw texture and vertex data through Python as strings

David Rose 19 years ago
parent
commit
c3303c70b2

+ 50 - 0
panda/src/express/datagram.I

@@ -410,6 +410,56 @@ get_length() const {
   return _data.size();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: Datagram::set_array
+//       Access: Public
+//  Description: Replaces the data in the Datagram with the data in
+//               the indicated PTA_uchar.  This is assignment by
+//               reference: subsequent changes to the Datagram will
+//               also change the source PTA_uchar.
+////////////////////////////////////////////////////////////////////
+INLINE void Datagram::
+set_array(PTA_uchar data) {
+  _data = data;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Datagram::copy_array
+//       Access: Public
+//  Description: Replaces the data in the Datagram with a copy of the
+//               data in the indicated CPTA_uchar.  Unlike
+//               set_array(), a complete copy is made of the data;
+//               subsequent changes to the Datagram will *not* change
+//               the source CPTA_uchar.
+////////////////////////////////////////////////////////////////////
+INLINE void Datagram::
+copy_array(CPTA_uchar data) {
+  _data.clear();
+  _data.v() = data.v();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Datagram::get_array
+//       Access: Public
+//  Description: Returns a const pointer to the actual data in
+//               the Datagram.
+////////////////////////////////////////////////////////////////////
+INLINE CPTA_uchar Datagram::
+get_array() const {
+  return _data;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Datagram::modify_array
+//       Access: Public
+//  Description: Returns a modifiable pointer to the actual data in
+//               the Datagram.
+////////////////////////////////////////////////////////////////////
+INLINE PTA_uchar Datagram::
+modify_array() {
+  return _data;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: Datagram::operator ==
 //       Access: Public

+ 5 - 0
panda/src/express/datagram.h

@@ -95,6 +95,11 @@ PUBLISHED:
   INLINE const void *get_data() const;
   INLINE size_t get_length() const;
 
+  INLINE void set_array(PTA_uchar data);
+  INLINE void copy_array(CPTA_uchar data);
+  INLINE CPTA_uchar get_array() const;
+  INLINE PTA_uchar modify_array();
+
   INLINE bool operator == (const Datagram &other) const;
   INLINE bool operator != (const Datagram &other) const;
   INLINE bool operator < (const Datagram &other) const;

+ 1 - 1
panda/src/gobj/geomVertexArrayData.I

@@ -102,7 +102,7 @@ get_modified() const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomVertexArrayData::get_data
-//       Access: Public
+//       Access: Published
 //  Description: Returns a const pointer to the actual vertex data,
 //               for application code to directly examine (but not
 //               modify).

+ 2 - 2
panda/src/gobj/geomVertexArrayData.cxx

@@ -204,7 +204,7 @@ write(ostream &out, int indent_level) const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomVertexArrayData::modify_data
-//       Access: Public
+//       Access: Published
 //  Description: Returns a modifiable pointer to the actual vertex
 //               array, so that application code may directly
 //               manipulate it.  Use with caution.
@@ -232,7 +232,7 @@ modify_data() {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: GeomVertexArrayData::set_data
-//       Access: Public
+//       Access: Published
 //  Description: Replaces the vertex data array with a completely new
 //               array.
 //

+ 1 - 2
panda/src/gobj/geomVertexArrayData.h

@@ -85,14 +85,13 @@ PUBLISHED:
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
 
-public:
   INLINE CPTA_uchar get_data() const;
   PTA_uchar modify_data();
   void set_data(CPTA_uchar data);
 
+public:
   void prepare(PreparedGraphicsObjects *prepared_objects);
 
-public:
   VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, 
                                    GraphicsStateGuardianBase *gsg);
   bool release(PreparedGraphicsObjects *prepared_objects);