Exemplo n.º 1
0
void IRenderQueue::PrintRenderQueue(const RenderableNodeList& nodes)
{
	HeapString testStr;
	size_t count = nodes.Count();
	FOR_EACH_SIZE(i, count)
	{
		IRenderable* node = (IRenderable*)nodes[i];
		testStr.AppendFormat("{}:{}:{}\n", node->Id(), node->Mesh()->Material()->Name().c_str(), node->Name().c_str());
	}
Exemplo n.º 2
0
void BaseBufferRenderBatch::AddNodeToBuffer(uint& refVertexIndex, uint& refIndexIndex, IRenderable& node)
{
	auto mesh = node.Mesh();
	const Matrix4& newMatrix = node.WorldMatrix();

	mesh->AddToVertexBufferObject(mVertexBufferObject, refVertexIndex,  newMatrix);
	mesh->AddToNormalBufferObject(mNormalBufferObject, refVertexIndex,  newMatrix);
	mesh->AddToTexCoordBufferObject(mTexcoordBufferObject, refVertexIndex);
	mesh->AddToColorBufferObject(mColorBufferObject, refVertexIndex, node.WorldColor());
	mesh->AddToIndexBufferObject(mIndexBufferObject, refVertexIndex, refIndexIndex);

	uintp vertexCount = mesh->VertexCount();
	uintp indexCount = mesh->IndexCount();
	node.SetBatch(this, refVertexIndex, (uint)vertexCount, refIndexIndex, (uint)indexCount);
	refVertexIndex += (uint)vertexCount;
	refIndexIndex += (uint)indexCount;
	RenderingStatics::Instance().IncreaseChangedNodeCount();

}
Exemplo n.º 3
0
void BaseBufferRenderBatch::UpdateNodeToBuffer(uint& refVertexIndex, uint& refIndexIndex, IRenderable& node, RenderableChangedFlags changedFlags)
{
	auto mesh = node.Mesh();
	if (MEDUSA_FLAG_HAS(changedFlags,RenderableChangedFlags::NewVertex))
	{
		const Matrix4& newMatrix = node.WorldMatrix();
		mesh->AddToVertexBufferObject(mVertexBufferObject, refVertexIndex,  newMatrix);
	}

	if (MEDUSA_FLAG_HAS(changedFlags, RenderableChangedFlags::NewNormal))
	{
		const Matrix4& newMatrix = node.WorldMatrix();
		mesh->AddToNormalBufferObject(mNormalBufferObject, refVertexIndex,  newMatrix);
	}

	if (MEDUSA_FLAG_HAS(changedFlags, RenderableChangedFlags::NewTexCoord))
	{
		mesh->AddToTexCoordBufferObject(mTexcoordBufferObject, refVertexIndex);
	}

	if (MEDUSA_FLAG_HAS(changedFlags, RenderableChangedFlags::NewColor))
	{
		mesh->AddToColorBufferObject(mColorBufferObject, refVertexIndex, node.WorldColor());
	}

	if (MEDUSA_FLAG_HAS(changedFlags, RenderableChangedFlags::NewIndex))
	{
		mesh->AddToIndexBufferObject(mIndexBufferObject, refVertexIndex, refIndexIndex);
	}

	uintp vertexCount = mesh->VertexCount();
	uintp indexCount = mesh->IndexCount();
	node.SetBatch(this, refVertexIndex, (uint)vertexCount, refIndexIndex, (uint)indexCount);
	refVertexIndex += (uint)vertexCount;
	refIndexIndex += (uint)indexCount;
	RenderingStatics::Instance().IncreaseChangedNodeCount();
}
Exemplo n.º 4
0
bool IRenderBatch::IsAvailableFor(const IRenderable& node) const
{
	IMesh* mesh = node.Mesh();
	return IsAvailableFor(mesh->VertexCount(), mesh->IndexCount());
}