Пример #1
0
void GCL::RenderComponent::Render(const Matrix44 &proj)
{
    const RenderObject *tempRenderObject = mObj;
    if (tempRenderObject->IsVisible())
    {
        const Material &tempMaterial = tempRenderObject->GetMaterial();
        tempMaterial.Bind();
        const Matrix44 &transform = mParentActor->GetTransform();
        GPUProgram *tempProgram = tempMaterial.GetShader();
        tempProgram->SetProjectionMatrix(proj);
        tempProgram->SetModelViewMatrix(transform);
        tempRenderObject->GetVBO().Render();
    }
}
Пример #2
0
void Sprite::Render(const Matrix44 &proj)
{
	if (!IsVisible())
		return;
	//RenderPipe::BufferCommands();
	const RenderObject *tempRenderObject = mObj;
	const Material &tempMaterial = tempRenderObject->GetMaterial();
	tempMaterial.Bind();
	const Texture &currentTexture = *(mTextureList[0]);
	currentTexture.Bind();
	const Matrix44 &transform = mTransform;
	GPUProgram *tempProgram = tempMaterial.GetShader();
	tempProgram->SetProjectionMatrix(proj);
	tempProgram->SetModelViewMatrix(transform);
	tempProgram->SetUniform("CurrentFrame", (long)mCurrentFrame);
	tempProgram->SetUniform("Dimension", Point2<long>(long(mHeader.width), long(mHeader.height)));
	tempProgram->SetUniform("FrameCount", (long)mHeader.frameCount);
	tempProgram->SetUniform("TextureSize", Point2<long>((long)currentTexture.GetResourceWidth(), (long)currentTexture.GetResourceHeight()));
	tempProgram->SetTextureSampler(currentTexture);

	tempRenderObject->GetVBO().Render();
	//RenderPipe::FlushCommands();
}