SO3Engine
|
SO3DeferredLightSpotMaterialGenerator.cpp
Go to the documentation of this file.
38Ogre::GpuProgramPtr SDeferredLightSpotMaterialGenerator::GenerateVertexShader(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
79Ogre::GpuProgramPtr SDeferredLightSpotMaterialGenerator::GenerateFragmentShader(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
116 // cgc -entry SO3_DeferredLightSpot_ps -profile ps_4_0 -DIS_SHADOW_CASTER SO3_DeferredLightSpot_ps.cg
118 ss << " " << gbuffer->GetGBufferCompositorPixelInputStructureTypeName() << " gBuffer," << std::endl; // Input parameters (list of mrts)
132 ss << " uniform sampler2D ShadowTex : register(s" << gbuffer->GetNumberMrt() << ")," << std::endl;
172 ss << " checkShadow(ShadowTex, viewPos, invView, shadowViewProjMat, shadowFarClip, len);" << std::endl;
176 ss << " total_light_contrib = max(0.0, dot(objToLightDir, normal)) * lightDiffuseColor.rgb;" << std::endl;
181 ss << " float3 light_specular = pow(max(dot(normal, h), 0), specularity) * lightSpecularColor.rgb;" << std::endl;
183 // If GBuffer supports specular color, compute specular component using the material specular colour too.
199 // ss << " float spotFalloff = saturate((spotlightAngle - spotParams.x) / (min(spotParams.y, 179) - spotParams.x));" << std::endl;
200 ss << " float spotFalloff = saturate((spotlightAngle - spotParams.x) / (spotParams.y - spotParams.x));" << std::endl;
209 Ogre::String programName = materialBaseName +"Shaders/Pixel/"+ gbuffer->GetName() + Ogre::StringConverter::toString(permutationValue);
213 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(programSource, Ogre::LML_CRITICAL);
218 Ogre::HighLevelGpuProgramPtr ptrProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(programName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, "cg", Ogre::GPT_FRAGMENT_PROGRAM);
236 params->setNamedAutoConstant("lightDiffuseColor", Ogre::GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, 0);
238 params->setNamedAutoConstant("lightSpecularColor", Ogre::GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, 0);
240 params->setNamedAutoConstant("lightFalloff", Ogre::GpuProgramParameters::ACT_LIGHT_ATTENUATION, 0);
242 params->setNamedAutoConstant("lightPos", Ogre::GpuProgramParameters::ACT_LIGHT_POSITION_VIEW_SPACE, 0);
244 params->setNamedAutoConstant("lightPower", Ogre::GpuProgramParameters::ACT_LIGHT_POWER_SCALE, 0);
246 params->setNamedAutoConstant("lightDir", Ogre::GpuProgramParameters::ACT_LIGHT_DIRECTION_VIEW_SPACE, 0);
248 params->setNamedAutoConstant("spotParams", Ogre::GpuProgramParameters::ACT_SPOTLIGHT_PARAMS, 0);
250 params->setNamedAutoConstant("farClipDistance", Ogre::GpuProgramParameters::ACT_FAR_CLIP_DISTANCE);
267Ogre::MaterialPtr SDeferredLightSpotMaterialGenerator::GenerateTemplateMaterial(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
269 Ogre::MaterialPtr matPtr = SDeferredLightMaterialGenerator::GenerateTemplateMaterial(gbuffer, permutationValue);
virtual Ogre::MaterialPtr GenerateTemplateMaterial(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3DeferredLightMaterialGenerator.cpp:44
@ SO3_LP_CAST_SHADOWS
Definition SO3DeferredLightPermutation.h:42
virtual Ogre::GpuProgramPtr GenerateVertexShader(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3DeferredLightSpotMaterialGenerator.cpp:38
virtual ~SDeferredLightSpotMaterialGenerator()
Definition SO3DeferredLightSpotMaterialGenerator.cpp:34
virtual Ogre::MaterialPtr GenerateTemplateMaterial(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
virtual Ogre::GpuProgramPtr GenerateFragmentShader(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3DeferredLightSpotMaterialGenerator.cpp:79
SDeferredLightSpotMaterialGenerator()
Definition SO3DeferredLightSpotMaterialGenerator.cpp:30
Definition SO3GBuffer.h:37
Ogre::String GenerateGBufferCompositorPixelInputStructure()
Definition SO3GBuffer.cpp:63
Ogre::String GetGBufferCompositorPixelInputStructureTypeName()
Definition SO3GBuffer.cpp:58
const Ogre::String materialBaseName
Base name of materials generated by this.
Definition SO3MaterialGenerator.h:50
Definition SO3DataScol.h:38
Generated by 1.9.8