void renderFakeSpotBuffers(Storm3D_Scene &scene, bool renderShadows)
	{
		// Renders fake shadows to texture?
		Storm3D_ShaderManager::GetSingleton()->setFakeDepthShaders();
		Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());

		// FIXME: this does not appear to do anything
		// d3d9 tinkers with these parameters here
		// but this is incorrect on opengl
		// because texture sampling state is part of the texture
		glActiveTexture(GL_TEXTURE1);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

		Storm3D_FakeSpotlight::clearCache();
		// bool rendered = false;

		FakeSpotList::iterator it = fakeSpots.begin();
		for(; it != fakeSpots.end(); ++it)
		{
			Storm3D_FakeSpotlight *spot = it->get();
			if(!spot || !spot->enabled())
				continue;

			const float *cameraView = camera.GetView4x4Matrix();
			if(!spot->setAsRenderTarget(cameraView))
				continue;

			renderer.render(IStorm3D_TerrainRendererBase::FakeSpotBuffer, scene, 0, spot);
			// rendered = true;
		}

		//if(rendered)
		//	Storm3D_FakeSpotlight::filterBuffers(storm, device);

		// FIXME: this does not appear to do anything
		// d3d9 tinkers with these parameters here
		// but this is incorrect on opengl
		// because texture sampling state is part of the texture
		glActiveTexture(GL_TEXTURE1);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

		frozenbyte::storm::PixelShader::disable();

		Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
		camera.Apply();
	}
Beispiel #2
0
	void renderFakeSpotBuffers(Storm3D_Scene &scene, bool renderShadows)
	{
        GFX_TRACE_SCOPE("renderFakeSpotBuffers");

		// Renders fake shadows to texture?
		Storm3D_ShaderManager::GetSingleton()->setFakeDepthShaders();
		Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());

		device.SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
		device.SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
		//device.SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_PROJECTED);

		Storm3D_FakeSpotlight::clearCache();
		bool rendered = false;

		FakeSpotList::iterator it = fakeSpots.begin();
		for(; it != fakeSpots.end(); ++it)
		{
			Storm3D_FakeSpotlight *spot = it->get();
			if(!spot || !spot->enabled())
				continue;

			const float *cameraView = camera.GetView4x4Matrix();
			if(!spot->setAsRenderTarget(cameraView))
				continue;

			renderer.render(IStorm3D_TerrainRendererBase::FakeSpotBuffer, scene, 0, spot);
			rendered = true;
		}

		//if(rendered)
		//	Storm3D_FakeSpotlight::filterBuffers(storm, device);

		device.SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
		device.SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
		device.SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
		device.SetPixelShader(0);

		Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
		camera.Apply();
	}