|
From: <cn...@us...> - 2009-11-08 23:15:54
|
Revision: 608
http://hgengine.svn.sourceforge.net/hgengine/?rev=608&view=rev
Author: cnlohr
Date: 2009-11-08 23:15:45 +0000 (Sun, 08 Nov 2009)
Log Message:
-----------
add framework for attributes + make quads able to have straight V's for normal texture mapping
Modified Paths:
--------------
Mercury2/src/Quad.cpp
Mercury2/src/Quad.h
Modified: Mercury2/src/Quad.cpp
===================================================================
--- Mercury2/src/Quad.cpp 2009-11-08 15:48:23 UTC (rev 607)
+++ Mercury2/src/Quad.cpp 2009-11-08 23:15:45 UTC (rev 608)
@@ -6,7 +6,7 @@
REGISTER_ASSET_TYPE(Quad);
Quad::Quad( const MString & key, bool bInstanced )
- :MercuryVBO( key, bInstanced )
+ :MercuryVBO( key, bInstanced ), m_bFlipV( true )
{
ChangeKey( key );
}
@@ -35,6 +35,7 @@
float hX = 0.5;
float hY = 0.5;
float zp = 0;
+ m_bFlipV = true;
AllocateIndexSpace(6);
AllocateVertexSpace(4);
@@ -42,6 +43,20 @@
MVector< MString > vsDescription;
SplitStrings( sDescription, vsDescription, ",", " ", 1, 1 );
+ //First, check for known attributes...
+ do
+ {
+ if( !vsDescription.size() )
+ break;
+
+ if( vsDescription[0] == "straightv" )
+ {
+ m_bFlipV = false;
+ vsDescription.remove( 0 );
+ }
+
+ } while(1);
+
if( vsDescription.size() == 0 )
{
//Do nothing
@@ -73,19 +88,19 @@
//UV oriented so 0,0 is lower left and 1,0 upper right.
//this makes it so FBO images render correctly right out of the buffer, no flip needed
- m_vertexData[i++] = 0; m_vertexData[i++] = 0;
+ m_vertexData[i++] = 0; m_vertexData[i++] = (m_bFlipV)?0:1;
m_vertexData[i++] = 0; m_vertexData[i++] = 0; m_vertexData[i++] = -1.0;
m_vertexData[i++] = lX; m_vertexData[i++] = lY; m_vertexData[i++] = zp;
- m_vertexData[i++] = 1; m_vertexData[i++] = 0;
+ m_vertexData[i++] = 1; m_vertexData[i++] = (m_bFlipV)?0:1;
m_vertexData[i++] = 0; m_vertexData[i++] = 0; m_vertexData[i++] = -1.0;
m_vertexData[i++] = hX; m_vertexData[i++] = lY; m_vertexData[i++] = zp;
- m_vertexData[i++] = 1; m_vertexData[i++] = 1;
+ m_vertexData[i++] = 1; m_vertexData[i++] = (m_bFlipV)?1:0;
m_vertexData[i++] = 0; m_vertexData[i++] = 0; m_vertexData[i++] = -1.0;
m_vertexData[i++] = hX; m_vertexData[i++] = hY; m_vertexData[i++] = zp;
- m_vertexData[i++] = 0; m_vertexData[i++] = 1;
+ m_vertexData[i++] = 0; m_vertexData[i++] = (m_bFlipV)?1:0;
m_vertexData[i++] = 0; m_vertexData[i++] = 0; m_vertexData[i++] = -1.0;
m_vertexData[i++] = lX; m_vertexData[i++] = hY; m_vertexData[i++] = zp;
Modified: Mercury2/src/Quad.h
===================================================================
--- Mercury2/src/Quad.h 2009-11-08 15:48:23 UTC (rev 607)
+++ Mercury2/src/Quad.h 2009-11-08 23:15:45 UTC (rev 608)
@@ -14,7 +14,9 @@
virtual bool ChangeKey( const MString & sDescription );
GENRTTI( Quad );
+
private:
+ bool m_bFlipV;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|