コード例 #1
0
ファイル: Context.cpp プロジェクト: christiank/pioneer
void Context::Draw()
{
	Graphics::Renderer *r = GetRenderer();
	r->ClearDepthBuffer();

	// Ticket for the viewport mostly
	Graphics::Renderer::StateTicket ticket(r);
	r->SetViewport(0, 0, m_width, m_height);

	// reset renderer for each layer
	for (std::vector<Layer*>::iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
		r->SetOrthographicProjection(0, m_width, m_height, 0, -1, 1);
		r->SetTransform(matrix4x4f::Identity());
		r->SetClearColor(Color::BLACK);

		DrawWidget(*i);

		r->SetScissor(false);
	}

	if (m_mousePointer && m_mousePointerEnabled) {
		r->SetOrthographicProjection(0, m_width, m_height, 0, -1, 1);
		r->SetTransform(matrix4x4f::Identity());
		r->SetClearColor(Color::BLACK);
		DrawWidget(m_mousePointer);
		r->SetScissor(false);
	}
}
コード例 #2
0
ファイル: ShipSpinner.cpp プロジェクト: adammead/pioneer
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);
}
コード例 #3
0
ファイル: ModelSpinner.cpp プロジェクト: tnicoll/pioneer
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);
}