コード例 #1
0
//-----------------------------------------------------------------------
UniformParameterPtr ParameterFactory::createSamplerCUBE(int index)
{
	return UniformParameterPtr(OGRE_NEW UniformParameter(GCT_SAMPLERCUBE, "gSamplerCUBE_" + StringConverter::toString(index), 
		Parameter::SPS_UNKNOWN, index, 
		Parameter::SPC_UNKNOWN,
		(uint16)GPV_GLOBAL));
}
コード例 #2
0
//-----------------------------------------------------------------------
UniformParameterPtr ParameterFactory::createUniform(GpuConstantType type, 
											 int index, uint16 variability,
											 const String& suggestedName)
{
	UniformParameterPtr param;
	
	param = UniformParameterPtr(OGRE_NEW UniformParameter(type, suggestedName + StringConverter::toString(index), 
		Parameter::SPS_UNKNOWN, index, 
		Parameter::SPC_UNKNOWN, variability));
		
	return param;
}
コード例 #3
0
//-----------------------------------------------------------------------------
UniformParameterPtr Program::getParameterByAutoType(GpuProgramParameters::AutoConstantType autoType)
{
	UniformParameterIterator it;

	for (it = mParameters.begin(); it != mParameters.end(); ++it)
	{
		if ((*it)->isAutoConstantParameter() && (*it)->getAutoConstantType() == autoType)
		{
			return *it;
		}
	}

	return UniformParameterPtr();
}
コード例 #4
0
//-----------------------------------------------------------------------------
UniformParameterPtr Program::getParameterByName(const String& name)
{
	UniformParameterIterator it;

	for (it = mParameters.begin(); it != mParameters.end(); ++it)
	{
		if ((*it)->getName() == name)
		{
			return *it;
		}
	}

	return UniformParameterPtr();
}
コード例 #5
0
//-----------------------------------------------------------------------------
UniformParameterPtr Program::getParameterByType(GpuConstantType type, int index)
{
	UniformParameterIterator it;

	for (it = mParameters.begin(); it != mParameters.end(); ++it)
	{
		if ((*it)->getType() == type &&
			(*it)->getIndex() == index)
		{
			return *it;
		}
	}

	return UniformParameterPtr();
}
コード例 #6
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;
}
コード例 #7
0
//-----------------------------------------------------------------------
UniformParameterPtr ParameterFactory::createSampler(GpuConstantType type, int index)
{
	switch (type)
	{
	case GCT_SAMPLER1D:
		return createSampler1D(index);

	case GCT_SAMPLER2D:
		return createSampler2D(index);

	case GCT_SAMPLER3D:
		return createSampler3D(index);

	case GCT_SAMPLERCUBE:
		return createSamplerCUBE(index);

    default:
    case GCT_SAMPLER1DSHADOW:
    case GCT_SAMPLER2DSHADOW:
    case GCT_MATRIX_2X2:
    case GCT_MATRIX_2X3:
    case GCT_MATRIX_2X4:
    case GCT_MATRIX_3X2:
    case GCT_MATRIX_3X3:
    case GCT_MATRIX_3X4:
    case GCT_MATRIX_4X2:
    case GCT_MATRIX_4X3:
    case GCT_MATRIX_4X4:
    case GCT_INT1:
    case GCT_INT2:
    case GCT_INT3:
    case GCT_INT4:
    case GCT_UNKNOWN:
        break;
	}

	return UniformParameterPtr();
	
}
コード例 #8
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;
}