本文整理汇总了C++中GpuProgramParametersSharedPtr::getFloatPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::getFloatPointer方法的具体用法?C++ GpuProgramParametersSharedPtr::getFloatPointer怎么用?C++ GpuProgramParametersSharedPtr::getFloatPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuProgramParametersSharedPtr
的用法示例。
在下文中一共展示了GpuProgramParametersSharedPtr::getFloatPointer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePassIterationUniforms
//-----------------------------------------------------------------------
void GLSLESProgramPipeline::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
{
if (params->hasPassIterationNumber())
{
size_t index = params->getPassIterationNumberIndex();
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
// Need to find the uniform that matches the multi pass entry
for (; currentUniform != endUniform; ++currentUniform)
{
// Get the index in the parameter real list
if (index == currentUniform->mConstantDef->physicalIndex)
{
#if GL_EXT_separate_shader_objects && OGRE_PLATFORM != OGRE_PLATFORM_NACL
GLuint progID = 0;
if (mVertexProgram && currentUniform->mSourceProgType == GPT_VERTEX_PROGRAM)
{
if(!mVertexProgram->getUniformCache()->updateUniform(currentUniform->mLocation,
params->getFloatPointer(index),
currentUniform->mConstantDef->elementSize *
currentUniform->mConstantDef->arraySize *
sizeof(float)))
return;
progID = mVertexProgram->getGLSLProgram()->getGLProgramHandle();
OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));
}
if (mFragmentProgram && currentUniform->mSourceProgType == GPT_FRAGMENT_PROGRAM)
{
if(!mFragmentProgram->getUniformCache()->updateUniform(currentUniform->mLocation,
params->getFloatPointer(index),
currentUniform->mConstantDef->elementSize *
currentUniform->mConstantDef->arraySize *
sizeof(float)))
return;
progID = mFragmentProgram->getGLSLProgram()->getGLProgramHandle();
OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));
}
#endif
// There will only be one multipass entry
return;
}
}
}
}
示例2: bindProgramPassIterationParameters
void ATI_FS_GLGpuProgram::bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params)
{
if (params->hasPassIterationNumber())
{
size_t physicalIndex = params->getPassIterationNumberIndex();
size_t logicalIndex = params->getFloatLogicalIndexForPhysicalIndex(physicalIndex);
const float* pFloat = params->getFloatPointer(physicalIndex);
glSetFragmentShaderConstantATI( GL_CON_0_ATI + (GLuint)logicalIndex, pFloat);
}
}
示例3: _updateParameter
void FixedFuncPrograms::_updateParameter( GpuProgramParametersSharedPtr & programParameters, const String paramName, const void * value, const size_t sizeInBytes )
{
const GpuConstantDefinition& def = programParameters->getConstantDefinition(paramName);
if (def.isFloat())
{
memcpy((programParameters->getFloatPointer(def.physicalIndex)), value, sizeInBytes);
}
else
{
memcpy((programParameters->getIntPointer(def.physicalIndex)), value, sizeInBytes);
}
}
示例4: bindProgramPassIterationParameters
void GLArbGpuProgram::bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params)
{
if (params->hasPassIterationNumber())
{
GLenum type = getGLShaderType(mType);
size_t physicalIndex = params->getPassIterationNumberIndex();
size_t logicalIndex = params->getFloatLogicalIndexForPhysicalIndex(physicalIndex);
const float* pFloat = params->getFloatPointer(physicalIndex);
glProgramLocalParameter4fvARB(type, (GLuint)logicalIndex, pFloat);
}
}
示例5: bindProgramParameters
void ATI_FS_GLGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params)
{
// only supports float constants
const GpuLogicalBufferStruct* floatStruct = params->getFloatLogicalBufferStruct();
for (GpuLogicalIndexUseMap::const_iterator i = floatStruct->map.begin();
i != floatStruct->map.end(); ++i)
{
size_t logicalIndex = i->first;
const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
// Iterate over the params, set in 4-float chunks (low-level)
for (size_t j = 0; j < i->second.currentSize; j+=4)
{
glSetFragmentShaderConstantATI(GL_CON_0_ATI + logicalIndex, pFloat);
pFloat += 4;
++logicalIndex;
}
}
}
示例6: updatePassIterationUniforms
//-----------------------------------------------------------------------
void GLSLLinkProgram::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
{
if (params->hasPassIterationNumber())
{
size_t index = params->getPassIterationNumberIndex();
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
// Need to find the uniform that matches the multi pass entry
for (;currentUniform != endUniform; ++currentUniform)
{
// Get the index in the parameter real list
if (index == currentUniform->mConstantDef->physicalIndex)
{
OGRE_CHECK_GL_ERROR(glUniform1fv(currentUniform->mLocation, 1, params->getFloatPointer(index)));
// There will only be one multipass entry
return;
}
}
}
}
示例7: bindProgramParameters
void GLArbGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask)
{
GLenum type = getGLShaderType(mType);
// only supports float constants
GpuLogicalBufferStructPtr floatStruct = params->getFloatLogicalBufferStruct();
for (GpuLogicalIndexUseMap::const_iterator i = floatStruct->map.begin();
i != floatStruct->map.end(); ++i)
{
if (i->second.variability & mask)
{
size_t logicalIndex = i->first;
const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
// Iterate over the params, set in 4-float chunks (low-level)
for (size_t j = 0; j < i->second.currentSize; j+=4)
{
glProgramLocalParameter4fvARB(type, logicalIndex, pFloat);
pFloat += 4;
++logicalIndex;
}
}
}
}
示例8: updateUniforms
//-----------------------------------------------------------------------
void GLSLESProgramPipeline::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// Iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
#if OGRE_PLATFORM != OGRE_PLATFORM_NACL
GLuint progID = 0;
GLUniformCache* uniformCache=0;
if(fromProgType == GPT_VERTEX_PROGRAM)
{
progID = getVertexProgram()->getGLProgramHandle();
uniformCache = getVertexProgram()->getUniformCache();
}
else if(fromProgType == GPT_FRAGMENT_PROGRAM)
{
progID = mFragmentProgram->getGLProgramHandle();
uniformCache = mFragmentProgram->getUniformCache();
}
for (;currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called twice, once for vertex program params,
// and once for fragment program params.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
bool shouldUpdate = true;
switch (def->constType)
{
case GCT_INT1:
case GCT_INT2:
case GCT_INT3:
case GCT_INT4:
case GCT_SAMPLER1D:
case GCT_SAMPLER1DSHADOW:
case GCT_SAMPLER2D:
case GCT_SAMPLER2DSHADOW:
case GCT_SAMPLER3D:
case GCT_SAMPLERCUBE:
#if OGRE_NO_GLES3_SUPPORT == 0
case GCT_SAMPLER2DARRAY:
#endif
shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
params->getIntPointer(def->physicalIndex),
static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(int)));
break;
default:
shouldUpdate = uniformCache->updateUniform(currentUniform->mLocation,
params->getFloatPointer(def->physicalIndex),
static_cast<GLsizei>(def->elementSize * def->arraySize * sizeof(float)));
break;
}
if(!shouldUpdate)
continue;
// Get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT4:
OGRE_CHECK_GL_ERROR(glProgramUniform4fvEXT(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_2X2:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_3X3:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_4X4:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fvEXT(progID, currentUniform->mLocation, glArraySize,
GL_FALSE, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_INT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1ivEXT(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2ivEXT(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
//.........这里部分代码省略.........
示例9: updatePassIterationUniforms
void GLSLSeparableProgram::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
{
if (params->hasPassIterationNumber())
{
size_t index = params->getPassIterationNumberIndex();
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
// Need to find the uniform that matches the multi pass entry
for (;currentUniform != endUniform; ++currentUniform)
{
// Get the index in the parameter real list
if (index == currentUniform->mConstantDef->physicalIndex)
{
GLuint progID = 0;
if (mVertexShader && currentUniform->mSourceProgType == GPT_VERTEX_PROGRAM)
{
progID = mVertexShader->getGLProgramHandle();
}
if (mFragmentShader && currentUniform->mSourceProgType == GPT_FRAGMENT_PROGRAM)
{
progID = mFragmentShader->getGLProgramHandle();
}
if (mGeometryShader && currentUniform->mSourceProgType == GPT_GEOMETRY_PROGRAM)
{
progID = mGeometryShader->getGLProgramHandle();
}
if (mDomainShader && currentUniform->mSourceProgType == GPT_DOMAIN_PROGRAM)
{
progID = mDomainShader->getGLProgramHandle();
}
if (mHullShader && currentUniform->mSourceProgType == GPT_HULL_PROGRAM)
{
progID = mHullShader->getGLProgramHandle();
}
if (mComputeShader && currentUniform->mSourceProgType == GPT_COMPUTE_PROGRAM)
{
progID = mComputeShader->getGLProgramHandle();
}
OGRE_CHECK_GL_ERROR(glProgramUniform1fv(progID, currentUniform->mLocation, 1, params->getFloatPointer(index)));
// There will only be one multipass entry
return;
}
}
}
}
示例10: updateUniforms
void GLSLSeparableProgram::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// Iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
// determine if we need to transpose matrices when binding
int transpose = GL_TRUE;
if ((fromProgType == GPT_FRAGMENT_PROGRAM && mVertexShader && (!mVertexShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_VERTEX_PROGRAM && mFragmentShader && (!mFragmentShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_GEOMETRY_PROGRAM && mGeometryShader && (!mGeometryShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_HULL_PROGRAM && mHullShader && (!mHullShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_DOMAIN_PROGRAM && mDomainShader && (!mDomainShader->getColumnMajorMatrices())) ||
(fromProgType == GPT_COMPUTE_PROGRAM && mComputeShader && (!mComputeShader->getColumnMajorMatrices())))
{
transpose = GL_FALSE;
}
GLuint progID = 0;
if (fromProgType == GPT_VERTEX_PROGRAM)
{
progID = mVertexShader->getGLProgramHandle();
}
else if (fromProgType == GPT_FRAGMENT_PROGRAM)
{
progID = mFragmentShader->getGLProgramHandle();
}
else if (fromProgType == GPT_GEOMETRY_PROGRAM)
{
progID = mGeometryShader->getGLProgramHandle();
}
else if (fromProgType == GPT_HULL_PROGRAM)
{
progID = mHullShader->getGLProgramHandle();
}
else if (fromProgType == GPT_DOMAIN_PROGRAM)
{
progID = mDomainShader->getGLProgramHandle();
}
else if (fromProgType == GPT_COMPUTE_PROGRAM)
{
progID = mComputeShader->getGLProgramHandle();
}
for (; currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called once per shader stage.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
// Get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_FLOAT4:
OGRE_CHECK_GL_ERROR(glProgramUniform4fv(progID, currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_2X2:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix2fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_3X3:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix3fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_MATRIX_4X4:
OGRE_CHECK_GL_ERROR(glProgramUniformMatrix4fv(progID, currentUniform->mLocation, glArraySize,
transpose, params->getFloatPointer(def->physicalIndex)));
break;
case GCT_INT1:
OGRE_CHECK_GL_ERROR(glProgramUniform1iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT2:
OGRE_CHECK_GL_ERROR(glProgramUniform2iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT3:
OGRE_CHECK_GL_ERROR(glProgramUniform3iv(progID, currentUniform->mLocation, glArraySize,
params->getIntPointer(def->physicalIndex)));
break;
case GCT_INT4:
//.........这里部分代码省略.........
示例11: updateUniforms
//-----------------------------------------------------------------------
void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params,
uint16 mask, GpuProgramType fromProgType)
{
// iterate through uniform reference list and update uniform values
GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
for (; currentUniform != endUniform; ++currentUniform)
{
// Only pull values from buffer it's supposed to be in (vertex or fragment)
// This method will be called twice, once for vertex program params,
// and once for fragment program params.
if (fromProgType == currentUniform->mSourceProgType)
{
const GpuConstantDefinition* def = currentUniform->mConstantDef;
if (def->variability & mask)
{
GLsizei glArraySize = (GLsizei)def->arraySize;
// get the index in the parameter real list
switch (def->constType)
{
case GCT_FLOAT1:
glUniform1fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT2:
glUniform2fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT3:
glUniform3fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_FLOAT4:
glUniform4fvARB(currentUniform->mLocation, glArraySize,
params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_2X2:
glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_2X3:
if (GLEW_VERSION_2_1)
{
glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_2X4:
if (GLEW_VERSION_2_1)
{
glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_3X2:
if (GLEW_VERSION_2_1)
{
glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_3X3:
glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_MATRIX_3X4:
if (GLEW_VERSION_2_1)
{
glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X2:
if (GLEW_VERSION_2_1)
{
glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X3:
if (GLEW_VERSION_2_1)
{
glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
}
break;
case GCT_MATRIX_4X4:
glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize,
GL_TRUE, params->getFloatPointer(def->physicalIndex));
break;
case GCT_INT1:
glUniform1ivARB(currentUniform->mLocation, glArraySize,
(GLint*)params->getIntPointer(def->physicalIndex));
break;
case GCT_INT2:
glUniform2ivARB(currentUniform->mLocation, glArraySize,
//.........这里部分代码省略.........