Example #1
0
void Model::doSkinning(const GeometryBufferPtr& gb)
{
	VertexElement* elemPosition = gb->declarations.find(VertexAttribute::Position);
	if( !elemPosition ) return;

	// Can only handle buffers with 3 components and float.
	if(elemPosition->components != 3 || elemPosition->type != VertexDataType::Float)
		return;

#if 0
	uint32 numVertices = gb->getNumVertices();

	if( mesh->position.size() != numVertices )
	{
		LogDebug("Skinned mesh and its buffer have different vertices");
		return;
	}

	for(size_t i = 0; i < meshPositions.size(); ++i)
	{
		int32 boneIndex = (int32) mesh->boneIndices[i];

		Vector3* pos = (Vector3*) gb->getAttribute(VertexAttribute::Position, i);
		*pos = bones[boneIndex] * meshPositions[i];
	}
#endif

	gb->forceRebuild();
}