| 1246 | } |
| 1247 | |
| 1248 | std::shared_ptr<VertexBuffer> MeshFactory::CreateVBuffer(uint32_t numVertices) |
| 1249 | { |
| 1250 | auto vbuffer = std::make_shared<VertexBuffer>(mVFormat, numVertices); |
| 1251 | if (vbuffer) |
| 1252 | { |
| 1253 | // Get the position channel. |
| 1254 | mPositions = GetGeometricChannel(vbuffer, VASemantic::POSITION, 1.0f); |
| 1255 | LogAssert(mPositions != nullptr, "Positions are required."); |
| 1256 | |
| 1257 | // Get the optional geometric channels. |
| 1258 | mNormals = GetGeometricChannel(vbuffer, VASemantic::NORMAL, 0.0f); |
| 1259 | mTangents = GetGeometricChannel(vbuffer, VASemantic::TANGENT, 0.0f); |
| 1260 | mBitangents = GetGeometricChannel(vbuffer, VASemantic::BINORMAL, 0.0f); |
| 1261 | |
| 1262 | // Get texture coordinate channels that are to be assigned values. |
| 1263 | // Clear the mAssignTCoords element in case any elements were set by a |
| 1264 | // previous mesh factory creation call. |
| 1265 | std::set<uint32_t> required; |
| 1266 | required.insert(DF_R32G32_FLOAT); |
| 1267 | for (uint32_t unit = 0; unit < VAConstant::MAX_TCOORD_UNITS; ++unit) |
| 1268 | { |
| 1269 | mTCoords[unit] = vbuffer->GetChannel(VASemantic::TEXCOORD, unit, required); |
| 1270 | if (mTCoords[unit]) |
| 1271 | { |
| 1272 | mAssignTCoords[unit] = true; |
| 1273 | } |
| 1274 | else |
| 1275 | { |
| 1276 | mAssignTCoords[unit] = false; |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | vbuffer->SetUsage(mVBUsage); |
| 1281 | } |
| 1282 | return vbuffer; |
| 1283 | } |
| 1284 | |
| 1285 | std::shared_ptr<IndexBuffer> MeshFactory::CreateIBuffer(uint32_t numTriangles) |
| 1286 | { |
nothing calls this directly
no test coverage detected