Пример #1
0
void Canvas::render()
{
	if (_hwnd == NULL)
	{
		return;
	}
	//
	RECT rect;
	GetClientRect(_hwnd, &rect);
	if (rect.left == rect.right)
	{
		return;
	}
	if (!_isInitialized())
	{
		_create();
	}
	if (RenderEngineImp::isNull() || NULL == RenderEngineImp::getInstancePtr()->getRenderEngine() || NULL == RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem())
	{
		return;
	}
	//
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->clear(0, NULL, Euclid::eClearFlags_Target | Euclid::eClearFlags_ZBuffer, RenderEngineImp::getInstancePtr()->getClearColor(), 1.0f, 0L);

	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->beginScene();
	//
	_renderGeometry();

	//
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->endScene();
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->present(NULL, NULL, NULL);

	//
	_calcFPS();
}
Пример #2
0
void Canvas::update()
{
	if (_isInitialized())
	{
		_camera.update();
	}
	
	if (_group)
	{
		Mat4 m = _camera.getProjectionMatrix() * _camera.getViewMatrix() * _cameraController.getMatrix();
		_group->setMatrix("gWorldViewProj", m);
	}
}
Пример #3
0
void Canvas::destroy()
{
	if (!_isInitialized())
	{
		return;
	}
	_destroymodel();
	RenderEngineImp::getInstancePtr()->destroy();
	delete RenderEngineImp::getInstancePtr();

	delete Buddha::Logger::getInstancePtr();
	//
	_clear();
}
Пример #4
0
void Canvas::update(u32 delta)
{
	if (_isInitialized())
	{
		_camera.update();
	}
	
	if (_model)
	{
		Mat4 m = _camera.getProjectionMatrix() * _camera.getViewMatrix() * _cameraController.getMatrix();
		_model->setMatrix("gWorldViewProj", m);
		_model->setMatrix("gView", _camera.getViewMatrix() * _cameraController.getMatrix());
		_model->setMatrix("gProjection", _camera.getProjectionMatrix());
		//
		_model->update(delta * 0.2);
	}
}
Пример #5
0
LRESULT CView::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	if (RenderEngineImp::isNull() || NULL == RenderEngineImp::getInstancePtr()->getRenderEngine() || NULL == RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem())
	{
		return 0;
	}
	if (!_isInitialized())
	{
		_create();
	}
	//
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->clear(0, NULL, Euclid::eClearFlags_Target | Euclid::eClearFlags_ZBuffer, Euclid::Color::Black, 1.0f, 0L);

	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->beginScene();
	//
	_renderGeometry();

	//
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->endScene();
	RenderEngineImp::getInstancePtr()->getRenderEngine()->getRenderSystem()->present(NULL, NULL, NULL);

	return 0;
}
Пример #6
0
void Canvas::update(u32 delta)
{
	if (_isInitialized())
	{
		_camera.update();
	}
	
	if (_model)
	{
		_updateActorAngle(delta);
		_updateActorPosition(delta);
		_camera.lookAt(_getActorPosition() + Vec3(0.0f, 70.0f, 0.0f));
		_camera.setPosition(_getActorPosition() + Vec3(0.0f, 70.0f, 0.0f) + _relativeCameraCoordination.getPosition());
		Mat4 worldM = Mat4::IDENTITY;
		worldM.makeTransform(_getActorPosition(), Vec3::UNIT_SCALE, _getActorAngle());
		Mat4 m = _camera.getProjectionMatrix() * _camera.getViewMatrix() * worldM/*_cameraController.getMatrix()*/;
		_model->setMatrix("gWorldViewProj", m);
		_model->setMatrix("gView", _camera.getViewMatrix() /** _cameraController.getMatrix()*/);
		_model->setMatrix("gProjection", _camera.getProjectionMatrix());
		//
		_model->update(delta);
	}
}