SO3Engine
|
SO3GBufferMaterialGenerator.cpp
Go to the documentation of this file.
39SGBufferMaterialGenerator::SGBufferMaterialGenerator() : SMaterialGenerator<SGBufferMaterialPermutation, Ogre::uint32>("Materials/")
63Ogre::GpuProgramPtr SGBufferMaterialGenerator::GenerateVertexShader(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
72 Ogre::uint32 numTexCoords = (permutationValue & SGBufferMaterialPermutation::SO3_GBP_TEXCOORD_MASK) >> 8;
128 Ogre::String programName = materialBaseName + "VP_" + Ogre::StringConverter::toString(permutationValue);
132 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(programSource, Ogre::LML_CRITICAL);
155Ogre::GpuProgramPtr SGBufferMaterialGenerator::GenerateFragmentShader(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
178 Ogre::uint32 numTexCoords = (permutationValue & SGBufferMaterialPermutation::SO3_GBP_TEXCOORD_MASK) >> 8;
183 ss << " out "<< gbuffer->GetGBufferMaterialPixelOutputStructureTypeName() << " gbuffer," << std::endl;
196 Ogre::uint32 numTextures = permutationValue & SGBufferMaterialPermutation::SO3_GBP_TEXTURE_MASK;
200 if (numTextures == 0 || permutationValue & SGBufferMaterialPermutation::SO3_GBP_HAS_DIFFUSE_COLOUR)
283 ss << " gbuffer.SetEmissive((cEmissiveColour.r + cEmissiveColour.g + cEmissiveColour.b) / 3);" << std::endl;
300 Ogre::String programName = materialBaseName + "FP_" + Ogre::StringConverter::toString(permutationValue);
304 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(programSource, Ogre::LML_CRITICAL);
308 Ogre::HighLevelGpuProgramPtr ptrProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(programName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, "cg", Ogre::GPT_FRAGMENT_PROGRAM);
316 params->setNamedAutoConstant("cSpecularity", Ogre::GpuProgramParameters::ACT_SURFACE_SHININESS);
318 if ((numTextures == 0 || permutationValue & SGBufferMaterialPermutation::SO3_GBP_HAS_DIFFUSE_COLOUR) && (params->_findNamedConstantDefinition("cDiffuseColour")))
319 params->setNamedAutoConstant("cDiffuseColour", Ogre::GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR);
321 if ((permutationValue & SGBufferMaterialPermutation::SO3_GBP_HAS_SPECULAR_COLOUR) && (params->_findNamedConstantDefinition("cSpecularColour")))
322 params->setNamedAutoConstant("cSpecularColour", Ogre::GpuProgramParameters::ACT_SURFACE_SPECULAR_COLOUR);
324 if ((permutationValue & SGBufferMaterialPermutation::SO3_GBP_HAS_EMISSIVE_COLOUR) && (params->_findNamedConstantDefinition("cEmissiveColour")))
325 params->setNamedAutoConstant("cEmissiveColour", Ogre::GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR);
336Ogre::MaterialPtr SGBufferMaterialGenerator::GenerateTemplateMaterial(SGBuffer* gbuffer, Ogre::uint32 permutationValue)
338 Ogre::String matName = materialBaseName + "Mat_" + Ogre::StringConverter::toString(permutationValue);
340 Ogre::MaterialPtr matPtr = Ogre::MaterialManager::getSingleton().create(matName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
354 Ogre::uint32 numTextures = permutationValue & SGBufferMaterialPermutation::SO3_GBP_TEXTURE_MASK;
Definition SO3GBuffer.h:37
Ogre::String GetGBufferMaterialPixelOutputStructureTypeName()
Definition SO3GBuffer.cpp:48
Ogre::String GenerateGBufferMaterialPixelOutputStructure()
Definition SO3GBuffer.cpp:53
virtual Ogre::GpuProgramPtr GenerateVertexShader(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3GBufferMaterialGenerator.cpp:63
void FreeMaterial(const Ogre::MaterialPtr &ogreMaterial)
Definition SO3GBufferMaterialGenerator.cpp:43
SGBufferMaterialGenerator()
Definition SO3GBufferMaterialGenerator.cpp:39
virtual Ogre::MaterialPtr GenerateTemplateMaterial(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3GBufferMaterialGenerator.cpp:336
virtual Ogre::GpuProgramPtr GenerateFragmentShader(SGBuffer *gbuffer, Ogre::uint32 permutationValue)
Definition SO3GBufferMaterialGenerator.cpp:155
@ SO3_GBP_HAS_DIFFUSE_COLOUR
Definition SO3GBufferMaterialPermutation.h:50
@ SO3_GBP_LIGHT_MAP
Definition SO3GBufferMaterialPermutation.h:65
@ SO3_GBP_HAS_ALPHA_REJECTION
Definition SO3GBufferMaterialPermutation.h:53
@ SO3_GBP_SPECULAR_MAP
Definition SO3GBufferMaterialPermutation.h:68
@ SO3_GBP_HAS_EMISSIVE_COLOUR
Definition SO3GBufferMaterialPermutation.h:52
@ SO3_GBP_TEXCOORD_MASK
Definition SO3GBufferMaterialPermutation.h:59
@ SO3_GBP_HAS_SPECULAR_COLOUR
Definition SO3GBufferMaterialPermutation.h:51
@ SO3_GBP_NORMAL_MAP
Definition SO3GBufferMaterialPermutation.h:62
@ SO3_GBP_TEXTURE_MASK
Definition SO3GBufferMaterialPermutation.h:47
const Ogre::String materialBaseName
Base name of materials generated by this.
Definition SO3MaterialGenerator.h:50
Definition OgreNewt_Debugger.h:21
Definition SO3DataScol.h:38
Generated by 1.9.8