void ShipSpinner::Draw() { Graphics::Renderer *r = GetContext()->GetRenderer(); Graphics::Renderer::StateTicket ticket(r); r->SetPerspectiveProjection(45.f, 1.f, 1.f, 10000.f); r->SetTransform(matrix4x4f::Identity()); r->SetDepthTest(true); r->ClearDepthBuffer(); r->SetLights(1, &m_light); Point pos(GetAbsolutePosition() + GetActiveOffset()); Point size(GetActiveArea()); r->SetViewport(pos.x, GetContext()->GetSize().y - pos.y - size.y, size.x, size.y); matrix4x4f rot = matrix4x4f::RotateXMatrix(m_rotX); rot.RotateY(m_rotY); rot[14] = -1.5f * m_model->GetDrawClipRadius(); m_model->Render(r, rot, &m_params); }
void ModelSpinner::Draw() { Graphics::Renderer *r = GetContext()->GetRenderer(); Graphics::Renderer::StateTicket ticket(r); const float fov = 45.f; r->SetPerspectiveProjection(fov, 1.f, 1.f, 10000.f); r->SetTransform(matrix4x4f::Identity()); r->SetDepthWrite(true); r->SetDepthTest(true); r->ClearDepthBuffer(); r->SetLights(1, &m_light); Point pos(GetAbsolutePosition() + GetActiveOffset()); Point size(GetActiveArea()); r->SetViewport(pos.x, GetContext()->GetSize().y - pos.y - size.y, size.x, size.y); matrix4x4f rot = matrix4x4f::RotateXMatrix(m_rotX); rot.RotateY(m_rotY); const float dist = m_model->GetDrawClipRadius() / sinf(DEG2RAD(fov*0.5f)); rot[14] = -dist; m_model->Render(rot); }