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

Method SetObject

GTE/Graphics/MorphController.cpp:132–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132void MorphController::SetObject(ControlledObject* object)
133{
134 // Verify that the object satisfies the preconditions that allow a
135 // MorphController to be attached to it.
136 auto visual = dynamic_cast<Visual*>(object);
137 LogAssert(visual != nullptr, "Object is not of type Visual.");
138
139 auto const& vbuffer = visual->GetVertexBuffer();
140 LogAssert(vbuffer->GetNumElements() == mNumVertices, "Mismatch in number of vertices.");
141
142 // The vertex buffer for a Visual controlled by a MorphController must
143 // have 3-tuple or 4-tuple float-valued position that occurs at the
144 // beginning (offset 0) of the vertex structure.
145 VertexFormat vformat = vbuffer->GetFormat();
146 int32_t index = vformat.GetIndex(VASemantic::POSITION, 0);
147 LogAssert(index >= 0, "Vertex format does not have VASemantic::POSITION.");
148
149 uint32_t type = vformat.GetType(index);
150 LogAssert(type == DF_R32G32B32_FLOAT || type == DF_R32G32B32A32_FLOAT, "Invalid position type.");
151
152 uint32_t offset = vformat.GetOffset(index);
153 LogAssert(offset == 0, "Position offset must be 0.");
154
155 Controller::SetObject(object);
156}
157
158void MorphController::GetKeyInfo(float ctrlTime, float& normTime, size_t& key0, size_t& key1)
159{

Callers

nothing calls this directly

Calls 6

GetVertexBufferMethod · 0.45
GetNumElementsMethod · 0.45
GetFormatMethod · 0.45
GetIndexMethod · 0.45
GetTypeMethod · 0.45
GetOffsetMethod · 0.45

Tested by

no test coverage detected