1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAMax. 5 6 Portions of the code are: 7 Copyright (c) 2005-2007 Feeling Software Inc. 8 Copyright (c) 2005-2007 Sony Computer Entertainment America 9 10 Based on the 3dsMax COLLADASW Tools: 11 Copyright (c) 2005-2006 Autodesk Media Entertainment 12 13 Licensed under the MIT Open Source License, 14 for details please see LICENSE file or the website 15 http://www.opensource.org/licenses/mit-license.php 16 */ 17 18 19 #ifndef __COLLADAMAX_GEOMETRYEXTRA_H__ 20 #define __COLLADAMAX_GEOMETRYEXTRA_H__ 21 22 #include "COLLADAMaxPrerequisites.h" 23 24 #include "COLLADASWStreamWriter.h" 25 #include "COLLADAMaxExtra.h" 26 27 #include <max.h> 28 29 class Object; 30 31 namespace COLLADAMax 32 { 33 /** Class to export extra tags of geometries. Currently extra tags for primitives 34 like box, sphere... are exported.*/ 35 36 class GeometryExtra : public Extra , public COLLADASW::BaseExtraTechnique 37 { 38 39 private: 40 /** The object which extra tag should be exported.*/ 41 Object * mObject; 42 43 /** The id of the geometry the extra tags are exported for.*/ 44 const String mGeometryId; 45 46 COLLADASW::StreamWriter * mStreamWriter; 47 48 /* Element names of the primitives*/ 49 static const String ELEMENT_BOX; 50 static const String ELEMENT_SPHERE; 51 static const String ELEMENT_CYLINDER; 52 static const String ELEMENT_TORUS; 53 static const String ELEMENT_TEAPOT; 54 static const String ELEMENT_CONE; 55 static const String ELEMENT_TUBE; 56 static const String ELEMENT_GEOSPHERE; 57 static const String ELEMENT_PYRAMID; 58 static const String ELEMENT_PLANE; 59 static const String ELEMENT_HEDRA; 60 static const String ELEMENT_CHAMFERBOX; 61 static const String ELEMENT_OILTANK; 62 static const String ELEMENT_SPINDLE; 63 static const String ELEMENT_GENGON; 64 static const String ELEMENT_RINGWAVE; 65 static const String ELEMENT_PRISM; 66 static const String ELEMENT_TORUSKNOT; 67 static const String ELEMENT_CHAMFERCYL; 68 static const String ELEMENT_CAPSULE; 69 static const String ELEMENT_L_EXT; 70 static const String ELEMENT_C_EXT; 71 static const String ELEMENT_HOSE; 72 static const String ELEMENT_LTYPESTAIR; 73 static const String ELEMENT_STRAIGHTSTAIR; 74 static const String ELEMENT_SPIRALSTAIR; 75 static const String ELEMENT_UTYPESTAIR; 76 77 78 /* Parameter count and parameter list of the primitives extra tags.*/ 79 static const int BOXPARAMETERSCOUNT; 80 static const ExtraParameter BOXPARAMETERS[]; 81 82 static const int SPHEREPARAMETERSCOUNT; 83 static const ExtraParameter SPHEREPARAMETERS[]; 84 85 static const int CYLINDERPARAMETERSCOUNT; 86 static const ExtraParameter CYLINDERPARAMETERS[]; 87 88 static const int TORUSPARAMETERSCOUNT; 89 static const ExtraParameter TORUSPARAMETERS[]; 90 91 static const int TEAPOTPARAMETERSCOUNT; 92 static const ExtraParameter TEAPOTPARAMETERS[]; 93 94 static const int CONEPARAMETERSCOUNT; 95 static const ExtraParameter CONEPARAMETERS[]; 96 97 static const int TUBEPARAMETERSCOUNT; 98 static const ExtraParameter TUBEPARAMETERS[]; 99 100 static const int GEOSPHEREPARAMETERSCOUNT; 101 static const ExtraParameter GEOSPHEREPARAMETERS[]; 102 103 static const int PYRAMIDPARAMETERSCOUNT; 104 static const ExtraParameter PYRAMIDPARAMETERS[]; 105 106 static const int PLANEPARAMETERSCOUNT; 107 static const ExtraParameter PLANEPARAMETERS[]; 108 109 static const int HEDRAPARAMETERSCOUNT; 110 static const ExtraParameter HEDRAPARAMETERS[]; 111 112 static const int CHAMFERBOXPARAMETERSCOUNT; 113 static const ExtraParameter CHAMFERBOXPARAMETERS[]; 114 115 static const int OILTANKPARAMETERSCOUNT; 116 static const ExtraParameter OILTANKPARAMETERS[]; 117 118 static const int SPINDLEPARAMETERSCOUNT; 119 static const ExtraParameter SPINDLEPARAMETERS[]; 120 121 static const int GENGONPARAMETERSCOUNT; 122 static const ExtraParameter GENGONPARAMETERS[]; 123 124 static const int RINGWAVEPARAMETERSCOUNT; 125 static const ExtraParameter RINGWAVEPARAMETERS[]; 126 127 static const int PRISMPARAMETERSCOUNT; 128 static const ExtraParameter PRISMPARAMETERS[]; 129 130 static const int TORUSKNOTPARAMETERSCOUNT; 131 static const ExtraParameter TORUSKNOTPARAMETERS[]; 132 133 static const int CHAMFERCYLPARAMETERSCOUNT; 134 static const ExtraParameter CHAMFERCYLPARAMETERS[]; 135 136 static const int CAPSULEPARAMETERSCOUNT; 137 static const ExtraParameter CAPSULEPARAMETERS[]; 138 139 static const int L_EXTPARAMETERSCOUNT; 140 static const ExtraParameter L_EXTPARAMETERS[]; 141 142 static const int C_EXTPARAMETERSCOUNT; 143 static const ExtraParameter C_EXTPARAMETERS[]; 144 145 static const int HOSEPARAMETERSCOUNT; 146 static const ExtraParameter HOSEPARAMETERS[]; 147 148 static const int LTYPESTAIRPARAMETERSCOUNT; 149 static const ExtraParameter LTYPESTAIRPARAMETERS[]; 150 151 static const int STRAIGHTSTAIRPARAMETERSCOUNT; 152 static const ExtraParameter STRAIGHTSTAIRPARAMETERS[]; 153 154 static const int SPIRALSTAIRPARAMETERSCOUNT; 155 static const ExtraParameter SPIRALSTAIRPARAMETERS[]; 156 157 static const int UTYPESTAIRPARAMETERSCOUNT; 158 static const ExtraParameter UTYPESTAIRPARAMETERS[]; 159 160 161 public: 162 /** Constructor 163 @param streamWriter The stream the extra tags should be written to 164 @param object The object which extra tag should be exported 165 */ 166 GeometryExtra ( COLLADASW::StreamWriter * streamWriter, DocumentExporter * documentExporter, Object * object, const String& geometryId ); 167 168 /** Performs the actual export.*/ 169 void doExport(); 170 171 private: 172 173 /** Exports all known parameters of the parameter block associated with the current object in to an extra tag.*/ 174 void exportParamBlock ( const String & elementName, const ExtraParameter extraParameters[], int extraParametersCount ); 175 176 /** Exports all known parameters of the parameter block 2 associated with the current object in to an extra tag.*/ 177 void exportParamBlock2 ( const String & elementName, const ExtraParameter extraParameters[], int extraParametersCount ); 178 179 }; 180 } 181 182 183 #endif //__COLLADAMAX_GEOMETRYEXTRA_H__ 184 185