Data(Storm3D &storm_, IStorm3D_TerrainRendererBase &renderer_, StormSpotList &spots_, FakeSpotList &fakeSpots_, FakeLightList &fakeLights_)
	:	storm(storm_),
		renderer(renderer_),
		spots(spots_),
		fakeSpots(fakeSpots_),
		fakeLights(fakeLights_),

		coneAtiVertexShader(),
		coneNvVertexShader()
	{
		coneAtiVertexShader.createAtiConeShader();
		coneNvVertexShader.createNvConeShader();
	}
	void renderCones(Storm3D_Scene &scene, bool renderShadows, float timeFactor, bool renderGlows)
	{
		// this draws spotlight cone
		frozenbyte::storm::PixelShader::disable();

		Storm3D_ShaderManager::GetSingleton()->setProjectedShaders();
		coneNvVertexShader.apply();

		Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());

		glDepthMask(GL_FALSE);
		glDisable(GL_ALPHA_TEST);
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE);

		StormSpotList::iterator it = spots.begin();
		for(; it != spots.end(); ++it)
		{
			Storm3D_Spotlight *spot = it->get();
			if(!spot || !spot->enabled() || !spot->featureEnabled(IStorm3D_Spotlight::ConeVisualization))
				continue;

			if(renderShadows)
				spot->renderCone(camera, timeFactor, renderGlows);
		}

		Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
		frozenbyte::storm::PixelShader::disable();

		glDepthMask(GL_TRUE);
		glDisable(GL_BLEND);
	}
Ejemplo n.º 3
0
	void renderCones(Storm3D_Scene &scene, bool renderShadows, float timeFactor, bool renderGlows)
	{
		// this draws spotlight cone
		device.SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_PROJECTED);
		device.SetPixelShader(0);

		Storm3D_ShaderManager::GetSingleton()->setProjectedShaders();
		coneNvVertexShader.apply();

		Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());

		device.SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
		device.SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
		device.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
		device.SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
		device.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

		SpotList::iterator it = spots.begin();
		for(; it != spots.end(); ++it)
		{
			Storm3D_Spotlight *spot = it->get();
			if(!spot || !spot->enabled() || !spot->featureEnabled(IStorm3D_Spotlight::ConeVisualization))
				continue;

			if(renderShadows)
				spot->renderCone(camera, timeFactor, renderGlows);
		}

		Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
		device.SetPixelShader(0);

		device.SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
		device.SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
		device.SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
	}
Ejemplo n.º 4
0
	Data(Storm3D &storm_, IStorm3D_TerrainRendererBase &renderer_, SpotList &spots_, FakeSpotList &fakeSpots_, FakeLightList &fakeLights_)
	:	storm(storm_),
		renderer(renderer_),
		spots(spots_),
		fakeSpots(fakeSpots_),
		fakeLights(fakeLights_),
		device(storm.GetD3DDevice()),

		coneAtiVertexShader(device),
		coneNvVertexShader(device)
	{
		coneNvVertexShader.createNvConeShader();
	}