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);
	}
Esempio n. 2
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);
	}