MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / GetGeometricChannel

Method GetGeometricChannel

GTE/Graphics/MeshFactory.cpp:1295–1317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1293}
1294
1295char* MeshFactory::GetGeometricChannel(std::shared_ptr<VertexBuffer> const& vbuffer,
1296 VASemantic semantic, float w)
1297{
1298 char* channel = nullptr;
1299 int32_t index = mVFormat.GetIndex(semantic, 0);
1300 if (index >= 0)
1301 {
1302 channel = vbuffer->GetChannel(semantic, 0, std::set<uint32_t>());
1303 LogAssert(channel != nullptr, "Unexpected condition.");
1304 if (mVFormat.GetType(index) == DF_R32G32B32A32_FLOAT)
1305 {
1306 // Fill in the w-components.
1307 int32_t const numVertices = vbuffer->GetNumElements();
1308 for (int32_t i = 0; i < numVertices; ++i)
1309 {
1310 auto tuple4 = reinterpret_cast<float*>(channel +
1311 static_cast<size_t>(i) * mVFormat.GetVertexSize());
1312 tuple4[3] = w;
1313 }
1314 }
1315 }
1316 return channel;
1317}
1318
1319void MeshFactory::SetPlatonicTCoord(uint32_t i, Vector3<float> const& pos)
1320{

Callers

nothing calls this directly

Calls 5

GetChannelMethod · 0.80
GetVertexSizeMethod · 0.80
GetIndexMethod · 0.45
GetTypeMethod · 0.45
GetNumElementsMethod · 0.45

Tested by

no test coverage detected