/*! \param storm Storm3D \param shadowQuality shadow quality */ void Storm3D_FakeSpotlight::createBuffers(Storm3D &storm, int shadowQuality) { if(BUFFER_WIDTH <= 0 || BUFFER_HEIGHT <= 0) return; bool status = renderTargets.createAll(storm, shadowQuality); while(!status && shadowQuality >= 0) { IStorm3D_Logger *logger = storm.getLogger(); if(logger) logger->warning("Failed creating fakelight's shadow rendertargets - trying again using lower resolution"); shadowQuality -= 50; querySizes(storm, shadowQuality); status = renderTargets.createAll(storm, shadowQuality); } IStorm3D_Logger *logger = storm.getLogger(); if(logger && !renderTargets.targets[0]->hasInitialized()) logger->warning("Failed creating fakelight's shadow rendertargets - feature disabled!"); Storm3D_FakeSpotlight::Data::indexBuffer = new frozenbyte::storm::IndexBuffer(); { Storm3D_FakeSpotlight::Data::indexBuffer->create(4, false); WORD *pointer = Storm3D_FakeSpotlight::Data::indexBuffer->lock(); *pointer++ = 4; *pointer++ = 0; *pointer++ = 1; *pointer++ = 2; *pointer++ = 0; *pointer++ = 4; *pointer++ = 4; *pointer++ = 3; *pointer++ = 2; *pointer++ = 3; *pointer++ = 4; *pointer++ = 1; Storm3D_FakeSpotlight::Data::indexBuffer->unlock(); } Storm3D_FakeSpotlight::Data::shadowVertexShader = new frozenbyte::storm::VertexShader(); Storm3D_FakeSpotlight::Data::shadowVertexShader->createFakePlaneShadowShader(); Storm3D_FakeSpotlight::Data::depthPixelShader = new frozenbyte::storm::PixelShader(); Storm3D_FakeSpotlight::Data::depthPixelShader->createFakeDepthPixelShader(); Storm3D_FakeSpotlight::Data::shadowPixelShader = new frozenbyte::storm::PixelShader(); Storm3D_FakeSpotlight::Data::shadowPixelShader->createFakeShadowPixelShader(); }
void Storm3D_Spotlight::createShadowBuffers(Storm3D &storm, IDirect3D9 &d3d, IDirect3DDevice9 &device, bool ps14, bool ps20, int shadowQuality) { bool status = staticBuffers.createAll(storm, d3d, device, ps14, shadowQuality); while(!status && shadowQuality > 0) { IStorm3D_Logger *logger = storm.getLogger(); if(logger) logger->warning("Failed creating light's shadow depth rendertargets - trying again using lower resolution"); shadowQuality -= 50; querySizes(storm, ps14, shadowQuality); status = staticBuffers.createAll(storm, d3d, device, ps14, shadowQuality); } IStorm3D_Logger *logger = storm.getLogger(); if(logger && !staticBuffers.buffers[0]->hasInitialized()) logger->warning("Failed creating light's shadow depth rendertargets - shadows disabled!"); if(ps14) { if(type == Storm3D_Spotlight::AtiFloatBuffer) { Storm3D_SpotlightData::atiFloatDepthPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiFloatDepthPixelShader->createAtiFloatDepthPixelShader(); Storm3D_SpotlightData::atiFloatShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiFloatShadowPixelShader->createAtiFloatShadowPixelShader(); Storm3D_SpotlightData::atiFloatShadowTerrainPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiFloatShadowTerrainPixelShader->createAtiFloatShadowTerrainPixelShader(); Storm3D_SpotlightData::atiFloatNoShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiFloatNoShadowPixelShader->createAtiFloatNoShadowPixelShader(); Storm3D_SpotlightData::atiFloatNoShadowTerrainPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiFloatNoShadowTerrainPixelShader->createAtiFloatNoShadowTerrainPixelShader(); } Storm3D_SpotlightData::atiDepthPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiDepthPixelShader->createAtiDepthPixelShader(); Storm3D_SpotlightData::atiShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiShadowPixelShader->createAtiShadowPixelShader(); Storm3D_SpotlightData::atiShadowSolidPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiShadowSolidPixelShader->createAtiShadowSolidPixelShader(); Storm3D_SpotlightData::atiShadowTerrainPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiShadowTerrainPixelShader->createAtiShadowTerrainPixelShader(); Storm3D_SpotlightData::atiNoShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiNoShadowPixelShader->createAtiNoShadowPixelShader(); Storm3D_SpotlightData::atiNoShadowTerrainPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::atiNoShadowTerrainPixelShader->createAtiNoShadowTerrainPixelShader(); Storm3D_SpotlightData::coneAtiPixelShader_Texture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneAtiPixelShader_Texture->createAtiLightConeShader_Texture(); Storm3D_SpotlightData::coneAtiPixelShader_NoTexture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneAtiPixelShader_NoTexture->createAtiLightConeShader_NoTexture(); if(type == Storm3D_Spotlight::AtiFloatBuffer) { Storm3D_SpotlightData::coneAtiFloatPixelShader_Texture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneAtiFloatPixelShader_Texture->createAtiFloatLightConeShader_Texture(); Storm3D_SpotlightData::coneAtiFloatPixelShader_NoTexture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneAtiFloatPixelShader_NoTexture->createAtiFloatLightConeShader_NoTexture(); } } if(type == Storm3D_Spotlight::DepthBuffer) { if(ps20) { Storm3D_SpotlightData::nvSmoothShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::nvSmoothShadowPixelShader->createNvSmoothShadowShader(); } Storm3D_SpotlightData::nvShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::nvShadowPixelShader->createNvShadowShader(); Storm3D_SpotlightData::nvNoShadowPixelShader = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::nvNoShadowPixelShader->createNvNoShadowShader(); Storm3D_SpotlightData::coneNvPixelShader_Texture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneNvPixelShader_Texture->createNvConeShader_Texture(); Storm3D_SpotlightData::coneNvPixelShader_NoTexture = new frozenbyte::storm::PixelShader(device); Storm3D_SpotlightData::coneNvPixelShader_NoTexture->createNvConeShader_NoTexture(); } Storm3D_SpotlightData::coneStencilVertexShader = new frozenbyte::storm::VertexShader(device); Storm3D_SpotlightData::coneStencilVertexShader->createConeStencilShader(); }