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 00057 INLINE bool set_column(int column); 00058 INLINE bool set_column(const string &name); 00059 INLINE bool set_column(const InternalName *name); 00060 INLINE bool set_column(int array, const GeomVertexColumn *column); 00061 00062 INLINE void clear(); 00063 INLINE bool has_column() const; 00064 INLINE int get_array() const; 00065 INLINE const GeomVertexColumn *get_column() const; 00066 00067 INLINE void set_row(int row); 00068 00069 INLINE int get_start_row() const; 00070 INLINE bool is_at_end() const; 00071 00072 void output(ostream &out) const; 00073 }; 00074 00075 INLINE ostream & 00076 operator << (ostream &out, const GeomVertexRewriter &rewriter) { 00077 rewriter.output(out); 00078 return out; 00079 } 00080 00081 #include "geomVertexRewriter.I" 00082 00083 #endif