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

Method OnFirstUpdate

GTE/Graphics/SkinController.cpp:112–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void SkinController::OnFirstUpdate()
113{
114 // Get access to the vertex buffer positions to store the blended targets.
115 Visual* visual = reinterpret_cast<Visual*>(mObject);
116 VertexBuffer* vbuffer = visual->GetVertexBuffer().get();
117 if (mNumVertices == static_cast<int32_t>(vbuffer->GetNumElements()))
118 {
119 // Get the position data.
120 VertexFormat vformat = vbuffer->GetFormat();
121 int32_t const numAttributes = vformat.GetNumAttributes();
122 for (int32_t i = 0; i < numAttributes; ++i)
123 {
124 VASemantic semantic{};
125 DFType type{};
126 uint32_t unit{}, offset{};
127 vformat.GetAttribute(i, semantic, type, unit, offset);
128 if (semantic == VASemantic::POSITION &&
129 (type == DF_R32G32B32_FLOAT || type == DF_R32G32B32A32_FLOAT))
130 {
131 mPosition = vbuffer->GetData() + offset;
132 mStride = vformat.GetVertexSize();
133 mCanUpdate = true;
134 break;
135 }
136 }
137 }
138
139 mCanUpdate = (mPosition != nullptr);
140}
141
142

Callers

nothing calls this directly

Calls 7

GetNumAttributesMethod · 0.80
GetAttributeMethod · 0.80
GetVertexSizeMethod · 0.80
GetVertexBufferMethod · 0.45
GetNumElementsMethod · 0.45
GetFormatMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected