Ejemplo n.º 1
0
		// ==================================================================================================================
		int mainloop() {

			m_postfx->BindInput(render);

			// pre fx-pass
			this->render.BeginScene();
			{
				ShaderRef fragmentShader = this->m_fragmentShader->Get();
				ShaderRef fxaaShader = this->m_fxFXAA->Get();
				ShaderRef fishEyeShader = this->m_fxFishEye->Get();

				m_rootActor->Matrix().Identity();
				m_rootActor->Matrix().RotateRPY(t,0,0);

				fragmentShader->GetBRes("SampleType").Set(m_textureSampler->GetSamplerState());
				
				float2 res = float2();
				render.GetScreenSizef(res.x, res.y);
				fxaaShader->GetParam("FXAA").Get("resolution").SetF(res.x, res.y);

				fishEyeShader->GetParam("Fisheye").Get("theta").SetF(0.5);

				scene->PreRender(render);
				scene->Render(render);

				this->t += 0.01;
			}

			// render fx chain 
			m_postfx->Render(render);
			
			this->render.EndScene();

			return 0;
		};
Ejemplo n.º 2
0
		// ==================================================================================================================
		int mainloop() {
			this->render.BeginScene();
			{		
				Matrix worldMatrix;
				worldMatrix.Identity();
				worldMatrix.RotateRPY(t, .3455*t, .7346*t);

				struct {
					matrix worldMatrix;
					matrix viewMatrix;
					matrix projectionMatrix;
				} viewMatrices;

				m_camera->Calculate(render);

				viewMatrices.worldMatrix = XMMatrixTranspose(worldMatrix.Get());
				viewMatrices.viewMatrix = XMMatrixTranspose(m_camera->GetViewMatrix().Get());
				viewMatrices.projectionMatrix = XMMatrixTranspose(m_camera->GetProjectionMatrix().Get());

				m_vertexShader->GetParam("MatrixBuffer").SetP(&viewMatrices);

				m_fragmentShader->GetBRes("diffuse").Set(m_texture->GetTextureResource());
				m_fragmentShader->GetBRes("SampleType").Set(m_textureSampler->GetSamplerState());

				m_vertexShader->Render(this->render);
				m_fragmentShader->Render(this->render);

				m_model->RenderMesh(this->render);

				this->t += 0.01;
			}

			this->render.EndScene();
			return 0;
		};