Example #1
0
//-----------------------------------------------------------------------------------------------
inline bool Material::SetProjectionMatrixUniform( const std::string& uniformName )
{
	int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
	if( uniformID == -1 )
		return false;

	m_projectionMatrixUniformLocation = uniformID;
	return true;
}
Example #2
0
//-----------------------------------------------------------------------------------------------
inline bool Material::SetIntegerUniform( const std::string& uniformName, int value )
{
	int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
	if( uniformID == -1 )
		return false;

	Renderer* renderer = Renderer::GetRenderer();
	renderer->SetUniformVariable( uniformID, value );
	return true;
}
Example #3
0
//-----------------------------------------------------------------------------------------------
inline bool Material::SetFloatUniform( const std::string& uniformName, const FloatVector4& vector )
{
	int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
	if( uniformID == -1 )
		return false;

	Renderer* renderer = Renderer::GetRenderer();
	renderer->SetUniformVariable( uniformID, vector );
	return true;
}
Example #4
0
//-----------------------------------------------------------------------------------------------
inline bool Material::SetTextureUniform( const std::string& uniformName, int textureUnitID, const std::string& textureFileLocation )
{
	int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
	if( uniformID == -1 )
		return false;

	Renderer* renderer = Renderer::GetRenderer();
	TextureInfo texInfo;

	texInfo.textureUnitID = textureUnitID;
	renderer->SetActiveTextureUnit( textureUnitID );

	texInfo.texture = Texture::CreateOrGetTexture( textureFileLocation, Texture::linearInterpolation, Texture::clampToEdge );
	renderer->SetUniformVariable( uniformID, textureUnitID );

	texInfo.samplerUniformID = uniformID;
	m_infoForTextures.push_back( texInfo );

	return true;
}