------------------------------------------------------------------------------------------------ Writes a float array of the given type
| 1197 | // ------------------------------------------------------------------------------------------------ |
| 1198 | // Writes a float array of the given type |
| 1199 | void ColladaExporter::WriteFloatArray(const std::string &pIdString, FloatDataType pType, const ai_real *pData, size_t pElementCount) { |
| 1200 | size_t floatsPerElement = 0; |
| 1201 | switch (pType) { |
| 1202 | case FloatType_Vector: |
| 1203 | floatsPerElement = 3; |
| 1204 | break; |
| 1205 | case FloatType_TexCoord2: |
| 1206 | floatsPerElement = 2; |
| 1207 | break; |
| 1208 | case FloatType_TexCoord3: |
| 1209 | floatsPerElement = 3; |
| 1210 | break; |
| 1211 | case FloatType_Color: |
| 1212 | floatsPerElement = 3; |
| 1213 | break; |
| 1214 | case FloatType_Mat4x4: |
| 1215 | floatsPerElement = 16; |
| 1216 | break; |
| 1217 | case FloatType_Weight: |
| 1218 | floatsPerElement = 1; |
| 1219 | break; |
| 1220 | case FloatType_Time: |
| 1221 | floatsPerElement = 1; |
| 1222 | break; |
| 1223 | default: |
| 1224 | return; |
| 1225 | } |
| 1226 | |
| 1227 | std::string arrayId = XMLIDEncode(pIdString) + "-array"; |
| 1228 | |
| 1229 | mOutput << startstr << "<source id=\"" << XMLIDEncode(pIdString) << "\" name=\"" << XMLEscape(pIdString) << "\">" << endstr; |
| 1230 | PushTag(); |
| 1231 | |
| 1232 | // source array |
| 1233 | mOutput << startstr << "<float_array id=\"" << arrayId << "\" count=\"" << pElementCount * floatsPerElement << "\"> "; |
| 1234 | PushTag(); |
| 1235 | |
| 1236 | if (pType == FloatType_TexCoord2) { |
| 1237 | for (size_t a = 0; a < pElementCount; ++a) { |
| 1238 | mOutput << pData[a * 3 + 0] << " "; |
| 1239 | mOutput << pData[a * 3 + 1] << " "; |
| 1240 | } |
| 1241 | } else if (pType == FloatType_Color) { |
| 1242 | for (size_t a = 0; a < pElementCount; ++a) { |
| 1243 | mOutput << pData[a * 4 + 0] << " "; |
| 1244 | mOutput << pData[a * 4 + 1] << " "; |
| 1245 | mOutput << pData[a * 4 + 2] << " "; |
| 1246 | } |
| 1247 | } else { |
| 1248 | for (size_t a = 0; a < pElementCount * floatsPerElement; ++a) { |
| 1249 | mOutput << pData[a] << " "; |
| 1250 | } |
| 1251 | } |
| 1252 | mOutput << "</float_array>" << endstr; |
| 1253 | PopTag(); |
| 1254 | |
| 1255 | // the usual Collada fun. Let's bloat it even more! |
| 1256 | mOutput << startstr << "<technique_common>" << endstr; |
nothing calls this directly
no test coverage detected