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

Method GetChannel

GTE/Graphics/VertexBuffer.cpp:40–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40char* VertexBuffer::GetChannel(VASemantic semantic, uint32_t unit,
41 std::set<DFType> const& requiredTypes)
42{
43 char* data = (mSBuffer == nullptr ? mData : mSBuffer->GetData());
44 if (!data)
45 {
46 // The system memory copy does not exist. You need to recreate it
47 // before populating it.
48 return nullptr;
49 }
50
51 int32_t index = mVFormat.GetIndex(semantic, unit);
52 if (index < 0)
53 {
54 // The buffer does not have the specified semantic that uses the
55 // specified unit.
56 return nullptr;
57 }
58
59 DFType type = mVFormat.GetType(index);
60 if (requiredTypes.size() > 0)
61 {
62 if (requiredTypes.find(type) == requiredTypes.end())
63 {
64 // The type of the semantic is not in the set of required types.
65 return nullptr;
66 }
67 }
68
69 return data + mVFormat.GetOffset(index);
70}
71
72

Callers 5

UpdateModelBoundMethod · 0.80
UpdateModelNormalsMethod · 0.80
CreateVBufferMethod · 0.80
GetGeometricChannelMethod · 0.80
ExecuteRecursiveMethod · 0.80

Calls 5

endMethod · 0.80
GetDataMethod · 0.45
GetIndexMethod · 0.45
GetTypeMethod · 0.45
GetOffsetMethod · 0.45

Tested by

no test coverage detected