Panda3D
|
00001 // Filename: colladaPrimitive.h 00002 // Created by: rdb (23May11) 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 COLLADAPRIMITIVE_H 00016 #define COLLADAPRIMITIVE_H 00017 00018 #include "config_collada.h" 00019 #include "referenceCount.h" 00020 #include "geomVertexData.h" 00021 #include "geom.h" 00022 #include "geomPrimitive.h" 00023 00024 #include "colladaInput.h" 00025 00026 class domP; 00027 class domLines; 00028 class domLinestrips; 00029 class domPolygons; 00030 class domPolylist; 00031 class domTriangles; 00032 class domTrifans; 00033 class domTristrips; 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Class : ColladaPrimitive 00037 // Description : Class that deals with COLLADA primitive structures, 00038 // such as <triangles> and <polylist>. 00039 //////////////////////////////////////////////////////////////////// 00040 class ColladaPrimitive : public ReferenceCount { 00041 public: 00042 static ColladaPrimitive *from_dom(domLines &lines); 00043 static ColladaPrimitive *from_dom(domLinestrips &linestrips); 00044 static ColladaPrimitive *from_dom(domPolygons &polygons); 00045 static ColladaPrimitive *from_dom(domPolylist &polylist); 00046 static ColladaPrimitive *from_dom(domTriangles &triangles); 00047 static ColladaPrimitive *from_dom(domTrifans &trifans); 00048 static ColladaPrimitive *from_dom(domTristrips &tristrips); 00049 00050 unsigned int write_data(GeomVertexData *vdata, int start_row, domP &p); 00051 00052 INLINE PT(Geom) get_geom() const; 00053 INLINE const string &get_material() const; 00054 00055 private: 00056 ColladaPrimitive(GeomPrimitive *prim, daeTArray<daeSmartRef<domInput_local_offset> > &inputs); 00057 void load_primitive(domP &p); 00058 void load_primitives(daeTArray<daeSmartRef<domP> > &p_array); 00059 INLINE void add_input(ColladaInput *input); 00060 00061 typedef pvector<PT(ColladaInput)> Inputs; 00062 Inputs _inputs; 00063 00064 unsigned int _stride; 00065 PT(Geom) _geom; 00066 PT(GeomVertexData) _vdata; 00067 PT(GeomPrimitive) _gprim; 00068 string _material; 00069 }; 00070 00071 #include "colladaPrimitive.I" 00072 00073 #endif