示例#1
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;
		};
示例#2
0
	// ==================================================================================================================
	int mainloop() {
		this->render.BeginScene();
		{
			this->t = timer->GetTime();

			ShaderRef fragmentShader = this->m_fragmentShader->Get();

			float2 rot_rp;
			float3 rot_rpy;
			
			rot_rpy = trk_rotate_root->Get(); m_rootActor->Matrix().Identity(); m_rootActor->Matrix().RotateRPY(rot_rpy.x, rot_rpy.y, rot_rpy.z);


			for (int i = 0; i < 6; i++) {
				rot_rp = trk_rotate[i]->Get(); 
				modelActors[i]->Transform().Identity(); 
				modelActors[i]->Transform().RotateRPY(rot_rp.x, rot_rp.y, 0);
			}

			fragmentShader->SetSamplerSatate(render, "SampleType", m_textureSampler->GetSamplerState());

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

			timer->Update();

		}

		this->render.EndScene();
		return 0;
	};
示例#3
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;
		};