Ejemplo n.º 1
0
void SkinnedMesh::build()
{
	PERF_NODE_FUNC();

	Mesh::build();

	assert(m_resource->getResourceState() == RES_STATE_COMPLETE);

	size_t vertexCount = m_resource->getVertexCount();

	m_staticStream.format = m_resource->getStaticStreamFormat();
	m_staticStream.stride = MeshFile::calculateVertexStride(m_staticStream.format);
	m_staticStream.buffer = const_cast<unsigned char*>(m_resource->getStaticVertexStream());

	m_dynamicStream.format = m_resource->getDynamicStreamFormat();
	m_dynamicStream.stride = MeshFile::calculateVertexStride(m_dynamicStream.format);
	if (m_gpuSkinning)
	{
		m_dynamicStream.buffer = const_cast<unsigned char*>(m_resource->getDynamicVertexStream());
	}
	else
	{
		m_dynamicStream.buffer = GRP_NEW unsigned char[vertexCount * m_dynamicStream.stride];
	}

	size_t boneInfluenceCount = m_resource->getBoneNames().size();
	m_boneTransforms.resize(boneInfluenceCount, NULL);
	m_boneIds.resize(boneInfluenceCount, -1);
	m_finalBoneTransforms.resize(boneInfluenceCount);

	setBuilt();
}
Ejemplo n.º 2
0
void Building::build(float unit)
{
    if (!mBuilt)
    {
        mLife += unit;
        if (mLife >= mLifeMax)
        {
            mLife = mLifeMax;
            setBuilt(true);
        }
    }
}