Panda3D
 All Classes Functions Variables Enumerations
colladaInput.h
1 // Filename: colladaInput.h
2 // Created by: rdb (23May11)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef COLLADAINPUT_H
16 #define COLLADAINPUT_H
17 
18 #include "config_collada.h"
19 #include "referenceCount.h"
20 #include "pvector.h"
21 #include "pta_LVecBase4.h"
22 #include "internalName.h"
23 #include "geomEnums.h"
24 
25 class GeomPrimitive;
26 class GeomVertexArrayFormat;
27 class GeomVertexData;
28 
29 #if PANDA_COLLADA_VERSION < 15
30 #define domInput_local domInputLocal
31 #define domInput_localRef domInputLocalRef
32 #define domInput_local_offset domInputLocalOffset
33 #define domInput_local_offsetRef domInputLocalOffsetRef
34 #endif
35 
36 class domInput_local;
37 class domInput_local_offset;
38 class domP;
39 class domSource;
40 
41 ////////////////////////////////////////////////////////////////////
42 // Class : ColladaInput
43 // Description : Class that deals with COLLADA data sources.
44 ////////////////////////////////////////////////////////////////////
45 class ColladaInput : public ReferenceCount {
46 public:
47  static ColladaInput *from_dom(domInput_local_offset &input);
48  static ColladaInput *from_dom(domInput_local &input);
49 
50  int make_vertex_columns(GeomVertexArrayFormat *fmt) const;
51  void write_data(GeomVertexData *vdata, int start_row, domP &p, unsigned int stride) const;
52 
53  INLINE bool is_vertex_source() const;
54  INLINE unsigned int get_offset() const;
55 
56 private:
57  ColladaInput(const string &semantic);
58  ColladaInput(const string &semantic, unsigned int set);
59  bool read_data(domSource &source);
60  void write_data(GeomVertexData *vdata, int start_row, domP &p, unsigned int stride, unsigned int offset) const;
61 
63  Inputs _vertex_inputs;
64  PTA_LVecBase4f _data;
65 
66  // Only filled in when appropriate.
67  PT(InternalName) _column_name;
68  GeomEnums::Contents _column_contents;
69 
70  unsigned int _num_bound_params;
71  unsigned int _offset;
72  string _semantic;
73  bool _have_set;
74  unsigned int _set;
75 };
76 
77 #include "colladaInput.I"
78 
79 #endif
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:63
Class that deals with COLLADA data sources.
Definition: colladaInput.h:45
int make_vertex_columns(GeomVertexArrayFormat *fmt) const
Takes a semantic and source URI, and adds a new column to the format.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A base class for all things that want to be reference-counted.
unsigned int get_offset() const
Returns the offset associated with this input.
Definition: colladaInput.I:31
void write_data(GeomVertexData *vdata, int start_row, domP &p, unsigned int stride) const
Writes data to the indicated GeomVertexData using the given indices.
bool is_vertex_source() const
Returns true if this has a &lt;vertices&gt; element as source.
Definition: colladaInput.I:22
static ColladaInput * from_dom(domInputLocalOffset &input)
Returns the ColladaInput object that represents the provided DOM input element.