コード例 #1
0
ファイル: OgreShaderProgram.cpp プロジェクト: yiliu1203/OGRE
UniformParameterPtr Program::resolveParameter(GpuProgramParameters::AutoConstantType autoType, size_t data)
{
    UniformParameterPtr param;

    // Check if parameter already exists.
    param = getParameterByAutoType(autoType);
    if (param)
    {
        return param;
    }
    
    // Create new parameter
    size_t size = 0;
    if(isArray(autoType)) std::swap(size, data); // for array autotypes the extra parameter is the size

    param = UniformParameterPtr(OGRE_NEW UniformParameter(autoType, data, size));
    addParameter(param);

    return param;
}
コード例 #2
0
//-----------------------------------------------------------------------------
UniformParameterPtr Program::resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, 
										   size_t data, size_t size)
{
	UniformParameterPtr param;

	// Check if parameter already exists.
	param = getParameterByAutoType(autoType);
	if (param.get() != NULL)
	{
		if (param->isAutoConstantIntParameter() &&
			param->getAutoConstantIntData() == data)
		{
			param->setSize(std::max(size, param->getSize()));
			return param;
		}
	}

	// Create new parameter.
	param = UniformParameterPtr(OGRE_NEW UniformParameter(autoType, data, size, type));
	addParameter(param);

	return param;
}