00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GEOMVERTEXREADER_H
00016 #define GEOMVERTEXREADER_H
00017
00018 #include "pandabase.h"
00019 #include "geomVertexData.h"
00020 #include "geomVertexColumn.h"
00021 #include "internalName.h"
00022 #include "luse.h"
00023 #include "pointerTo.h"
00024
00025
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 class EXPCL_PANDA_GOBJ GeomVertexReader : public GeomEnums {
00057 PUBLISHED:
00058 INLINE GeomVertexReader(Thread *current_thread = Thread::get_current_thread());
00059 INLINE GeomVertexReader(const GeomVertexData *vertex_data,
00060 Thread *current_thread = Thread::get_current_thread());
00061 INLINE GeomVertexReader(const GeomVertexData *vertex_data,
00062 const string &name,
00063 Thread *current_thread = Thread::get_current_thread());
00064 INLINE GeomVertexReader(const GeomVertexData *vertex_data,
00065 const InternalName *name,
00066 Thread *current_thread = Thread::get_current_thread());
00067 INLINE GeomVertexReader(const GeomVertexArrayData *array_data,
00068 Thread *current_thread = Thread::get_current_thread());
00069 INLINE GeomVertexReader(const GeomVertexArrayData *array_data,
00070 int column,
00071 Thread *current_thread = Thread::get_current_thread());
00072
00073 public:
00074 INLINE GeomVertexReader(const GeomVertexDataPipelineReader *data_reader,
00075 const InternalName *name,
00076 bool force = true);
00077
00078 PUBLISHED:
00079 INLINE GeomVertexReader(const GeomVertexReader ©);
00080 INLINE void operator = (const GeomVertexReader ©);
00081 INLINE ~GeomVertexReader();
00082
00083 INLINE const GeomVertexData *get_vertex_data() const;
00084 INLINE const GeomVertexArrayData *get_array_data() const;
00085 INLINE const GeomVertexArrayDataHandle *get_array_handle() const;
00086 INLINE size_t get_stride() const;
00087 INLINE Thread *get_current_thread() const;
00088
00089 INLINE void set_force(bool force);
00090 INLINE bool get_force() const;
00091
00092 INLINE bool set_column(int column);
00093 INLINE bool set_column(const string &name);
00094 INLINE bool set_column(const InternalName *name);
00095 bool set_column(int array, const GeomVertexColumn *column);
00096
00097 INLINE void clear();
00098 INLINE bool has_column() const;
00099 INLINE int get_array() const;
00100 INLINE const GeomVertexColumn *get_column() const;
00101
00102 INLINE void set_row_unsafe(int row);
00103 INLINE void set_row(int row);
00104
00105 INLINE int get_start_row() const;
00106 INLINE int get_read_row() const;
00107 INLINE bool is_at_end() const;
00108
00109 INLINE float get_data1f();
00110 INLINE const LVecBase2f &get_data2f();
00111 INLINE const LVecBase3f &get_data3f();
00112 INLINE const LVecBase4f &get_data4f();
00113
00114 INLINE double get_data1d();
00115 INLINE const LVecBase2d &get_data2d();
00116 INLINE const LVecBase3d &get_data3d();
00117 INLINE const LVecBase4d &get_data4d();
00118
00119 INLINE PN_stdfloat get_data1();
00120 INLINE const LVecBase2 &get_data2();
00121 INLINE const LVecBase3 &get_data3();
00122 INLINE const LVecBase4 &get_data4();
00123
00124 INLINE int get_data1i();
00125 INLINE const int *get_data2i();
00126 INLINE const int *get_data3i();
00127 INLINE const int *get_data4i();
00128
00129 void output(ostream &out) const;
00130
00131 protected:
00132 INLINE GeomVertexColumn::Packer *get_packer() const;
00133
00134 private:
00135 void initialize();
00136
00137 INLINE bool set_pointer(int row);
00138 INLINE void quick_set_pointer(int row);
00139 INLINE const unsigned char *inc_pointer();
00140
00141 bool set_vertex_column(int array, const GeomVertexColumn *column,
00142 const GeomVertexDataPipelineReader *data_reader);
00143 bool set_array_column(const GeomVertexColumn *column);
00144
00145
00146
00147
00148
00149
00150 CPT(GeomVertexData) _vertex_data;
00151 int _array;
00152 CPT(GeomVertexArrayData) _array_data;
00153
00154 Thread *_current_thread;
00155 GeomVertexColumn::Packer *_packer;
00156 int _stride;
00157
00158 CPT(GeomVertexArrayDataHandle) _handle;
00159 const unsigned char *_pointer_begin;
00160 const unsigned char *_pointer_end;
00161 const unsigned char *_pointer;
00162
00163 int _start_row;
00164 bool _force;
00165
00166 #ifndef NDEBUG
00167
00168
00169 static const unsigned char empty_buffer[100];
00170 #endif
00171 };
00172
00173 INLINE ostream &
00174 operator << (ostream &out, const GeomVertexReader &reader) {
00175 reader.output(out);
00176 return out;
00177 }
00178
00179 #include "geomVertexReader.I"
00180
00181 #endif