本文整理汇总了C++中GpuProgramParametersSharedPtr::_findRawAutoConstantEntryFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::_findRawAutoConstantEntryFloat方法的具体用法?C++ GpuProgramParametersSharedPtr::_findRawAutoConstantEntryFloat怎么用?C++ GpuProgramParametersSharedPtr::_findRawAutoConstantEntryFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuProgramParametersSharedPtr
的用法示例。
在下文中一共展示了GpuProgramParametersSharedPtr::_findRawAutoConstantEntryFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateMaxNumInstances
//-----------------------------------------------------------------------
size_t InstanceBatchShader::calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const
{
const size_t numBones = std::max<size_t>( 1, baseSubMesh->blendIndexToBoneIndexMap.size() );
mMaterial->load();
Technique *technique = mMaterial->getBestTechnique();
if( technique )
{
GpuProgramParametersSharedPtr vertexParam = technique->getPass(0)->getVertexProgramParameters();
GpuConstantDefinitionIterator itor = vertexParam->getConstantDefinitionIterator();
while( itor.hasMoreElements() )
{
const GpuConstantDefinition &constDef = itor.getNext();
if(((constDef.constType == GCT_MATRIX_3X4 ||
constDef.constType == GCT_MATRIX_4X3 || //OGL GLSL bitches without this
constDef.constType == GCT_MATRIX_2X4 ||
constDef.constType == GCT_FLOAT4) //OGL GLSL bitches without this
&& constDef.isFloat()) ||
((constDef.constType == GCT_MATRIX_DOUBLE_3X4 ||
constDef.constType == GCT_MATRIX_DOUBLE_4X3 || //OGL GLSL bitches without this
constDef.constType == GCT_MATRIX_DOUBLE_2X4 ||
constDef.constType == GCT_DOUBLE4) //OGL GLSL bitches without this
&& constDef.isDouble())
)
{
const GpuProgramParameters::AutoConstantEntry *entry =
vertexParam->_findRawAutoConstantEntryFloat( constDef.physicalIndex );
if( entry && (entry->paramType == GpuProgramParameters::ACT_WORLD_MATRIX_ARRAY_3x4 || entry->paramType == GpuProgramParameters::ACT_WORLD_DUALQUATERNION_ARRAY_2x4))
{
//Material is correctly done!
size_t arraySize = constDef.arraySize;
//Deal with GL "hacky" way of doing 4x3 matrices
if(entry->paramType == GpuProgramParameters::ACT_WORLD_MATRIX_ARRAY_3x4 && constDef.constType == GCT_FLOAT4)
arraySize /= 3;
else if(entry->paramType == GpuProgramParameters::ACT_WORLD_DUALQUATERNION_ARRAY_2x4 && constDef.constType == GCT_FLOAT4)
arraySize /= 2;
//Check the num of arrays
size_t retVal = arraySize / numBones;
if( flags & IM_USE16BIT )
{
if( baseSubMesh->vertexData->vertexCount * retVal > 0xFFFF )
retVal = 0xFFFF / baseSubMesh->vertexData->vertexCount;
}
if((retVal < 3 && entry->paramType == GpuProgramParameters::ACT_WORLD_MATRIX_ARRAY_3x4) ||
(retVal < 2 && entry->paramType == GpuProgramParameters::ACT_WORLD_DUALQUATERNION_ARRAY_2x4))
{
LogManager::getSingleton().logMessage( "InstanceBatchShader: Mesh " +
mMeshReference->getName() + " using material " +
mMaterial->getName() + " contains many bones. The amount of "
"instances per batch is very low. Performance benefits will "
"be minimal, if any. It might be even slower!",
LML_NORMAL );
}
return retVal;
}
}
}
//Reaching here means material is supported, but malformed
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"Material '" + mMaterial->getName() + "' is malformed for this instancing technique",
"InstanceBatchShader::calculateMaxNumInstances");
}
//Reaching here the material is just unsupported.
return 0;
}