Beispiel #1
0
	void Render()
	{
		RenderDevice* device = Environment::GetSingleton().GetRenderDevice();
		SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();

		device->GetScreenFrameBuffer()->Clear(CF_Color | CF_Depth, ColorRGBA::White, 1, 0);

		float w = static_cast<float>( mMainWindow->GetWidth() );
		float h = static_cast<float>( mMainWindow->GetHeight() );
		mTessEffect->GetParameterByName("ViewportDim")->SetValue(float2(w, h));

		//device->Draw(mBezierCurveEffect->GetTechniqueByName("BezierCurve"), mBezierCurveROP);
		device->Draw(mTessEffect->GetTechniqueByName("TessQuad"), mTessQuadROP);

		/*float4x4 world = CreateScaling(5, 5, 5) * CreateTranslation(0, 0, 60);

		mTessEffect->GetParameterByName("TessLevel")->SetValue(100);
		mTessEffect->GetParameterByName("World")->SetValue(world);
		mTessEffect->GetParameterByName("ViewProj")->SetValue(mCamera->GetEngineViewProjMatrix());
		device->Draw(mTessEffect->GetTechniqueByName("TessTeapot"), mTessTeapotROP);*/

		device->GetScreenFrameBuffer()->SwapBuffers();
	}
Beispiel #2
0
	void Render()
	{
		RenderDevice* device = Environment::GetSingleton().GetRenderDevice();
		SceneManager* sceneMan = Environment::GetSingleton().GetSceneManager();

		shared_ptr<FrameBuffer> screenFB = device->GetScreenFrameBuffer();
		device->BindFrameBuffer(screenFB);
		screenFB->Clear(CF_Color | CF_Depth, ColorRGBA::White, 1.0, 0);

		mRenderPath->RenderScene();

		auto center = mCamera->GetPosition() + mCamera->GetForward() * 200.0f;
		DebugDrawManager::GetSingleton().DrawSphere(center, 10.0f, ColorRGBA::Red, true);


		//const float3 Points[] = {
		//	float3(1240, 50, -510),
		//	float3(1240, 50, 610),
		//	float3(-1350, 50, 610),
		//	float3(-1350, 50, -510),

		//	float3(750, 50, -120),
		//	float3(750, 50, 230),
		//	float3(-900, 50, 230),
		//	float3(-900, 50, -100),
		//};
		//for (int i = 0; i < ARRAY_SIZE(Points); ++i)
		//	DebugDrawManager::GetSingleton().DrawSphere(Points[i], 10.0f, ColorRGBA::Red, true);


		//const int NumEllipses = 10;
		//const int NumLightsEllipse = 20;

		//for (int i = 0; i < NumEllipses; ++i)
		//{
		//	for (int j = 0; j < NumLightsEllipse; ++j)
		//	{
		//		float Height = Lerp(10.0f, 1200.0f, float(i) / NumEllipses);
		//		float Angle = Mathf::TWO_PI / NumLightsEllipse * j;

		//		float3 pos(950.0f * cosf(Angle), Height, 175.0f * sinf(Angle));

		//		DebugDrawManager::GetSingleton().DrawSphere(pos, 10.0f, ColorRGBA::Red, true);
		//	}
		//}

		DebugDrawManager::GetSingleton().DrawSphere(float3(-1320, 160, 40), 150, ColorRGBA::Red, true);

		sceneMan->UpdateOverlayQueue();
		RenderBucket& guiBucket =sceneMan->GetRenderQueue().GetRenderBucket(RenderQueue::BucketOverlay, false);   
		for (const RenderQueueItem& renderItem : guiBucket) 
			renderItem.Renderable->Render();

		//auto bbox = mDudeSceneNode->GetWorldBoundingBox();
		//DebugDrawManager::GetSingleton().DrawBoundingBox(bbox, ColorRGBA::Red);

		//shared_ptr<Skeleton> skeleton = mDudeEntity->GetSkeleton();
		//DebugDrawManager::GetSingleton().DrawSkeleton(mDudeEntity->GetWorldTransform(), skeleton, ColorRGBA::Red);

		/*for (size_t i = 0; i < skeleton->GetNumBones(); ++i)
		{
			Bone* bone = skeleton->GetBone(i);

			float3 center = bone->GetWorldPosition();
			center = Transform(center, mDudeEntity->GetWorldTransform());

			ColorRGBA color = ColorRGBA::Red;
			DebugDrawManager::GetSingleton().DrawSphere(center, 0.5, color, true);
		}*/


		//for (size_t i = 0; i < mDudeCollisionSpheres.size(); ++i)
		//{
		//	Bone* bone = skeleton->GetBone(mDudeCollisionSpheres[i].BoneName);

		//	float3 center(mDudeCollisionSpheres[i].Offset, 0, 0);
		//	center = Transform(center, bone->GetWorldTransform());
		//	center = bone->GetWorldPosition();

		//	DebugDrawManager::GetSingleton().DrawSphere(center, mDudeCollisionSpheres[i].Radius * 0.5, ColorRGBA::Red);
		//}

		screenFB->SwapBuffers();
	}