Panda3D
|
00001 // Filename: geomVertexRewriter.h 00002 // Created by: drose (28Mar05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef GEOMVERTEXREWRITER_H 00016 #define GEOMVERTEXREWRITER_H 00017 00018 #include "pandabase.h" 00019 #include "geomVertexReader.h" 00020 #include "geomVertexWriter.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : GeomVertexRewriter 00024 // Description : This object provides the functionality of both a 00025 // GeomVertexReader and a GeomVertexWriter, combined 00026 // together into one convenient package. It is designed 00027 // for making a single pass over a GeomVertexData 00028 // object, modifying rows as it goes. 00029 // 00030 // Although it doesn't provide any real performance 00031 // benefit over using a separate reader and writer on 00032 // the same data, it should probably be used in 00033 // preference to a separate reader and writer, because 00034 // it makes an effort to manage the reference counts 00035 // properly between the reader and the writer to avoid 00036 // accidentally dereferencing either array while 00037 // recopying. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_PANDA_GOBJ GeomVertexRewriter : public GeomVertexWriter, public GeomVertexReader { 00040 PUBLISHED: 00041 INLINE GeomVertexRewriter(Thread *current_thread = Thread::get_current_thread()); 00042 INLINE GeomVertexRewriter(GeomVertexData *vertex_data, Thread *current_thread = Thread::get_current_thread()); 00043 INLINE GeomVertexRewriter(GeomVertexData *vertex_data, 00044 const string &name, Thread *current_thread = Thread::get_current_thread()); 00045 INLINE GeomVertexRewriter(GeomVertexData *vertex_data, 00046 const InternalName *name, Thread *current_thread = Thread::get_current_thread()); 00047 INLINE GeomVertexRewriter(GeomVertexArrayData *array_data, Thread *current_thread = Thread::get_current_thread()); 00048 INLINE GeomVertexRewriter(GeomVertexArrayData *array_data, 00049 int column, Thread *current_thread = Thread::get_current_thread()); 00050 INLINE GeomVertexRewriter(const GeomVertexRewriter ©); 00051 INLINE void operator = (const GeomVertexRewriter ©); 00052 INLINE ~GeomVertexRewriter(); 00053 00054 INLINE GeomVertexData *get_vertex_data() const; 00055 INLINE GeomVertexArrayData *get_array_data() const; 00056 INLINE GeomVertexArrayDataHandle *get_array_handle() const; 00057 INLINE size_t get_stride() const; 00058 INLINE Thread *get_current_thread() const; 00059 00060 INLINE bool set_column(int column); 00061 INLINE bool set_column(const string &name); 00062 INLINE bool set_column(const InternalName *name); 00063 INLINE bool set_column(int array, const GeomVertexColumn *column); 00064 00065 INLINE void clear(); 00066 INLINE bool has_column() const; 00067 INLINE int get_array() const; 00068 INLINE const GeomVertexColumn *get_column() const; 00069 00070 INLINE void set_row_unsafe(int row); 00071 INLINE void set_row(int row); 00072 00073 INLINE int get_start_row() const; 00074 INLINE bool is_at_end() const; 00075 00076 void output(ostream &out) const; 00077 }; 00078 00079 INLINE ostream & 00080 operator << (ostream &out, const GeomVertexRewriter &rewriter) { 00081 rewriter.output(out); 00082 return out; 00083 } 00084 00085 #include "geomVertexRewriter.I" 00086 00087 #endif