15 #ifndef GEOMVERTEXFORMAT_H
16 #define GEOMVERTEXFORMAT_H
18 #include "pandabase.h"
19 #include "typedWritableReferenceCount.h"
20 #include "geomVertexAnimationSpec.h"
21 #include "geomVertexArrayFormat.h"
22 #include "geomEnums.h"
23 #include "internalName.h"
25 #include "pointerTo.h"
29 #include "indirectCompareTo.h"
30 #include "lightReMutex.h"
64 GeomVertexFormat(
const GeomVertexArrayFormat *array_format);
65 GeomVertexFormat(
const GeomVertexFormat ©);
66 void operator = (
const GeomVertexFormat ©);
67 virtual ~GeomVertexFormat();
69 virtual bool unref()
const;
71 INLINE
bool is_registered()
const;
72 INLINE
static CPT(GeomVertexFormat) register_format(const GeomVertexFormat *format);
73 INLINE static CPT(GeomVertexFormat) register_format(const GeomVertexArrayFormat *format);
78 CPT(GeomVertexFormat) get_post_animated_format() const;
79 CPT(GeomVertexFormat) get_union_format(const GeomVertexFormat *other) const;
81 INLINE
int get_num_arrays() const;
82 INLINE const GeomVertexArrayFormat *get_array(
int array) const;
83 MAKE_SEQ(get_arrays, get_num_arrays, get_array);
84 GeomVertexArrayFormat *modify_array(
int array);
85 void set_array(
int array, const GeomVertexArrayFormat *format);
86 void remove_array(
int array);
87 int add_array(const GeomVertexArrayFormat *array_format);
88 void insert_array(
int array, const GeomVertexArrayFormat *array_format);
90 void remove_empty_arrays();
92 int get_num_columns() const;
93 int get_array_with(
int i) const;
96 int get_array_with(const InternalName *name) const;
98 INLINE
bool has_column(const InternalName *name) const;
100 MAKE_SEQ(get_columns, get_num_columns, get_column);
102 void remove_column(const InternalName *name,
bool keep_empty_array = false);
104 void align_columns_for_animation();
105 void maybe_align_columns_for_animation();
107 INLINE
int get_num_points() const;
108 INLINE const InternalName *get_point(
int n) const;
109 MAKE_SEQ(get_points, get_num_points, get_point);
111 INLINE
int get_num_vectors() const;
112 INLINE const InternalName *get_vector(
int n) const;
113 MAKE_SEQ(get_vectors, get_num_vectors, get_vector);
115 INLINE
int get_num_texcoords() const;
116 INLINE const InternalName *get_texcoord(
int n) const;
117 MAKE_SEQ(get_texcoords, get_num_texcoords, get_texcoord);
119 INLINE
int get_num_morphs() const;
120 INLINE const InternalName *get_morph_slider(
int n) const;
121 INLINE const InternalName *get_morph_base(
int n) const;
122 INLINE const InternalName *get_morph_delta(
int n) const;
123 MAKE_SEQ(get_morph_sliders, get_num_morphs, get_morph_slider);
124 MAKE_SEQ(get_morph_bases, get_num_morphs, get_morph_base);
125 MAKE_SEQ(get_morph_deltas, get_num_morphs, get_morph_delta);
127 void output(ostream &out) const;
128 void write(ostream &out,
int indent_level = 0) const;
129 void write_with_data(ostream &out,
int indent_level,
136 INLINE static const GeomVertexFormat *get_v3();
137 INLINE static const GeomVertexFormat *get_v3n3();
138 INLINE static const GeomVertexFormat *get_v3t2();
139 INLINE static const GeomVertexFormat *get_v3n3t2();
146 INLINE static const GeomVertexFormat *get_v3cp();
147 INLINE static const GeomVertexFormat *get_v3cpt2();
148 INLINE static const GeomVertexFormat *get_v3n3cp();
149 INLINE static const GeomVertexFormat *get_v3n3cpt2();
156 INLINE static const GeomVertexFormat *get_v3c4();
157 INLINE static const GeomVertexFormat *get_v3c4t2();
158 INLINE static const GeomVertexFormat *get_v3n3c4();
159 INLINE static const GeomVertexFormat *get_v3n3c4t2();
162 bool get_array_info(const InternalName *name,
166 INLINE
int get_vertex_array_index() const;
168 INLINE
int get_normal_array_index() const;
170 INLINE
int get_color_array_index() const;
173 int compare_to(const GeomVertexFormat &other) const;
177 INLINE static Registry *get_registry();
178 static
void make_registry();
181 void do_unregister();
187 typedef
pvector< PT(GeomVertexArrayFormat) > Arrays;
190 class DataTypeRecord {
197 DataTypesByName _columns_by_name;
199 int _vertex_array_index;
201 int _normal_array_index;
203 int _color_array_index;
220 const GeomVertexFormat *_post_animated_format;
224 class EXPCL_PANDA_GOBJ Registry {
227 void make_standard_formats();
229 CPT(GeomVertexFormat) register_format(GeomVertexFormat *format);
230 INLINE CPT(GeomVertexFormat) register_format(GeomVertexArrayFormat *format);
231 void unregister_format(GeomVertexFormat *format);
236 CPT(GeomVertexFormat) _v3;
237 CPT(GeomVertexFormat) _v3n3;
238 CPT(GeomVertexFormat) _v3t2;
239 CPT(GeomVertexFormat) _v3n3t2;
241 CPT(GeomVertexFormat) _v3cp;
242 CPT(GeomVertexFormat) _v3n3cp;
243 CPT(GeomVertexFormat) _v3cpt2;
244 CPT(GeomVertexFormat) _v3n3cpt2;
246 CPT(GeomVertexFormat) _v3c4;
247 CPT(GeomVertexFormat) _v3n3c4;
248 CPT(GeomVertexFormat) _v3c4t2;
249 CPT(GeomVertexFormat) _v3n3c4t2;
252 static Registry *_registry;
256 static
void register_with_read_factory();
268 static void init_type() {
269 TypedWritableReferenceCount::init_type();
270 register_type(_type_handle,
"GeomVertexFormat",
271 TypedWritableReferenceCount::get_class_type());
274 return get_class_type();
276 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
281 friend class GeomVertexFormat::Registry;
285 INLINE ostream &operator << (ostream &out,
const GeomVertexFormat &obj);
287 #include "geomVertexFormat.I"
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This object describes how the vertex animation, if any, represented in a GeomVertexData is encoded...
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
Base class for objects that can be written to and read from Bam files.
A lightweight reentrant mutex.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is our own Panda specialization on the default STL list.
This defines how a single column is interleaved within a vertex array stored within a Geom...
This is our own Panda specialization on the default STL vector.
This describes the structure of a single array within a Geom data.
virtual bool unref() const
Explicitly decrements the reference count.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This is our own Panda specialization on the default STL set.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...