|
From: <axl...@us...> - 2009-05-15 00:52:40
|
Revision: 247
http://hgengine.svn.sourceforge.net/hgengine/?rev=247&view=rev
Author: axlecrusher
Date: 2009-05-15 00:52:32 +0000 (Fri, 15 May 2009)
Log Message:
-----------
instance shaders
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Mercury2/src/Shader.h
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-05-14 22:34:39 UTC (rev 246)
+++ Mercury2/src/Shader.cpp 2009-05-15 00:52:32 UTC (rev 247)
@@ -81,11 +81,19 @@
void Shader::LoadFromXML(const XMLNode& node)
{
- sShaderName = node.Attribute("file");
- fPriority = StrToFloat( node.Attribute("priority").c_str() );
- LoadShader( );
+ LoadShader( node.Attribute("file"), StrToFloat( node.Attribute("priority") ) );
}
+void Shader::LoadShader( const MString& path, float priority )
+{
+ if (m_isInstanced) return;
+
+ sShaderName = path;
+ fPriority = priority;
+ ADD_ASSET_INSTANCE(Shader, sShaderName, this);
+ LoadShader( );
+}
+
bool Shader::LoadShader( )
{
GetTimeCodes( iTimeCode );
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-05-14 22:34:39 UTC (rev 246)
+++ Mercury2/src/Shader.h 2009-05-15 00:52:32 UTC (rev 247)
@@ -72,6 +72,8 @@
///Explicitly get the OpenGL ProgramID in the event you need it for advanced techniques
unsigned int GetProgramID() { return iProgramID; }
private:
+ void LoadShader( const MString& path, float priority );
+
///Suggested function for loading shaders.
/** This function looks for {sShaderName}.vert and {sShaderName}.frag. It will
attempt to load, compile and link the files. If any errors are found, they will
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|