|
From: <axl...@us...> - 2009-06-21 14:01:13
|
Revision: 357
http://hgengine.svn.sourceforge.net/hgengine/?rev=357&view=rev
Author: axlecrusher
Date: 2009-06-21 13:49:48 +0000 (Sun, 21 Jun 2009)
Log Message:
-----------
don't use pair
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Mercury2/src/Shader.h
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-06-21 13:06:46 UTC (rev 356)
+++ Mercury2/src/Shader.cpp 2009-06-21 13:49:48 UTC (rev 357)
@@ -327,7 +327,7 @@
buffer[bufflen] = 0;
// m_uniforms[buffer] = glGetUniformLocationARB( iProgramID, buffer );
int location = glGetUniformLocationARB( iProgramID, buffer );
- m_uniforms.push_back( std::pair<MString,int> (buffer, location) );
+ m_uniforms.push_back( UniformMap(buffer, location) );
}
return true;
}
@@ -411,10 +411,10 @@
GLERRORCHECK;
//set attributes here
- std::list< std::pair< MString, int > >::iterator ui = m_uniforms.begin();
+ std::list< UniformMap >::iterator ui = m_uniforms.begin();
for (;ui != m_uniforms.end(); ++ui)
{
- std::map< MString, ShaderAttribute >::iterator sai = m_globalAttributes.find( ui->first );
+ std::map< MString, ShaderAttribute >::iterator sai = m_globalAttributes.find( ui->name );
if (sai != m_globalAttributes.end())
{
SetAttributeInternal(sai->first, sai->second);
@@ -432,9 +432,9 @@
{
if ( !iProgramID ) return -1;
- std::list< std::pair< MString, int > >::iterator i = m_uniforms.begin();
+ std::list< UniformMap >::iterator i = m_uniforms.begin();
for (;i != m_uniforms.end(); ++i)
- if (i->first == n) return i->second;
+ if (i->name == n) return i->id;
return -1;
}
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-06-21 13:06:46 UTC (rev 356)
+++ Mercury2/src/Shader.h 2009-06-21 13:49:48 UTC (rev 357)
@@ -50,6 +50,16 @@
std::map< MString, ShaderAttribute * > m_AllShaderAttributes;
};
+class UniformMap
+{
+ public:
+ UniformMap(MString n, int i)
+ :name(n), id(i)
+ {}
+ MString name;
+ int id;
+};
+
///Basic element for turning shaders on and off
/** This class helps aide in the loading and use of shaders. It allows loading of files
through the LoadShader() function that actively looks for .frag and .vert files. By use
@@ -150,7 +160,7 @@
/** These are the attributes linked into the shader.
There are so few uniforms in a shader that a list with
a linear search should be faster than a tree*/
- std::list< std::pair< MString, int > > m_uniforms;
+ std::list< UniformMap > m_uniforms;
///Name of the shader
MString sShaderName;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|