|
From: <axl...@us...> - 2009-06-04 01:22:34
|
Revision: 305
http://hgengine.svn.sourceforge.net/hgengine/?rev=305&view=rev
Author: axlecrusher
Date: 2009-06-04 00:34:24 +0000 (Thu, 04 Jun 2009)
Log Message:
-----------
billboarding works
Modified Paths:
--------------
Mercury2/modules/BillboardNode.cpp
Mercury2/modules/BillboardNode.h
Mercury2/scenegraph.xml
Modified: Mercury2/modules/BillboardNode.cpp
===================================================================
--- Mercury2/modules/BillboardNode.cpp 2009-06-04 00:29:27 UTC (rev 304)
+++ Mercury2/modules/BillboardNode.cpp 2009-06-04 00:34:24 UTC (rev 305)
@@ -6,8 +6,6 @@
MercuryMatrix BillboardNode::ManipulateMatrix(const MercuryMatrix& matrix)
{
- MercuryMatrix m = RenderableNode::ManipulateMatrix( matrix );
-
//Compute the object's center point (position?) in world space
MercuryVertex center(0,0,0,1);
center = matrix * center;
@@ -18,29 +16,22 @@
//vector from object to eye projected on XZ
objToEyeProj[1] = 0; objToEyeProj.NormalizeSelf();
-// MercuryVector objLookAt(0,0,1); //origional look vector of object
-// objLookAt = matrix * objLookAt; //convert to world space
-// objLookAt.NormalizeSelf();
+ MercuryVector objLookAt(0,0,-1); //origional look vector of object
-// objLookAt.Print();
-
-// MercuryVector up = (objLookAt.CrossProduct( objToEyeProj )).Normalize();
-// up = objLookAt;
-// up.Print();
-
- MercuryVector up(0,0,1); //we wan't the camera's up
-
- float angleCos = LOOKAT.DotProduct(objToEyeProj);
+ MercuryVector up = objLookAt.CrossProduct(objToEyeProj);
+ float angleCos = objLookAt.DotProduct(objToEyeProj);
- if ((angleCos < 0.99990) && (angleCos > -0.9999))
- {
- float f = ACOS(angleCos)*RADDEG;
- MercuryMatrix mtmp;
- mtmp.RotateAngAxis(f, up[0], up[1], up[2]);
- m = m * mtmp;
- }
+ float f = ACOS(angleCos);//*RADDEG;
+ if (up[1] < 0) f *= -1;
- //spherical below
+ //needs to be the local axis to rotate around
+ MercuryMatrix global(matrix);
+ MQuaternion mtmp = MQuaternion::CreateFromAxisAngle(MercuryVector(0,0,1), f);
+ global.Rotate( mtmp );
+
+ MercuryMatrix m = RenderableNode::ManipulateMatrix( global );
+
+/* //spherical below
objToEye.NormalizeSelf();
angleCos = objToEyeProj.DotProduct( objToEye );
if ((angleCos < 0.99990) && (angleCos > -0.9999))
@@ -53,15 +44,23 @@
else
mtmp.RotateAngAxis(f, -1, 0, 0);
// m.Print();
- m = m * mtmp;
+// m = m * mtmp;
// m.Print();
printf("********************\n");
// mtmp.Print();
}
-
+*/
return m;
}
+void BillboardNode::LoadFromXML(const XMLNode& node)
+{
+ RenderableNode::LoadFromXML(node);
+
+ if ( !node.Attribute("billboardaxis").empty() )
+ m_billboardAxis = MercuryVector::CreateFromString( node.Attribute("billboardaxis") );
+}
+
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
* *
Modified: Mercury2/modules/BillboardNode.h
===================================================================
--- Mercury2/modules/BillboardNode.h 2009-06-04 00:29:27 UTC (rev 304)
+++ Mercury2/modules/BillboardNode.h 2009-06-04 00:34:24 UTC (rev 305)
@@ -2,13 +2,16 @@
#define BILLBOARDNODE_H
#include <RenderableNode.h>
+#include <MercuryVertex.h>
class BillboardNode : public RenderableNode
{
public:
virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
+ virtual void LoadFromXML(const XMLNode& node);
private:
+ MercuryVector m_billboardAxis;
};
#endif
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-04 00:29:27 UTC (rev 304)
+++ Mercury2/scenegraph.xml 2009-06-04 00:34:24 UTC (rev 305)
@@ -16,7 +16,7 @@
<asset type="texture" file="lamp.png"/>
<node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
<node type="transformnode" rotx="-90" name="lamp">
- <node type="renderablenode" >
+ <node type="billboardnode" billboardaxis="0,0,1" >
<asset type="hgmdlmodel" file="lamp.hgmdl" />
</node>
</node>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-05 00:45:56
|
Revision: 309
http://hgengine.svn.sourceforge.net/hgengine/?rev=309&view=rev
Author: axlecrusher
Date: 2009-06-05 00:45:50 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
sherical billboarding works now
Modified Paths:
--------------
Mercury2/modules/BillboardNode.cpp
Mercury2/modules/BillboardNode.h
Mercury2/scenegraph.xml
Modified: Mercury2/modules/BillboardNode.cpp
===================================================================
--- Mercury2/modules/BillboardNode.cpp 2009-06-04 10:46:55 UTC (rev 308)
+++ Mercury2/modules/BillboardNode.cpp 2009-06-05 00:45:50 UTC (rev 309)
@@ -4,6 +4,11 @@
REGISTER_NODE_TYPE(BillboardNode);
+BillboardNode::BillboardNode()
+ :m_sphere(false)
+{
+}
+
MercuryMatrix BillboardNode::ManipulateMatrix(const MercuryMatrix& matrix)
{
//Compute the object's center point (position?) in world space
@@ -27,30 +32,21 @@
//needs to be the local axis to rotate around
MercuryMatrix global(matrix);
MQuaternion mtmp = MQuaternion::CreateFromAxisAngle(m_billboardAxis, f);
- global.Rotate( mtmp );
-
- MercuryMatrix m = RenderableNode::ManipulateMatrix( global );
-
-/* //spherical below
- objToEye.NormalizeSelf();
- angleCos = objToEyeProj.DotProduct( objToEye );
- if ((angleCos < 0.99990) && (angleCos > -0.9999))
+
+ //spherical below
+ if ( m_sphere )
{
- printf("%f\n", angleCos);
- float f = ACOS(angleCos)*RADDEG;
- MercuryMatrix mtmp;
- if (objToEye[1] < 0)
- mtmp.RotateAngAxis(f, 1, 0, 0);
- else
- mtmp.RotateAngAxis(f, -1, 0, 0);
-// m.Print();
-// m = m * mtmp;
-// m.Print();
- printf("********************\n");
-// mtmp.Print();
+ objToEye.NormalizeSelf();
+ angleCos = objToEyeProj.DotProduct( objToEye );
+ f = ACOS(angleCos);
+ printf("%f %f\n", angleCos, f);
+ if (objToEye[1] < 0) f *= -1;
+ if (angleCos < 0.99999) mtmp *= MQuaternion::CreateFromAxisAngle(MercuryVector(1,0,0), f);
}
-*/
- return m;
+
+ global.Rotate( mtmp );
+
+ return RenderableNode::ManipulateMatrix( global );
}
void BillboardNode::LoadFromXML(const XMLNode& node)
@@ -59,6 +55,9 @@
if ( !node.Attribute("billboardaxis").empty() )
m_billboardAxis = MercuryVector::CreateFromString( node.Attribute("billboardaxis") );
+
+ if ( !node.Attribute("spheremode").empty() )
+ m_sphere = node.Attribute("spheremode") == "true"?true:false;
}
/****************************************************************************
Modified: Mercury2/modules/BillboardNode.h
===================================================================
--- Mercury2/modules/BillboardNode.h 2009-06-04 10:46:55 UTC (rev 308)
+++ Mercury2/modules/BillboardNode.h 2009-06-05 00:45:50 UTC (rev 309)
@@ -7,11 +7,14 @@
class BillboardNode : public RenderableNode
{
public:
+ BillboardNode();
+
virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
virtual void LoadFromXML(const XMLNode& node);
private:
MercuryVector m_billboardAxis;
+ bool m_sphere;
};
#endif
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-04 10:46:55 UTC (rev 308)
+++ Mercury2/scenegraph.xml 2009-06-05 00:45:50 UTC (rev 309)
@@ -16,7 +16,7 @@
<asset type="texture" file="lamp.png"/>
<node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
<node type="transformnode" rotx="-90" name="lamp">
- <node type="billboardnode" billboardaxis="0,0,1" >
+ <node type="billboardnode" billboardaxis="0,0,1" spheremode="true" >
<asset type="hgmdlmodel" file="lamp.hgmdl" />
</node>
</node>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-07 23:58:41
|
Revision: 311
http://hgengine.svn.sourceforge.net/hgengine/?rev=311&view=rev
Author: axlecrusher
Date: 2009-06-07 23:58:40 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
make billboard a type of transform node
Modified Paths:
--------------
Mercury2/modules/BillboardNode.cpp
Mercury2/modules/BillboardNode.h
Mercury2/scenegraph.xml
Mercury2/src/TransformNode.cpp
Mercury2/src/TransformNode.h
Modified: Mercury2/modules/BillboardNode.cpp
===================================================================
--- Mercury2/modules/BillboardNode.cpp 2009-06-05 01:00:49 UTC (rev 310)
+++ Mercury2/modules/BillboardNode.cpp 2009-06-07 23:58:40 UTC (rev 311)
@@ -5,15 +5,17 @@
REGISTER_NODE_TYPE(BillboardNode);
BillboardNode::BillboardNode()
- :m_sphere(false)
+ :TransformNode(), m_sphere(false)
{
}
-MercuryMatrix BillboardNode::ManipulateMatrix(const MercuryMatrix& matrix)
+void BillboardNode::Update(float dTime)
{
+ TransformNode::Update( dTime );
+
//Compute the object's center point (position?) in world space
MercuryVertex center(0,0,0,1);
- center = matrix * center;
+ center = TransformNode::GetGlobalMatrix() * center;
MercuryVector objToEye = (EYE - center);
MercuryVector objToEyeProj( objToEye );
@@ -30,7 +32,7 @@
if (up[1] < 0) f *= -1;
//needs to be the local axis to rotate around
- MercuryMatrix global(matrix);
+ MercuryMatrix global( TransformNode::GetGlobalMatrix() );
MQuaternion mtmp = MQuaternion::CreateFromAxisAngle(m_billboardAxis, f);
//spherical below
@@ -45,12 +47,20 @@
global.Rotate( mtmp );
- return RenderableNode::ManipulateMatrix( global );
+ m_billboardMatrix = global;
+
+ //notify children that our global matrix has changed
+ SetTaint(true);
}
+const MercuryMatrix& BillboardNode::GetGlobalMatrix() const
+{
+ return m_billboardMatrix;
+}
+
void BillboardNode::LoadFromXML(const XMLNode& node)
{
- RenderableNode::LoadFromXML(node);
+ TransformNode::LoadFromXML(node);
if ( !node.Attribute("billboardaxis").empty() )
m_billboardAxis = MercuryVector::CreateFromString( node.Attribute("billboardaxis") );
Modified: Mercury2/modules/BillboardNode.h
===================================================================
--- Mercury2/modules/BillboardNode.h 2009-06-05 01:00:49 UTC (rev 310)
+++ Mercury2/modules/BillboardNode.h 2009-06-07 23:58:40 UTC (rev 311)
@@ -1,20 +1,27 @@
#ifndef BILLBOARDNODE_H
#define BILLBOARDNODE_H
-#include <RenderableNode.h>
+#include <TransformNode.h>
#include <MercuryVertex.h>
-class BillboardNode : public RenderableNode
+class BillboardNode : public TransformNode
{
public:
BillboardNode();
- virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
+ virtual void Update(float dTime);
+
+// virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
+ virtual const MercuryMatrix& GetGlobalMatrix() const;
+
virtual void LoadFromXML(const XMLNode& node);
+ GENRTTI(BillboardNode);
+
private:
MercuryVector m_billboardAxis;
bool m_sphere;
+ MercuryMatrix m_billboardMatrix;
};
#endif
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-05 01:00:49 UTC (rev 310)
+++ Mercury2/scenegraph.xml 2009-06-07 23:58:40 UTC (rev 311)
@@ -17,7 +17,9 @@
<node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
<node type="transformnode" rotx="-90" name="lamp">
<node type="billboardnode" billboardaxis="0,0,1" spheremode="true" >
- <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ <node type="renderablenode">
+ <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ </node>
</node>
</node>
<node type="transformnode" movx="1" fallback="lampForest.lamprow.lamp" />
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-06-05 01:00:49 UTC (rev 310)
+++ Mercury2/src/TransformNode.cpp 2009-06-07 23:58:40 UTC (rev 311)
@@ -154,6 +154,11 @@
}
}
+const MercuryMatrix& TransformNode::GetGlobalMatrix() const
+{
+ return m_globalMatrix;
+}
+
void RotatorNode::Update(float dTime)
{
MQuaternion r = GetRotation();
Modified: Mercury2/src/TransformNode.h
===================================================================
--- Mercury2/src/TransformNode.h 2009-06-05 01:00:49 UTC (rev 310)
+++ Mercury2/src/TransformNode.h 2009-06-07 23:58:40 UTC (rev 311)
@@ -23,7 +23,8 @@
inline const MercuryVertex& GetPosition() const { return m_position; }
inline const MQuaternion& GetRotation() const { return m_rotation; }
- inline const MercuryMatrix& GetGlobalMatrix() const { return m_globalMatrix; }
+// inline const MercuryMatrix& GetGlobalMatrix() const { return m_globalMatrix; }
+ virtual const MercuryMatrix& GetGlobalMatrix() const;
const MercuryMatrix& GetParentMatrix() const;
void SetTaint(bool taint);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-13 01:13:22
|
Revision: 314
http://hgengine.svn.sourceforge.net/hgengine/?rev=314&view=rev
Author: axlecrusher
Date: 2009-06-13 01:13:21 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
FBO
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/scenegraph.xml
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-13 01:11:52 UTC (rev 313)
+++ Mercury2/adv_set.c 2009-06-13 01:13:21 UTC (rev 314)
@@ -11,7 +11,8 @@
src/HGMDLModel.cpp src/MercuryString.cpp src/MercuryCrash.c src/MercuryBacktrace.c \
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
- src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp"
+ src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
+ src/RenderBuffer.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-13 01:11:52 UTC (rev 313)
+++ Mercury2/scenegraph.xml 2009-06-13 01:13:21 UTC (rev 314)
@@ -12,28 +12,31 @@
<asset type="hgmdlmodel" file="map.hgmdl" />
</node>
</node>
- <node type="renderablenode" name="lampForest">
- <asset type="texture" file="lamp.png"/>
- <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
- <node type="transformnode" rotx="-90" name="lamp">
- <node type="billboardnode" billboardaxis="0,0,1" spheremode="true" >
- <node type="renderablenode">
- <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ <node type="mercuryfbo" >
+ <asset type="renderbuffer" buffertype="texture" />
+ <node type="renderablenode" name="lampForest">
+ <asset type="texture" file="lamp.png"/>
+ <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
+ <node type="transformnode" rotx="-90" name="lamp">
+ <node type="billboardnode" billboardaxis="0,0,1" spheremode="true" >
+ <node type="renderablenode">
+ <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ </node>
</node>
</node>
+ <node type="transformnode" movx="1" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movx="2" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movx="3" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movx="-1" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movx="-2" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movx="-3" fallback="lampForest.lamprow.lamp" />
</node>
- <node type="transformnode" movx="1" fallback="lampForest.lamprow.lamp" />
- <node type="transformnode" movx="2" fallback="lampForest.lamprow.lamp" />
- <node type="transformnode" movx="3" fallback="lampForest.lamprow.lamp" />
- <node type="transformnode" movx="-1" fallback="lampForest.lamprow.lamp" />
- <node type="transformnode" movx="-2" fallback="lampForest.lamprow.lamp" />
- <node type="transformnode" movx="-3" fallback="lampForest.lamprow.lamp" />
+ <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
</node>
- <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
</node>
</SceneGraph>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-13 02:35:27
|
Revision: 315
http://hgengine.svn.sourceforge.net/hgengine/?rev=315&view=rev
Author: axlecrusher
Date: 2009-06-13 02:35:10 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
error checking
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/src/GLHeaders.h
Mercury2/src/MercuryFBO.cpp
Mercury2/src/RenderBuffer.cpp
Added Paths:
-----------
Mercury2/src/GLHelpers.cpp
Mercury2/src/GLHelpers.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-13 01:13:21 UTC (rev 314)
+++ Mercury2/adv_set.c 2009-06-13 02:35:10 UTC (rev 315)
@@ -12,7 +12,7 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/RenderBuffer.cpp"
+ src/RenderBuffer.cpp src/GLHelpers.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/src/GLHeaders.h
===================================================================
--- Mercury2/src/GLHeaders.h 2009-06-13 01:13:21 UTC (rev 314)
+++ Mercury2/src/GLHeaders.h 2009-06-13 02:35:10 UTC (rev 315)
@@ -18,4 +18,19 @@
#include <GL/freeglut.h>
#endif
+#include <GLHelpers.h>
+
+#define GLERRORCHECK { \
+uint32_t e = glGetError(); \
+if ( e != GL_NO_ERROR ) { \
+printf("GL Error:%s\n", GlError2String(e).c_str()); \
+assert(0); } }
+
+#define CHECKFBO { \
+uint32_t e = glCheckFramebufferStatus(GL_FRAMEBUFFER); \
+if ( e != GL_FRAMEBUFFER_COMPLETE ) { \
+printf("GL FBO Error:%s\n", GlError2String(e).c_str()); \
+assert(0); } }
+
+
#endif
\ No newline at end of file
Added: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp (rev 0)
+++ Mercury2/src/GLHelpers.cpp 2009-06-13 02:35:10 UTC (rev 315)
@@ -0,0 +1,72 @@
+#include <GLHeaders.h>
+#include <GLHelpers.h>
+
+MString GlError2String(uint32_t e)
+{
+ switch (e)
+ {
+ case GL_INVALID_ENUM:
+ return "Invalid Enum";
+ case GL_INVALID_VALUE:
+ return "Invalid Value";
+ case GL_INVALID_OPERATION:
+ return "Invalid Operation";
+ case GL_STACK_OVERFLOW:
+ return "Stack Overflow";
+ case GL_STACK_UNDERFLOW:
+ return "Stack Underflow";
+ case GL_OUT_OF_MEMORY:
+ return "Out of Memory";
+ case GL_INVALID_FRAMEBUFFER_OPERATION:
+ return "Invalid FBO Operation";
+ case GL_FRAMEBUFFER_UNSUPPORTED:
+ return "FBO Unsupported";
+ case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
+ return "FBO Incomplete Attachment";
+ case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
+ return "FBO Incomplete Missing Attachment";
+// case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
+// return "FBO Incomplete Dimensions";
+// case GL_FRAMEBUFFER_INCOMPLETE_FORMATS:
+// return "FBO Incomplete Formats";
+ case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
+ return "FBO Incomplete Draw Buffer";
+ case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
+ return "FBO Incomplete Read Buffer";
+ case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
+ return "FBO Incomplete Multisample";
+ }
+ return "Unknown Error";
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/GLHelpers.h
===================================================================
--- Mercury2/src/GLHelpers.h (rev 0)
+++ Mercury2/src/GLHelpers.h 2009-06-13 02:35:10 UTC (rev 315)
@@ -0,0 +1,36 @@
+#include <global.h>
+#include <MercuryUtil.h>
+
+MString GlError2String(uint32_t e);
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-06-13 01:13:21 UTC (rev 314)
+++ Mercury2/src/MercuryFBO.cpp 2009-06-13 02:35:10 UTC (rev 315)
@@ -17,6 +17,8 @@
{
m_initiated = true;
glGenFramebuffersEXT(1, &m_fboID);
+ CHECKFBO;
+ GLERRORCHECK;
}
void MercuryFBO::PreRender(const MercuryMatrix& matrix)
@@ -30,6 +32,8 @@
if (m_lastRendered != m_fboID)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fboID);
+// CHECKFBO; //Incomplete FBO
+ GLERRORCHECK;
m_lastRendered = m_fboID;
// m_lastInStask = m_lastRendered;
}
@@ -46,10 +50,15 @@
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_lastInStask);
// m_lastRendered = m_lastInStask;
+
+ RenderableNode::PostRender(matrix);
+ GLERRORCHECK;
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); //unbind
- m_lastRendered = 0;
+ CHECKFBO;
+ GLERRORCHECK;
- RenderableNode::PostRender(matrix);
+ m_lastRendered = 0;
}
uint32_t MercuryFBO::m_lastRendered = NULL;
Modified: Mercury2/src/RenderBuffer.cpp
===================================================================
--- Mercury2/src/RenderBuffer.cpp 2009-06-13 01:13:21 UTC (rev 314)
+++ Mercury2/src/RenderBuffer.cpp 2009-06-13 02:35:10 UTC (rev 315)
@@ -37,6 +37,9 @@
void RenderBuffer::Render(const MercuryNode* node)
{
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_bufferID);
+// CHECKFBO; //missing attachment
+ GLERRORCHECK;
+
if ( NeedResize() ) AllocateSpace();
//attach to FBO
@@ -47,25 +50,31 @@
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GLAttachPoint(), GL_TEXTURE_2D, m_textureID, 0);
else
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GLAttachPoint(), GL_RENDERBUFFER_EXT, m_bufferID);
+ CHECKFBO;
+ GLERRORCHECK;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ GLERRORCHECK;
}
void RenderBuffer::PostRender(const MercuryNode* node)
{
- static uint32_t t = time(NULL);
- if ( (m_type == TEXTURE) && (time(NULL) > (t+3)))
-// if (false)
+ GLERRORCHECK;
+ if ( m_type == TEXTURE )
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
+ GLERRORCHECK;
+
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
+ GLERRORCHECK;
+
// printf("active %d\n", Texture::NumberActiveTextures() );
//this works with a "normal" texture, FBO texture is still white
@@ -75,6 +84,7 @@
glBindTexture(GL_TEXTURE_2D, m_textureID);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
+ GLERRORCHECK;
glBegin(GL_QUADS);
glTexCoord2d(0,1);
@@ -88,8 +98,10 @@
glTexCoord2d(0,0);
glVertex3i(-1, 1, -1);
+
glEnd();
+ GLERRORCHECK;
glBindTexture(GL_TEXTURE_2D, 0);
// glActiveTexture( GL_TEXTURE0 );
@@ -97,9 +109,13 @@
// glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable( GL_TEXTURE_2D );
+ GLERRORCHECK;
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
+
+ GLERRORCHECK;
}
}
@@ -107,12 +123,11 @@
{
m_initiated = true;
glGenRenderbuffersEXT(1, &m_bufferID);
-
- if (m_type == TEXTURE)
- {
- glGenTextures(1, &m_textureID);
- printf("texture rb %d\n", m_textureID);
- }
+ CHECKFBO;
+ GLERRORCHECK;
+ if (m_type == TEXTURE) glGenTextures(1, &m_textureID);
+ CHECKFBO;
+ GLERRORCHECK;
}
void RenderBuffer::AllocateSpace()
@@ -127,6 +142,7 @@
}
else
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GLType(), m_width, m_height);
+ GLERRORCHECK;
}
bool RenderBuffer::NeedResize()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-13 21:56:36
|
Revision: 317
http://hgengine.svn.sourceforge.net/hgengine/?rev=317&view=rev
Author: axlecrusher
Date: 2009-06-13 21:56:35 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/src/MercuryFBO.cpp
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-13 21:30:11 UTC (rev 316)
+++ Mercury2/adv_set.c 2009-06-13 21:56:35 UTC (rev 317)
@@ -12,7 +12,7 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/RenderBuffer.cpp src/GLHelpers.cpp"
+ src/GLHelpers.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-06-13 21:30:11 UTC (rev 316)
+++ Mercury2/src/MercuryFBO.cpp 2009-06-13 21:56:35 UTC (rev 317)
@@ -80,7 +80,7 @@
// m_lastInStask = m_lastRendered;
}
- glClear(GL_COLOR_BUFFER_BIT );
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0,0,m_width, m_width);
@@ -107,7 +107,6 @@
void MercuryFBO::LoadFromXML(const XMLNode& node)
{
- printf("load\n");
if ( !node.Attribute("width").empty() )
SetWidth( StrToInt(node.Attribute("width")) );
@@ -120,8 +119,6 @@
if ( !node.Attribute("tnum").empty() )
SetNumTextures( StrToInt(node.Attribute("tnum")) );
- printf("%d %d %d %d\n", m_width, m_height, m_useDepth, m_numTextures);
-
RenderableNode::LoadFromXML(node);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 02:05:15
|
Revision: 319
http://hgengine.svn.sourceforge.net/hgengine/?rev=319&view=rev
Author: axlecrusher
Date: 2009-06-14 02:03:25 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
bug fixes
Modified Paths:
--------------
Mercury2/scenegraph.xml
Mercury2/src/MercuryFBO.cpp
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-14 01:54:48 UTC (rev 318)
+++ Mercury2/scenegraph.xml 2009-06-14 02:03:25 UTC (rev 319)
@@ -10,7 +10,7 @@
<asset type="texture" file="screenFBO" dynamic="true"/>
<asset type="fullscreenquad"/>
</node>
- <node type="mercuryfbo" width="640" height="480" depth="false" tnum="1" name="screenFBO">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO">
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<node type="renderablenode">
<asset type="texture" file="map.png"/>
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-06-14 01:54:48 UTC (rev 318)
+++ Mercury2/src/MercuryFBO.cpp 2009-06-14 02:03:25 UTC (rev 319)
@@ -83,7 +83,7 @@
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushAttrib(GL_VIEWPORT_BIT);
- glViewport(0,0,m_width, m_width);
+// glViewport(0,0,m_width, m_width);
RenderableNode::Render(matrix);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 02:12:55
|
Revision: 318
http://hgengine.svn.sourceforge.net/hgengine/?rev=318&view=rev
Author: axlecrusher
Date: 2009-06-14 01:54:48 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Rendering scene to FBO then to a fullscreen quad
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/scenegraph.xml
Added Paths:
-----------
Mercury2/src/FullscreenQuad.cpp
Mercury2/src/FullscreenQuad.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-13 21:56:35 UTC (rev 317)
+++ Mercury2/adv_set.c 2009-06-14 01:54:48 UTC (rev 318)
@@ -12,7 +12,7 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/GLHelpers.cpp"
+ src/GLHelpers.cpp src/FullscreenQuad.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-13 21:56:35 UTC (rev 317)
+++ Mercury2/scenegraph.xml 2009-06-14 01:54:48 UTC (rev 318)
@@ -6,18 +6,17 @@
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
</node>
- <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
- <node type="renderablenode">
- <asset type="texture" file="map.png"/>
- <asset type="hgmdlmodel" file="map.hgmdl" />
- </node>
- <node type="renderablenode">
- <asset type="texture" file="screenFBO" dynamic="true"/>
- <asset type="quad"/>
- </node>
+ <node type="renderablenode">
+ <asset type="texture" file="screenFBO" dynamic="true"/>
+ <asset type="fullscreenquad"/>
</node>
- <node type="mercuryfbo" width="512" height="512" depth="false" tnum="1" name="screenFBO">
-<!-- <asset type="renderbuffer" buffertype="texture" /> -->
+ <node type="mercuryfbo" width="640" height="480" depth="false" tnum="1" name="screenFBO">
+ <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
+ <node type="renderablenode">
+ <asset type="texture" file="map.png"/>
+ <asset type="hgmdlmodel" file="map.hgmdl" />
+ </node>
+ </node>
<node type="renderablenode" name="lampForest">
<asset type="texture" file="lamp.png"/>
<node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
Added: Mercury2/src/FullscreenQuad.cpp
===================================================================
--- Mercury2/src/FullscreenQuad.cpp (rev 0)
+++ Mercury2/src/FullscreenQuad.cpp 2009-06-14 01:54:48 UTC (rev 318)
@@ -0,0 +1,71 @@
+#include <GLHeaders.h>
+#include <FullscreenQuad.h>
+
+REGISTER_ASSET_TYPE(FullscreenQuad);
+
+FullscreenQuad::FullscreenQuad()
+{
+ m_matrix = MercuryMatrix::Identity();
+ m_matrix.Scale(2,2,1);
+ m_matrix.Transpose();
+}
+
+void FullscreenQuad::Render(const MercuryNode* node)
+{
+ //reverse texture mapping for
+ glMatrixMode(GL_TEXTURE);
+ glPushMatrix();
+ glLoadIdentity();
+ glRotatef(180,1,0,0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadMatrixf( m_matrix.Ptr() );
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+
+ Quad::Render( node );
+
+ glPopMatrix();
+ glMatrixMode(GL_TEXTURE); glPopMatrix();
+ glMatrixMode(GL_MODELVIEW); glPopMatrix();
+}
+
+FullscreenQuad* FullscreenQuad::Generate()
+{
+ return new FullscreenQuad();
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/FullscreenQuad.h
===================================================================
--- Mercury2/src/FullscreenQuad.h (rev 0)
+++ Mercury2/src/FullscreenQuad.h 2009-06-14 01:54:48 UTC (rev 318)
@@ -0,0 +1,46 @@
+#include <Quad.h>
+
+class FullscreenQuad : public Quad
+{
+ public:
+ FullscreenQuad();
+// virtual ~FullscreenQuad();
+
+ virtual void Render(const MercuryNode* node);
+
+ static FullscreenQuad* Generate();
+ private:
+ MercuryMatrix m_matrix;
+};
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 03:34:32
|
Revision: 320
http://hgengine.svn.sourceforge.net/hgengine/?rev=320&view=rev
Author: axlecrusher
Date: 2009-06-14 03:34:30 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
handle screen resize a little better
Modified Paths:
--------------
Mercury2/scenegraph.xml
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryFBO.cpp
Mercury2/src/MercuryFBO.h
Mercury2/src/Texture.cpp
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-14 02:03:25 UTC (rev 319)
+++ Mercury2/scenegraph.xml 2009-06-14 03:34:30 UTC (rev 320)
@@ -7,10 +7,10 @@
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
</node>
<node type="renderablenode">
- <asset type="texture" file="screenFBO" dynamic="true"/>
+ <asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
</node>
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true">
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<node type="renderablenode">
<asset type="texture" file="map.png"/>
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-06-14 02:03:25 UTC (rev 319)
+++ Mercury2/src/MercuryAsset.h 2009-06-14 03:34:30 UTC (rev 320)
@@ -40,7 +40,7 @@
inline const BoundingVolume* GetBoundingVolume() const { return m_boundingVolume; }
inline const MString& Path() const { return m_path; }
-
+
void DrawAxes();
protected:
void SetLoadState(LoadState ls); //thread safe
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-06-14 02:03:25 UTC (rev 319)
+++ Mercury2/src/MercuryFBO.cpp 2009-06-14 03:34:30 UTC (rev 320)
@@ -1,10 +1,11 @@
#include <MercuryFBO.h>
#include <GLHeaders.h>
+#include <MercuryWindow.h>
REGISTER_NODE_TYPE(MercuryFBO);
MercuryFBO::MercuryFBO()
- :m_fboID(0), m_depthBufferID(0), m_initiated(false), m_useDepth(false), m_numTextures(0)
+ :m_fboID(0), m_depthBufferID(0), m_initiated(false), m_useDepth(false),m_useScreenSize(false), m_width(0),m_height(0), m_numTextures(0)
{
for (uint8_t i = 0; i < 4; ++i) m_textures[i] = NULL;
}
@@ -29,15 +30,27 @@
m_initiated = true;
+ GenerateFBO();
+ Bind();
+
+// CHECKFBO; //Incomplete FBO
+}
+
+void MercuryFBO::GenerateFBO()
+{
if( m_useDepth ) glGenRenderbuffersEXT( 1, &m_depthBufferID );
glGenFramebuffersEXT( 1, &m_fboID );
for (uint8_t i = 0; i < m_numTextures; ++i)
{
- m_textures[i] = Texture::LoadDynamicTexture(m_name);
- m_textures[i]->MakeDynamic(m_width, m_height,m_name);
+ MString n = ssprintf("%s_%d", m_name.c_str(), i);
+ m_textures[i] = Texture::LoadDynamicTexture(n);
+ m_textures[i]->MakeDynamic(m_width, m_height,n);
}
-
+}
+
+void MercuryFBO::Bind()
+{
if( m_useDepth )
{
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, m_fboID );
@@ -51,9 +64,9 @@
if( m_useDepth )
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBufferID );
+}
- CHECKFBO; //Incomplete FBO
-}
+
/*
void MercuryFBO::InitFBOBeforeRender()
{
@@ -66,6 +79,24 @@
void MercuryFBO::PreRender(const MercuryMatrix& matrix)
{
if ( !m_initiated ) Setup();
+
+ if ( m_useScreenSize )
+ {
+ int w = MercuryWindow::GetCurrentWindow()->Width();
+ int h = MercuryWindow::GetCurrentWindow()->Height();
+ if ((m_width != w) || (m_height != h))
+ {
+ m_width = w; m_height = h;
+ for (uint8_t i = 0; i < m_numTextures; ++i)
+ {
+ MString n = ssprintf("%s_%d", m_name.c_str(), i);
+ m_textures[i]->MakeDynamic(m_width, m_height,n);
+ }
+ Bind();
+ }
+ }
+ GLERRORCHECK;
+
RenderableNode::PreRender(matrix);
}
@@ -80,16 +111,22 @@
// m_lastInStask = m_lastRendered;
}
+ GLERRORCHECK;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ GLERRORCHECK;
glPushAttrib(GL_VIEWPORT_BIT);
-// glViewport(0,0,m_width, m_width);
+ if ( !m_useScreenSize ) glViewport(0,0,m_width, m_height);
+
+ GLERRORCHECK;
RenderableNode::Render(matrix);
+ GLERRORCHECK;
}
void MercuryFBO::PostRender(const MercuryMatrix& matrix)
{
+ GLERRORCHECK;
glPopAttrib();
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_lastInStask);
@@ -99,6 +136,7 @@
GLERRORCHECK;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); //unbind
+
CHECKFBO;
GLERRORCHECK;
@@ -119,6 +157,9 @@
if ( !node.Attribute("tnum").empty() )
SetNumTextures( StrToInt(node.Attribute("tnum")) );
+ if ( !node.Attribute("usescreensize").empty() )
+ m_useScreenSize = node.Attribute("usescreensize") == "true"?true:false;
+
RenderableNode::LoadFromXML(node);
}
Modified: Mercury2/src/MercuryFBO.h
===================================================================
--- Mercury2/src/MercuryFBO.h 2009-06-14 02:03:25 UTC (rev 319)
+++ Mercury2/src/MercuryFBO.h 2009-06-14 03:34:30 UTC (rev 320)
@@ -27,10 +27,12 @@
private:
void Setup();
void Clean();
+ void GenerateFBO();
+ void Bind();
// void InitFBOBeforeRender();
uint32_t m_fboID, m_depthBufferID;
- bool m_initiated, m_useDepth;
+ bool m_initiated, m_useDepth, m_useScreenSize;
uint16_t m_width, m_height;
// uint32_t m_textureID[4];
Texture *m_textures[4];
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-06-14 02:03:25 UTC (rev 319)
+++ Mercury2/src/Texture.cpp 2009-06-14 03:34:30 UTC (rev 320)
@@ -167,16 +167,16 @@
void Texture::MakeDynamic(uint16_t width, uint16_t height, const MString& name)
{
- Clean();
+// Clean();
SetLoadState(LOADED);
REMOVE_ASSET_INSTANCE(TEXTURE, m_path);
m_path = "DYNATEXT"+name;
ADD_ASSET_INSTANCE(Texture, m_path, this);
-
- glGenTextures( 1, &m_textureID );
- printf("booo %d\n", m_textureID);
+
+ if (m_textureID == 0) printf("booo %d\n", m_textureID);
+ if (m_textureID == 0) glGenTextures( 1, &m_textureID );
glBindTexture( GL_TEXTURE_2D, m_textureID );
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 15:26:53
|
Revision: 328
http://hgengine.svn.sourceforge.net/hgengine/?rev=328&view=rev
Author: axlecrusher
Date: 2009-06-14 15:25:23 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
some updates
Modified Paths:
--------------
Mercury2/scenegraph.xml
Mercury2/src/X11Window.cpp
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-14 15:21:35 UTC (rev 327)
+++ Mercury2/scenegraph.xml 2009-06-14 15:25:23 UTC (rev 328)
@@ -10,7 +10,7 @@
<asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
</node>
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true">
<asset type="shader" file="testShader"/>
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<node type="renderablenode">
Modified: Mercury2/src/X11Window.cpp
===================================================================
--- Mercury2/src/X11Window.cpp 2009-06-14 15:21:35 UTC (rev 327)
+++ Mercury2/src/X11Window.cpp 2009-06-14 15:25:23 UTC (rev 328)
@@ -76,6 +76,7 @@
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
+ glEnable(GL_NORMALIZE);
}
X11Window::~X11Window()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 19:38:08
|
Revision: 333
http://hgengine.svn.sourceforge.net/hgengine/?rev=333&view=rev
Author: axlecrusher
Date: 2009-06-14 19:38:07 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
render worldspace normal
Added Paths:
-----------
Mercury2/testShader.frag
Mercury2/testShader.vert
Added: Mercury2/testShader.frag
===================================================================
--- Mercury2/testShader.frag (rev 0)
+++ Mercury2/testShader.frag 2009-06-14 19:38:07 UTC (rev 333)
@@ -0,0 +1,8 @@
+uniform sampler2D tex1;
+varying vec3 normal;
+
+void main()
+{
+// gl_FragData[0] = texture2D(tex1, gl_TexCoord[0].st);
+ gl_FragData[0].rgb = normalize(normal);
+}
Added: Mercury2/testShader.vert
===================================================================
--- Mercury2/testShader.vert (rev 0)
+++ Mercury2/testShader.vert 2009-06-14 19:38:07 UTC (rev 333)
@@ -0,0 +1,13 @@
+varying vec3 normal;
+uniform mat4 HG_ModelMatrix;
+
+void main()
+{
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+
+ vec4 n = vec4(gl_Normal, 0);
+
+ //normalize in fragment
+ normal = (HG_ModelMatrix * n).xyz;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-14 19:46:41
|
Revision: 334
http://hgengine.svn.sourceforge.net/hgengine/?rev=334&view=rev
Author: axlecrusher
Date: 2009-06-14 19:46:39 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
use lamp with normals
Modified Paths:
--------------
Mercury2/scenegraph.xml
Added Paths:
-----------
Mercury2/lampN.hgmdl
Added: Mercury2/lampN.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/lampN.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-14 19:38:07 UTC (rev 333)
+++ Mercury2/scenegraph.xml 2009-06-14 19:46:39 UTC (rev 334)
@@ -24,7 +24,7 @@
<node type="transformnode" rotx="-90" name="lamp">
<node type="billboardnode" billboardaxis="0,0,1" spheremode="true" >
<node type="renderablenode">
- <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ <asset type="hgmdlmodel" file="lampN.hgmdl" />
</node>
</node>
</node>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-24 05:24:32
|
Revision: 370
http://hgengine.svn.sourceforge.net/hgengine/?rev=370&view=rev
Author: cnlohr
Date: 2009-06-24 02:16:55 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
add font
Added Paths:
-----------
Mercury2/testfont.hgfont
Mercury2/testfont.png
Added: Mercury2/testfont.hgfont
===================================================================
--- Mercury2/testfont.hgfont (rev 0)
+++ Mercury2/testfont.hgfont 2009-06-24 02:16:55 UTC (rev 370)
@@ -0,0 +1,257 @@
+testfont.png
+0 0.000000 0.000000 0.031250 0.040039 32 41 8 41
+1 0.062500 0.000000 0.093750 0.040039 32 41 8 41
+2 0.125000 0.000000 0.156250 0.040039 32 41 8 41
+3 0.187500 0.000000 0.218750 0.040039 32 41 8 41
+4 0.250000 0.000000 0.281250 0.040039 32 41 8 41
+5 0.312500 0.000000 0.343750 0.040039 32 41 8 41
+6 0.375000 0.000000 0.406250 0.040039 32 41 8 41
+7 0.437500 0.000000 0.468750 0.040039 32 41 8 41
+8 0.500000 0.000000 0.531250 0.040039 32 41 8 41
+9 0.562500 0.000000 0.593750 0.040039 32 41 8 41
+10 0.625000 0.000000 0.656250 0.040039 32 41 8 41
+11 0.687500 0.000000 0.718750 0.040039 32 41 8 41
+12 0.750000 0.000000 0.781250 0.040039 32 41 8 41
+13 0.812500 0.000000 0.843750 0.040039 32 41 8 41
+14 0.875000 0.000000 0.906250 0.040039 32 41 8 41
+15 0.937500 0.000000 0.968750 0.040039 32 41 8 41
+16 0.000000 0.062500 0.031250 0.102539 32 41 8 41
+17 0.062500 0.062500 0.093750 0.102539 32 41 8 41
+18 0.125000 0.062500 0.156250 0.102539 32 41 8 41
+19 0.187500 0.062500 0.218750 0.102539 32 41 8 41
+20 0.250000 0.062500 0.281250 0.102539 32 41 8 41
+21 0.312500 0.062500 0.343750 0.102539 32 41 8 41
+22 0.375000 0.062500 0.406250 0.102539 32 41 8 41
+23 0.437500 0.062500 0.468750 0.102539 32 41 8 41
+24 0.500000 0.062500 0.531250 0.102539 32 41 8 41
+25 0.562500 0.062500 0.593750 0.102539 32 41 8 41
+26 0.625000 0.062500 0.656250 0.102539 32 41 8 41
+27 0.687500 0.062500 0.718750 0.102539 32 41 8 41
+28 0.750000 0.062500 0.781250 0.102539 32 41 8 41
+29 0.812500 0.062500 0.843750 0.102539 32 41 8 41
+30 0.875000 0.062500 0.906250 0.102539 32 41 8 41
+31 0.937500 0.062500 0.968750 0.102539 32 41 8 41
+32 0.000000 0.125000 0.000000 0.125000 0 0 0 0
+33 0.062500 0.125000 0.068359 0.169922 6 46 7 46
+34 0.125000 0.125000 0.141602 0.140625 17 16 3 46
+35 0.187500 0.125000 0.221680 0.169922 35 46 0 46
+36 0.250000 0.125000 0.279297 0.178711 30 55 3 48
+37 0.312500 0.125000 0.360352 0.171875 49 48 4 47
+38 0.375000 0.125000 0.413086 0.171875 39 48 3 47
+39 0.437500 0.125000 0.443359 0.140625 6 16 3 46
+40 0.500000 0.125000 0.515625 0.182617 16 59 4 46
+41 0.562500 0.125000 0.578125 0.182617 16 59 1 46
+42 0.625000 0.125000 0.645508 0.143555 21 19 2 46
+43 0.687500 0.125000 0.717773 0.155273 31 31 3 38
+44 0.750000 0.125000 0.755859 0.139648 6 15 6 6
+45 0.812500 0.125000 0.829102 0.129883 17 5 2 19
+46 0.875000 0.125000 0.880859 0.130859 6 6 6 6
+47 0.937500 0.125000 0.956055 0.169922 19 46 0 46
+48 0.000000 0.187500 0.029297 0.233398 30 47 3 46
+49 0.062500 0.187500 0.079102 0.232422 17 46 7 46
+50 0.125000 0.187500 0.155273 0.232422 31 46 1 46
+51 0.187500 0.187500 0.216797 0.233398 30 47 3 46
+52 0.250000 0.187500 0.281250 0.231445 32 45 1 45
+53 0.312500 0.187500 0.341797 0.232422 30 46 3 45
+54 0.375000 0.187500 0.405273 0.233398 31 47 2 46
+55 0.437500 0.187500 0.466797 0.231445 30 45 3 45
+56 0.500000 0.187500 0.529297 0.233398 30 47 3 46
+57 0.562500 0.187500 0.591797 0.233398 30 47 3 46
+58 0.625000 0.187500 0.630859 0.220703 6 34 6 34
+59 0.687500 0.187500 0.693359 0.229492 6 43 6 34
+60 0.750000 0.187500 0.778320 0.217773 29 31 4 38
+61 0.812500 0.187500 0.841797 0.206055 30 19 3 32
+62 0.875000 0.187500 0.903320 0.217773 29 31 4 38
+63 0.937500 0.187500 0.966797 0.233398 30 47 3 47
+64 0.000000 0.250000 0.057617 0.308594 59 60 3 47
+65 0.062500 0.250000 0.106445 0.294922 45 46 -1 46
+66 0.125000 0.250000 0.159180 0.294922 35 46 5 46
+67 0.187500 0.250000 0.226562 0.296875 40 48 3 47
+68 0.250000 0.250000 0.287109 0.294922 38 46 5 46
+69 0.312500 0.250000 0.346680 0.294922 35 46 5 46
+70 0.375000 0.250000 0.405273 0.294922 31 46 5 46
+71 0.437500 0.250000 0.479492 0.296875 43 48 3 47
+72 0.500000 0.250000 0.535156 0.294922 36 46 5 46
+73 0.562500 0.250000 0.568359 0.294922 6 46 6 46
+74 0.625000 0.250000 0.650391 0.295898 26 47 1 46
+75 0.687500 0.250000 0.724609 0.294922 38 46 5 46
+76 0.750000 0.250000 0.778320 0.294922 29 46 5 46
+77 0.812500 0.250000 0.854492 0.294922 43 46 5 46
+78 0.875000 0.250000 0.910156 0.294922 36 46 5 46
+79 0.937500 0.250000 0.980469 0.296875 44 48 3 47
+80 0.000000 0.312500 0.034180 0.357422 35 46 5 46
+81 0.062500 0.312500 0.105469 0.362305 44 51 3 47
+82 0.125000 0.312500 0.164062 0.357422 40 46 5 46
+83 0.187500 0.312500 0.223633 0.359375 37 48 3 47
+84 0.250000 0.312500 0.285156 0.357422 36 46 2 46
+85 0.312500 0.312500 0.347656 0.358398 36 47 5 46
+86 0.375000 0.312500 0.418945 0.357422 45 46 -1 46
+87 0.437500 0.312500 0.499023 0.357422 63 46 0 46
+88 0.500000 0.312500 0.540039 0.357422 41 46 -1 46
+89 0.562500 0.312500 0.603516 0.357422 42 46 0 46
+90 0.625000 0.312500 0.660156 0.357422 36 46 1 46
+91 0.687500 0.312500 0.699219 0.370117 12 59 4 46
+92 0.750000 0.312500 0.768555 0.357422 19 46 -1 46
+93 0.812500 0.312500 0.824219 0.370117 12 59 2 46
+94 0.875000 0.312500 0.899414 0.336914 25 25 1 47
+95 0.937500 0.312500 0.973633 0.317383 37 5 -1 -8
+96 0.000000 0.375000 0.010742 0.383789 11 9 3 46
+97 0.062500 0.375000 0.091797 0.410156 30 36 3 35
+98 0.125000 0.375000 0.153320 0.420898 29 47 4 46
+99 0.187500 0.375000 0.215820 0.410156 29 36 3 35
+100 0.250000 0.375000 0.278320 0.420898 29 47 2 46
+101 0.312500 0.375000 0.342773 0.410156 31 36 2 35
+102 0.375000 0.375000 0.394531 0.420898 20 47 1 47
+103 0.437500 0.375000 0.465820 0.422852 29 49 2 35
+104 0.500000 0.375000 0.527344 0.419922 28 46 4 46
+105 0.562500 0.375000 0.568359 0.419922 6 46 4 46
+106 0.625000 0.375000 0.637695 0.433594 13 60 -3 46
+107 0.687500 0.375000 0.714844 0.419922 28 46 4 46
+108 0.750000 0.375000 0.755859 0.419922 6 46 4 46
+109 0.812500 0.375000 0.857422 0.409180 46 35 4 35
+110 0.875000 0.375000 0.902344 0.409180 28 35 4 35
+111 0.937500 0.375000 0.966797 0.410156 30 36 3 35
+112 0.000000 0.437500 0.028320 0.484375 29 48 4 35
+113 0.062500 0.437500 0.090820 0.484375 29 48 2 35
+114 0.125000 0.437500 0.142578 0.471680 18 35 4 35
+115 0.187500 0.437500 0.213867 0.472656 27 36 2 35
+116 0.250000 0.437500 0.265625 0.483398 16 47 1 46
+117 0.312500 0.437500 0.339844 0.471680 28 35 4 34
+118 0.375000 0.437500 0.405273 0.470703 31 34 1 34
+119 0.437500 0.437500 0.485352 0.470703 49 34 -1 34
+120 0.500000 0.437500 0.531250 0.470703 32 34 0 34
+121 0.562500 0.437500 0.593750 0.484375 32 48 0 34
+122 0.625000 0.437500 0.653320 0.470703 29 34 1 34
+123 0.687500 0.437500 0.705078 0.497070 18 61 1 47
+124 0.750000 0.437500 0.754883 0.496094 5 60 6 46
+125 0.812500 0.437500 0.830078 0.497070 18 61 2 47
+126 0.875000 0.437500 0.906250 0.448242 32 11 2 28
+127 0.937500 0.437500 0.968750 0.477539 32 41 8 41
+128 0.000000 0.500000 0.031250 0.540039 32 41 8 41
+129 0.062500 0.500000 0.093750 0.540039 32 41 8 41
+130 0.125000 0.500000 0.156250 0.540039 32 41 8 41
+131 0.187500 0.500000 0.218750 0.540039 32 41 8 41
+132 0.250000 0.500000 0.281250 0.540039 32 41 8 41
+133 0.312500 0.500000 0.343750 0.540039 32 41 8 41
+134 0.375000 0.500000 0.406250 0.540039 32 41 8 41
+135 0.437500 0.500000 0.468750 0.540039 32 41 8 41
+136 0.500000 0.500000 0.531250 0.540039 32 41 8 41
+137 0.562500 0.500000 0.593750 0.540039 32 41 8 41
+138 0.625000 0.500000 0.656250 0.540039 32 41 8 41
+139 0.687500 0.500000 0.718750 0.540039 32 41 8 41
+140 0.750000 0.500000 0.781250 0.540039 32 41 8 41
+141 0.812500 0.500000 0.843750 0.540039 32 41 8 41
+142 0.875000 0.500000 0.906250 0.540039 32 41 8 41
+143 0.937500 0.500000 0.968750 0.540039 32 41 8 41
+144 0.000000 0.562500 0.031250 0.602539 32 41 8 41
+145 0.062500 0.562500 0.093750 0.602539 32 41 8 41
+146 0.125000 0.562500 0.156250 0.602539 32 41 8 41
+147 0.187500 0.562500 0.218750 0.602539 32 41 8 41
+148 0.250000 0.562500 0.281250 0.602539 32 41 8 41
+149 0.312500 0.562500 0.343750 0.602539 32 41 8 41
+150 0.375000 0.562500 0.406250 0.602539 32 41 8 41
+151 0.437500 0.562500 0.468750 0.602539 32 41 8 41
+152 0.500000 0.562500 0.531250 0.602539 32 41 8 41
+153 0.562500 0.562500 0.593750 0.602539 32 41 8 41
+154 0.625000 0.562500 0.656250 0.602539 32 41 8 41
+155 0.687500 0.562500 0.718750 0.602539 32 41 8 41
+156 0.750000 0.562500 0.781250 0.602539 32 41 8 41
+157 0.812500 0.562500 0.843750 0.602539 32 41 8 41
+158 0.875000 0.562500 0.906250 0.602539 32 41 8 41
+159 0.937500 0.562500 0.968750 0.602539 32 41 8 41
+160 0.000000 0.625000 0.000000 0.625000 0 0 0 0
+161 0.062500 0.625000 0.068359 0.670898 6 47 7 34
+162 0.125000 0.625000 0.153320 0.682617 29 59 3 46
+163 0.187500 0.625000 0.219727 0.671875 33 48 1 47
+164 0.250000 0.625000 0.281250 0.652344 32 28 1 36
+165 0.312500 0.625000 0.346680 0.669922 35 46 -1 46
+166 0.375000 0.625000 0.379883 0.683594 5 60 6 46
+167 0.437500 0.625000 0.466797 0.683594 30 60 3 47
+168 0.500000 0.625000 0.517578 0.630859 18 6 2 46
+169 0.562500 0.625000 0.608398 0.671875 47 48 0 47
+170 0.625000 0.625000 0.646484 0.647461 22 23 1 47
+171 0.687500 0.625000 0.713867 0.653320 27 29 4 31
+172 0.750000 0.625000 0.779297 0.643555 30 19 3 32
+173 0.812500 0.625000 0.829102 0.629883 17 5 2 19
+174 0.875000 0.625000 0.920898 0.671875 47 48 0 47
+175 0.937500 0.625000 0.973633 0.629883 37 5 -1 54
+176 0.000000 0.687500 0.016602 0.704102 17 17 4 47
+177 0.062500 0.687500 0.092773 0.724609 31 38 2 38
+178 0.125000 0.687500 0.143555 0.709961 19 23 1 47
+179 0.187500 0.687500 0.206055 0.709961 19 23 1 47
+180 0.250000 0.687500 0.260742 0.696289 11 9 7 45
+181 0.312500 0.687500 0.338867 0.733398 27 47 5 34
+182 0.375000 0.687500 0.408203 0.745117 34 59 0 46
+183 0.437500 0.687500 0.443359 0.693359 6 6 6 25
+184 0.500000 0.687500 0.512695 0.701172 13 14 3 0
+185 0.562500 0.687500 0.574219 0.709961 12 23 4 47
+186 0.625000 0.687500 0.645508 0.709961 21 23 1 47
+187 0.687500 0.687500 0.713867 0.715820 27 29 5 31
+188 0.750000 0.687500 0.796875 0.735352 48 49 4 47
+189 0.812500 0.687500 0.859375 0.734375 48 48 4 47
+190 0.875000 0.687500 0.924805 0.735352 51 49 1 47
+191 0.937500 0.687500 0.965820 0.734375 29 48 5 34
+192 0.000000 0.750000 0.043945 0.806641 45 58 -1 58
+193 0.062500 0.750000 0.106445 0.806641 45 58 -1 58
+194 0.125000 0.750000 0.168945 0.806641 45 58 -1 58
+195 0.187500 0.750000 0.231445 0.805664 45 57 -1 57
+196 0.250000 0.750000 0.293945 0.803711 45 55 -1 55
+197 0.312500 0.750000 0.356445 0.803711 45 55 -1 55
+198 0.375000 0.750000 0.435547 0.794922 62 46 -1 46
+199 0.437500 0.750000 0.476562 0.809570 40 61 3 47
+200 0.500000 0.750000 0.534180 0.806641 35 58 5 58
+201 0.562500 0.750000 0.596680 0.806641 35 58 5 58
+202 0.625000 0.750000 0.659180 0.806641 35 58 5 58
+203 0.687500 0.750000 0.721680 0.803711 35 55 5 55
+204 0.750000 0.750000 0.760742 0.806641 11 58 2 58
+205 0.812500 0.750000 0.823242 0.806641 11 58 5 58
+206 0.875000 0.750000 0.894531 0.806641 20 58 -1 58
+207 0.937500 0.750000 0.955078 0.803711 18 55 0 55
+208 0.000000 0.812500 0.041992 0.857422 43 46 0 46
+209 0.062500 0.812500 0.097656 0.868164 36 57 5 57
+210 0.125000 0.812500 0.167969 0.870117 44 59 3 58
+211 0.187500 0.812500 0.230469 0.870117 44 59 3 58
+212 0.250000 0.812500 0.292969 0.870117 44 59 3 58
+213 0.312500 0.812500 0.355469 0.869141 44 58 3 57
+214 0.375000 0.812500 0.417969 0.867188 44 56 3 55
+215 0.437500 0.812500 0.463867 0.838867 27 27 5 36
+216 0.500000 0.812500 0.543945 0.861328 45 50 3 47
+217 0.562500 0.812500 0.597656 0.870117 36 59 5 58
+218 0.625000 0.812500 0.660156 0.870117 36 59 5 58
+219 0.687500 0.812500 0.722656 0.870117 36 59 5 58
+220 0.750000 0.812500 0.785156 0.867188 36 56 5 55
+221 0.812500 0.812500 0.853516 0.869141 42 58 0 58
+222 0.875000 0.812500 0.909180 0.857422 35 46 5 46
+223 0.937500 0.812500 0.968750 0.859375 32 48 5 47
+224 0.000000 0.875000 0.029297 0.920898 30 47 3 46
+225 0.062500 0.875000 0.091797 0.920898 30 47 3 46
+226 0.125000 0.875000 0.154297 0.920898 30 47 3 46
+227 0.187500 0.875000 0.216797 0.919922 30 46 3 45
+228 0.250000 0.875000 0.279297 0.917969 30 44 3 43
+229 0.312500 0.875000 0.341797 0.922852 30 49 3 48
+230 0.375000 0.875000 0.425781 0.910156 52 36 2 35
+231 0.437500 0.875000 0.465820 0.922852 29 49 3 35
+232 0.500000 0.875000 0.530273 0.920898 31 47 2 46
+233 0.562500 0.875000 0.592773 0.920898 31 47 2 46
+234 0.625000 0.875000 0.655273 0.920898 31 47 2 46
+235 0.687500 0.875000 0.717773 0.917969 31 44 2 43
+236 0.750000 0.875000 0.760742 0.919922 11 46 2 46
+237 0.812500 0.875000 0.823242 0.919922 11 46 5 46
+238 0.875000 0.875000 0.894531 0.919922 20 46 -1 46
+239 0.937500 0.875000 0.955078 0.916992 18 43 0 43
+240 0.000000 0.937500 0.030273 0.983398 31 47 2 46
+241 0.062500 0.937500 0.089844 0.981445 28 45 4 45
+242 0.125000 0.937500 0.154297 0.983398 30 47 3 46
+243 0.187500 0.937500 0.216797 0.983398 30 47 3 46
+244 0.250000 0.937500 0.279297 0.983398 30 47 3 46
+245 0.312500 0.937500 0.341797 0.982422 30 46 3 45
+246 0.375000 0.937500 0.404297 0.980469 30 44 3 43
+247 0.437500 0.937500 0.468750 0.961914 32 25 3 35
+248 0.500000 0.937500 0.531250 0.977539 32 41 3 38
+249 0.562500 0.937500 0.589844 0.983398 28 47 4 46
+250 0.625000 0.937500 0.652344 0.983398 28 47 4 46
+251 0.687500 0.937500 0.714844 0.983398 28 47 4 46
+252 0.750000 0.937500 0.777344 0.980469 28 44 4 43
+253 0.812500 0.937500 0.843750 0.996094 32 60 0 46
+254 0.875000 0.937500 0.903320 0.995117 29 59 4 46
+255 0.937500 0.937500 0.968750 0.993164 32 57 0 43
Added: Mercury2/testfont.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/testfont.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-24 06:28:37
|
Revision: 371
http://hgengine.svn.sourceforge.net/hgengine/?rev=371&view=rev
Author: cnlohr
Date: 2009-06-24 06:27:59 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
fix text
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Mercury2/scenegraph.xml
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-06-24 02:16:55 UTC (rev 370)
+++ Mercury2/modules/TextNode.cpp 2009-06-24 06:27:59 UTC (rev 371)
@@ -168,6 +168,7 @@
{
if( g_AllFonts.get( sFont ) == 0 )
{
+ m_pThisFont = &g_AllFonts[sFont];
if( !m_pThisFont->LoadFromFile( sFont ) )
{
fprintf( stderr, "Error: Could not load font: \"%s\".", sFont.c_str() );
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-24 02:16:55 UTC (rev 370)
+++ Mercury2/scenegraph.xml 2009-06-24 06:27:59 UTC (rev 371)
@@ -8,7 +8,7 @@
</node>
<node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" />
+ <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" alphaPath="true" />
</node>
<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-25 05:47:04
|
Revision: 375
http://hgengine.svn.sourceforge.net/hgengine/?rev=375&view=rev
Author: cnlohr
Date: 2009-06-25 05:47:03 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
update font code and font, itself
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Mercury2/modules/TextNode.h
Mercury2/scenegraph.xml
Mercury2/testfont.hgfont
Mercury2/testfont.png
Mercury2/tools/fonter/main.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/modules/TextNode.cpp 2009-06-25 05:47:03 UTC (rev 375)
@@ -9,7 +9,11 @@
REGISTER_NODE_TYPE(TextNode);
TextNode::TextNode()
- :MercuryNode(),m_fSize(1.),m_bDirty(false),m_pThisFont(NULL),m_kVBO(0), m_kTEX(0)
+ :MercuryNode(),m_fSize(1.),
+ m_bDirty(false),m_pThisFont(NULL),
+ m_alignment( LEFT ),
+ m_fTextWidth( INFINITY ),
+ m_kVBO(0), m_kTEX(0)
{
}
@@ -33,6 +37,16 @@
SetSize( StrToFloat( node.Attribute("size") ) );
if ( !node.Attribute("text").empty() )
SetText( node.Attribute("text") );
+ if ( !node.Attribute("width").empty() )
+ SetWidth( StrToFloat( node.Attribute("width") ) );
+ if ( !node.Attribute("alignment").empty() )
+ {
+ MString sAlign = node.Attribute("alignment");
+ if( sAlign == "RIGHT" ) SetAlignment( RIGHT );
+ if( sAlign == "CENTER" ) SetAlignment( CENTER );
+ if( sAlign == "FIT" ) SetAlignment( FIT );
+ if( sAlign == "FIT_FULL" ) SetAlignment( FIT_FULL );
+ }
}
void TextNode::RenderText()
@@ -40,6 +54,7 @@
std::vector< DChar > chars;
float xps = 0;
float yps = 0;
+ bool bWasBlank = true;
if( !m_pThisFont )
return;
@@ -73,29 +88,160 @@
for( const char * c = &m_sText[0]; *c != 0; c++ )
{
if( *c == 9 )
- xps+=80;
+ {
+ xps += m_pThisFont->m_fTab;
+ bWasBlank = true;
+ }
else if( *c == 10 )
{
xps = 0;
- yps += m_pThisFont->m_fHeight; //??XXXX NEED TO SET TO RIGHT VALUE!
+ yps += m_pThisFont->m_fHeight;
+ bWasBlank = true;
}
else if( *c == 32 )
- xps+=20;
+ {
+ xps += m_pThisFont->m_fSpace;
+ bWasBlank = true;
+ }
else
{
if( m_pThisFont->m_mGlyphs.find( *c ) != m_pThisFont->m_mGlyphs.end() )
{
Glyph & g = m_pThisFont->m_mGlyphs[*c];
- chars.push_back( DChar( &g, *c, xps, yps ) );
+ chars.push_back( DChar( &g, *c, xps, yps, g.ilx+m_pThisFont->m_fBlank, bWasBlank ) );
//Here is the right place to do line-splitting if need be.
- xps += g.ilx+4; //Why 4?
+ xps += g.ilx+m_pThisFont->m_fBlank;
+
+ bWasBlank = false;
+
+ //Check wrapping
+ if( xps > m_fTextWidth )
+ {
+ int i, j;
+ //Track backward, and dump current word on next line.
+ for( i = (int)chars.size()-1; i >= 0; i-- )
+ {
+ if( chars[i].bWordStart ) break;
+ }
+
+ //If word begins at the beginning of the line
+ if( chars[i].xps == 0 )
+ {
+ //advance "This" letter to the next line
+ chars[chars.size()-1].xps = 0;
+ chars[chars.size()-1].yps += m_pThisFont->m_fHeight;
+ chars[chars.size()-1].bWordStart = true;
+
+ xps = g.ilx+m_pThisFont->m_fBlank;
+ yps += m_pThisFont->m_fHeight;
+ } else
+ {
+ //break to new line
+ float fPosStart = chars[i].xps;
+ for( j = i; j < (int)chars.size(); j++ )
+ {
+ chars[j].xps -= fPosStart;
+ xps = chars[j].xps;
+ chars[j].yps += m_pThisFont->m_fHeight;
+ }
+ xps += g.ilx+m_pThisFont->m_fBlank;
+ yps += m_pThisFont->m_fHeight;
+ }
+ }
}
}
}
- //Stage 2: Actually generate the geometry.
+ //Stage 2: Handle alignment
+ if( m_alignment != LEFT )
+ {
+ float fLinePos = 0;
+ int iLineStart = 0;
+ int iLettersOnLine = 0;
+ int iWordsOnLine = 0;
+ for( unsigned i = 0; i <= chars.size(); i++ )
+ {
+ bool bNewLine = false;
+ if( i < chars.size() )
+ {
+ DChar & dc = chars[i];
+ if( dc.yps != fLinePos )
+ {
+ bNewLine = true;
+ }
+ fLinePos = dc.yps;
+ } else
+ bNewLine = true;
+
+ iLettersOnLine++;
+
+ if( bNewLine && i > 0 )
+ {
+ float fEndOfLine = chars[i-1].xps + chars[i-1].width;
+
+ iLettersOnLine--;
+
+ if( m_alignment == RIGHT )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset;
+ }
+ } else if( m_alignment == CENTER )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ offset/=2;
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset;
+ }
+ } else if( m_alignment == FIT_FULL )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ offset/=float(iLettersOnLine);
+
+ float letter = 0;
+
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset*letter;
+ letter++;
+ }
+ } else if( m_alignment == FIT )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+
+ if( iWordsOnLine != 0 )
+ {
+ offset/=float(iWordsOnLine-1);
+
+ float fTOffset = 0;
+
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ if( chars[j].bWordStart && j != (unsigned)iLineStart )
+ fTOffset += offset;
+ chars[j].xps += fTOffset ;
+ }
+ }
+ }
+
+ iLineStart = i;
+ iLettersOnLine = 0;
+ iWordsOnLine = 0;
+ }
+
+ if( i < chars.size() )
+ {
+ if( chars[i].bWordStart || i == 0 ) iWordsOnLine++;
+ }
+ }
+ }
+
+ //Stage 3: Actually generate the geometry.
((MercuryVBO*)m_kVBO.Ptr())->AllocateIndexSpace(chars.size()*6);
((MercuryVBO*)m_kVBO.Ptr())->AllocateVertexSpace(chars.size()*4);
@@ -151,7 +297,6 @@
vd[(i*4+3)*8+6] = ey;
vd[(i*4+3)*8+7] = 0;
- printf( "%f %f %f %f %f %f %f %f\n", vd[(i*4+0)*8+5], vd[(i*4+0)*8+6], vd[(i*4+1)*8+5], vd[(i*4+1)*8+6], vd[(i*4+2)*8+5], vd[(i*4+2)*8+6], vd[(i*4+3)*8+5], vd[(i*4+3)*8+6] );
id[i*6+0] = i * 4 + 2;
id[i*6+1] = i * 4 + 1;
id[i*6+2] = i * 4 + 0;
@@ -218,7 +363,7 @@
return false;
}
- if( sscanf( sLine.c_str(), "%f", &m_fHeight ) != 1 )
+ if( sscanf( sLine.c_str(), "%f %f %f %f", &m_fHeight, &m_fBlank, &m_fSpace, &m_fTab ) != 4 )
{
fprintf( stderr, "Malformatted font size.\n" );
delete f;
Modified: Mercury2/modules/TextNode.h
===================================================================
--- Mercury2/modules/TextNode.h 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/modules/TextNode.h 2009-06-25 05:47:03 UTC (rev 375)
@@ -10,18 +10,37 @@
{
public:
TextNode();
+
+ enum TextAlignment
+ {
+ LEFT,
+ RIGHT,
+ CENTER,
+ FIT,
+ FIT_FULL
+ };
+
virtual void Update(float dTime);
virtual void LoadFromXML(const XMLNode& node);
+
virtual bool LoadFont( const MString & sFont );
virtual void SetSize( float fSize );
virtual void SetText( const MString & sText );
- inline void SetDirtyText() { m_bDirty = true; }
-
virtual void RenderText();
+ inline void SetAlignment( TextAlignment t ) { m_alignment = t; }
+ inline TextAlignment GetAlignment() { return m_alignment; }
+
+ inline float GetWidth() { return m_fTextWidth; }
+ inline void SetWidth( float fWidth ) { m_fTextWidth = fWidth; }
+
+ inline const MString & GetText() { return m_sText; }
+ inline void SetDirtyText() { m_bDirty = true; }
+
GENRTTI(TextNode);
+
private:
class Font;
@@ -30,6 +49,9 @@
MString m_sFont;
bool m_bDirty;
Font * m_pThisFont;
+ TextAlignment m_alignment;
+ float m_fTextWidth;
+
MAutoPtr< MercuryAsset > m_kVBO;
MAutoPtr< MercuryAsset > m_kTEX;
@@ -53,6 +75,10 @@
std::map< int, Glyph > m_mGlyphs;
MString m_sImage;
float m_fHeight;
+
+ float m_fBlank; //For space between letters
+ float m_fSpace; //For distance a space advances
+ float m_fTab; //For distance a tab goes
};
static MHash< Font > g_AllFonts;
@@ -61,12 +87,15 @@
class DChar
{
public:
- DChar( Glyph * g, int c, float x, float y ) : glyph(g), character(c), xps(x), yps(y) { }
+ DChar( Glyph * g, int c, float x, float y, float w, bool start ) : glyph(g), character(c), xps(x), yps(y), width(w), bWordStart( start ) { }
Glyph * glyph;
int character;
float xps; //aka pos on line
float yps; //aka line
+ float width;
+
+ bool bWordStart; //used for wrapping
};
};
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/scenegraph.xml 2009-06-25 05:47:03 UTC (rev 375)
@@ -8,7 +8,7 @@
</node>
<node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" alphaPath="true" />
+ <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
</node>
<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
Modified: Mercury2/testfont.hgfont
===================================================================
--- Mercury2/testfont.hgfont 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/testfont.hgfont 2009-06-25 05:47:03 UTC (rev 375)
@@ -1,4 +1,5 @@
testfont.png
+64 4.000000 15.000000 80.000000
0 0.000000 0.000000 0.031250 0.040039 32 41 8 41
1 0.062500 0.000000 0.093750 0.040039 32 41 8 41
2 0.125000 0.000000 0.156250 0.040039 32 41 8 41
Modified: Mercury2/testfont.png
===================================================================
(Binary files differ)
Modified: Mercury2/tools/fonter/main.cpp
===================================================================
--- Mercury2/tools/fonter/main.cpp 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/tools/fonter/main.cpp 2009-06-25 05:47:03 UTC (rev 375)
@@ -48,7 +48,7 @@
fprintf( stderr, "Could not open font output file: %s\n", fname );
exit( -1 );
}
- fprintf( fontfile, "%s\n%d %f %f %f\n", pngname, FONTSIZE, 4, 15, 80 );
+ fprintf( fontfile, "%s\n%d %f %f %f\n", pngname, FONTSIZE, 4.f, 15.f, 80.f );
my_read_font( argv[1], imagedata, 64, 64, 16, 16 );
my_write_png( pngname, imagedata, 1024, 1024 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-30 01:16:19
|
Revision: 390
http://hgengine.svn.sourceforge.net/hgengine/?rev=390&view=rev
Author: cnlohr
Date: 2009-06-30 01:15:53 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add preferences (PREFSMAN)
Modified Paths:
--------------
Mercury2/adv_set.c
Added Paths:
-----------
Mercury2/src/MercuryPrefs.cpp
Mercury2/src/MercuryPrefs.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-29 04:22:13 UTC (rev 389)
+++ Mercury2/adv_set.c 2009-06-30 01:15:53 UTC (rev 390)
@@ -12,7 +12,7 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp"
+ src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Added: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp (rev 0)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:15:53 UTC (rev 390)
@@ -0,0 +1,57 @@
+#include <MercuryPrefs.h>
+#include <XMLParser.h>
+
+MercuryPreferences & MercuryPreferences::GetInstance()
+{
+ static MercuryPreferences * m_gPreferences = 0;
+ if( !m_gPreferences )
+ m_gPreferences = new MercuryPreferences();
+ return *m_gPreferences;
+}
+
+MercuryPreferences::MercuryPreferences()
+{
+ m_PrefsDoc = XMLDocument::Load("preferences.xml");
+}
+
+MercuryPreferences::~MercuryPreferences()
+{
+ delete m_PrefsDoc;
+}
+
+bool MercuryPreferences::GetValue( const MString & sDataPointer, MString & sReturn )
+{
+ return m_PrefsDoc->GetRootNode().GetValue( sDataPointer, sReturn );
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/MercuryPrefs.h
===================================================================
--- Mercury2/src/MercuryPrefs.h (rev 0)
+++ Mercury2/src/MercuryPrefs.h 2009-06-30 01:15:53 UTC (rev 390)
@@ -0,0 +1,60 @@
+#ifndef _MERCURY_PREFS_H
+#define _MERCURY_PREFS_H
+
+#include <MercuryNamedResource.h>
+#include <MercuryUtil.h>
+
+class XMLNode;
+class XMLDocument;
+
+class MercuryPreferences : public MercuryNamedResource
+{
+public:
+ MercuryPreferences();
+ ~MercuryPreferences();
+
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
+
+ static MercuryPreferences & GetInstance();
+private:
+ XMLDocument * m_PrefsDoc;
+};
+
+static InstanceCounter<MercuryPreferences> MPcounter("MercuryPreferences");
+
+#define PREFSMAN (MercuryPreferences::GetInstance())
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-30 02:59:33
|
Revision: 394
http://hgengine.svn.sourceforge.net/hgengine/?rev=394&view=rev
Author: cnlohr
Date: 2009-06-30 02:59:32 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add basis for Mercury Theme
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/src/MercuryPrefs.cpp
Added Paths:
-----------
Mercury2/src/MercuryTheme.cpp
Mercury2/src/MercuryTheme.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-30 02:07:41 UTC (rev 393)
+++ Mercury2/adv_set.c 2009-06-30 02:59:32 UTC (rev 394)
@@ -12,7 +12,8 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp"
+ src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp \
+ src/MercuryTheme.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp 2009-06-30 02:07:41 UTC (rev 393)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 02:59:32 UTC (rev 394)
@@ -31,6 +31,7 @@
MercuryPreferences::~MercuryPreferences()
{
delete m_PrefsDoc;
+ delete m_PrefsNode;
}
bool MercuryPreferences::GetValue( const MString & sDataPointer, MString & sReturn )
Added: Mercury2/src/MercuryTheme.cpp
===================================================================
--- Mercury2/src/MercuryTheme.cpp (rev 0)
+++ Mercury2/src/MercuryTheme.cpp 2009-06-30 02:59:32 UTC (rev 394)
@@ -0,0 +1,124 @@
+#include <MercuryTheme.h>
+#include <MercuryPrefs.h>
+#include <XMLParser.h>
+
+#define MAX_THEMES 100
+
+MercuryThemeManager & MercuryThemeManager::GetInstance()
+{
+ static MercuryThemeManager * m_gTheme = 0;
+ if( !m_gTheme )
+ m_gTheme = new MercuryThemeManager();
+ return *m_gTheme;
+}
+
+MercuryThemeManager::MercuryThemeManager()
+{
+ int i;
+
+ m_vThemes.resize( 0 );
+
+ for( i = 0; i < MAX_THEMES; i++ )
+ {
+ MString ThemeName = PREFSMAN.GetValueS( ssprintf( "Themes.Theme%d", i ) );
+ if( !ThemeName.length() )
+ break;
+
+ m_vThemes.resize( m_vThemes.size() + 1 );
+ if( !m_vThemes[m_vThemes.size()-1].Setup( ThemeName ) )
+ m_vThemes.resize( m_vThemes.size() - 1 );
+ }
+ if( m_vThemes.size() == 0 )
+ {
+ FAIL( "Zero themes loaded. This may be due to a misconfiguration in your preferences.ini" );
+ }
+}
+
+MercuryThemeManager::~MercuryThemeManager()
+{
+ //no code
+}
+
+bool MercuryThemeManager::GetValue( const MString & sDataPointer, MString & sReturn )
+{
+ //XXX: Incomplete
+ //This code needs to be filled out.
+ return true;
+}
+
+MercuryThemeManager::Theme::Theme()
+{
+ m_xDoc = 0;
+ m_xNode = 0;
+}
+
+MercuryThemeManager::Theme::~Theme()
+{
+ SAFE_DELETE( m_xDoc );
+ SAFE_DELETE( m_xNode );
+}
+
+bool MercuryThemeManager::Theme::Setup( const MString & sThemeName )
+{
+ sTheme = sThemeName;
+ m_xDoc = XMLDocument::Load(ssprintf("Themes/%s/metrics.xml",sTheme.c_str()));
+ if( !m_xDoc )
+ {
+ printf( "Could not open: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ m_xNode = new XMLNode();
+
+ *m_xNode = m_xDoc->GetRootNode();
+
+ if( !m_xNode->IsValid() )
+ {
+ printf( "Could not get root node in: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ *m_xNode = m_xNode->Child();
+
+ if( !m_xNode->IsValid() )
+ {
+ printf( "Could not get sub node in: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
+
Added: Mercury2/src/MercuryTheme.h
===================================================================
--- Mercury2/src/MercuryTheme.h (rev 0)
+++ Mercury2/src/MercuryTheme.h 2009-06-30 02:59:32 UTC (rev 394)
@@ -0,0 +1,71 @@
+#ifndef _MERCURY_THEME_H
+#define _MERCURY_THEME_H
+
+#include <MercuryNamedResource.h>
+#include <MercuryUtil.h> //huh?
+#include <MercuryVector.h>
+
+class XMLNode;
+class XMLDocument;
+
+class MercuryThemeManager : public MercuryNamedResource
+{
+public:
+ MercuryThemeManager();
+ ~MercuryThemeManager();
+
+ static MercuryThemeManager& GetInstance();
+
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
+private:
+ class Theme
+ {
+ public:
+ Theme( );
+ bool Setup( const MString & sThemeName );
+ ~Theme();
+ MString sTheme;
+ XMLNode * m_xNode;
+ XMLDocument * m_xDoc;
+ };
+ MVector< Theme > m_vThemes;
+};
+
+static InstanceCounter<MercuryThemeManager> MFMcounter("MercuryThemeManager");
+
+#define THEME MercuryFileManager::GetInstance()
+
+
+#endif
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-30 03:01:04
|
Revision: 395
http://hgengine.svn.sourceforge.net/hgengine/?rev=395&view=rev
Author: cnlohr
Date: 2009-06-30 03:01:02 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add themes folder!
Added Paths:
-----------
Mercury2/Themes/
Mercury2/Themes/default/
Mercury2/Themes/default/metrics.xml
Added: Mercury2/Themes/default/metrics.xml
===================================================================
--- Mercury2/Themes/default/metrics.xml (rev 0)
+++ Mercury2/Themes/default/metrics.xml 2009-06-30 03:01:02 UTC (rev 395)
@@ -0,0 +1,3 @@
+<xml>
+ <test val="5" />
+</xml>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-07-09 04:29:50
|
Revision: 417
http://hgengine.svn.sourceforge.net/hgengine/?rev=417&view=rev
Author: cnlohr
Date: 2009-07-09 04:29:49 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
standardize scancodes to the HG1 standard.
Modified Paths:
--------------
Mercury2/src/Camera.cpp
Mercury2/src/X11Window.cpp
Mercury2/src/X11Window.h
Added Paths:
-----------
Mercury2/docs/KeyboardCodes.png
Mercury2/docs/KeyboardKeys.png
Added: Mercury2/docs/KeyboardCodes.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/docs/KeyboardCodes.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/docs/KeyboardKeys.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/docs/KeyboardKeys.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-07-08 05:27:14 UTC (rev 416)
+++ Mercury2/src/Camera.cpp 2009-07-09 04:29:49 UTC (rev 417)
@@ -71,11 +71,11 @@
float a = 0;
float b = 0;
- if ( KeyboardInput::IsKeyDown(25) ) a += dTime*2; //W
- if ( KeyboardInput::IsKeyDown(39) ) a -= dTime*2; //S
+ if ( KeyboardInput::IsKeyDown('w') ) a += dTime*2; //W
+ if ( KeyboardInput::IsKeyDown('s') ) a -= dTime*2; //S
- if ( KeyboardInput::IsKeyDown(38) ) b -= dTime*2; //A
- if ( KeyboardInput::IsKeyDown(40) ) b += dTime*2; //D
+ if ( KeyboardInput::IsKeyDown('a') ) b -= dTime*2; //A
+ if ( KeyboardInput::IsKeyDown('d') ) b += dTime*2; //D
MercuryVector Xaxis = m_lookAt.CrossProduct( MercuryVector(0,1,0) );
Xaxis.NormalizeSelf();
Modified: Mercury2/src/X11Window.cpp
===================================================================
--- Mercury2/src/X11Window.cpp 2009-07-08 05:27:14 UTC (rev 416)
+++ Mercury2/src/X11Window.cpp 2009-07-09 04:29:49 UTC (rev 417)
@@ -5,6 +5,84 @@
Callback0R< MercuryWindow* > MercuryWindow::genWindowClbk(X11Window::GenX11Window); //Register window generation callback
+//XXX: THIS SECTION IS INCOMPLETE! IT NEEDS The right half of the keyboard (Bar arrow keys) + it needs the windows keys/sel keys mapped
+short X11Window::ConvertScancode( int scanin )
+{
+ switch( scanin )
+ {
+ case 9: return 27; //esc
+ case 19: return '0';
+ case 49: return 97; //`
+ case 22: return 8; //backspace
+ case 95: return 292; //F11
+ case 96: return 293; //F12
+ case 20: return 45; //-
+ case 21: return 61; //=
+ case 51: return 92; //backslash
+ case 23: return 9; //tab
+ case 50: return 160; //[lshift]
+ case 62: return 161; //[rshift]
+
+ case 38: return 'a';
+ case 56: return 'b';
+ case 54: return 'c';
+ case 40: return 'd';
+ case 26: return 'e';
+ case 41: return 'f';
+ case 42: return 'g';
+ case 43: return 'h';
+ case 31: return 'i';
+ case 44: return 'j';
+ case 45: return 'k';
+ case 46: return 'l';
+ case 58: return 'm';
+ case 57: return 'n';
+ case 32: return 'o';
+ case 33: return 'p';
+ case 24: return 'q';
+ case 27: return 'r';
+ case 39: return 's';
+ case 28: return 't';
+ case 30: return 'u';
+ case 55: return 'v';
+ case 25: return 'w';
+ case 53: return 'x';
+ case 29: return 'y';
+ case 52: return 'z';
+
+ case 34: return 91; //misc keys inbetween letters and enter
+ case 35: return 93;
+ case 47: return 59;
+ case 48: return 39;
+ case 59: return 44;
+ case 60: return 46;
+ case 61: return 47;
+
+ case 111: return 273; //arrow keys
+ case 113: return 276;
+ case 114: return 275;
+ case 116: return 274;
+
+ case 37: return 162; //ctrl, win, alt
+ case 133: return 91;
+ case 64: return 164;
+
+ case 108: return 165; //RIGHT buttons like ctrl, sel, alt
+ case 135: return 93;
+ case 105: return 263;
+
+ case 36: return 13;
+ case 66: return 15;
+
+ default:
+ if( scanin >= 10 && scanin <= 18 )
+ return scanin + ( (short)'1' - 10 );
+ if( scanin >= 67 && scanin <= 76 ) //f1-f10
+ return scanin + ( 282 - 67 );
+ return scanin;
+ }
+}
+
X11Window::X11Window(const MString& title, int width, int height, int bits, int depthBits, bool fullscreen)
:MercuryWindow(title, width, height, bits, depthBits, fullscreen), m_display(NULL)
{
@@ -165,8 +243,8 @@
{
//ignore autorepeat
if ( IsKeyRepeat(&event.xkey) ) break;
-
- KeyboardInput::ProcessKeyInput(event.xkey.keycode, true, false);
+
+ KeyboardInput::ProcessKeyInput( ConvertScancode( event.xkey.keycode ), true, false);
break;
}
case KeyRelease:
@@ -174,7 +252,7 @@
//ignore autorepeat
if ( IsKeyRepeat(&event.xkey) ) break;
- KeyboardInput::ProcessKeyInput(event.xkey.keycode, false, false);
+ KeyboardInput::ProcessKeyInput( ConvertScancode( event.xkey.keycode ), false, false);
break;
}
case MotionNotify:
Modified: Mercury2/src/X11Window.h
===================================================================
--- Mercury2/src/X11Window.h 2009-07-08 05:27:14 UTC (rev 416)
+++ Mercury2/src/X11Window.h 2009-07-09 04:29:49 UTC (rev 417)
@@ -13,7 +13,7 @@
virtual ~X11Window();
static MercuryWindow* GenX11Window();
-
+ static short ConvertScancode( int scanin );
virtual bool SwapBuffers();
virtual bool PumpMessages();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-07-10 02:52:19
|
Revision: 419
http://hgengine.svn.sourceforge.net/hgengine/?rev=419&view=rev
Author: cnlohr
Date: 2009-07-10 02:52:18 +0000 (Fri, 10 Jul 2009)
Log Message:
-----------
update Windows project and fix operation on Windows.
Modified Paths:
--------------
Mercury2/Mercury2.vcproj
Mercury2/src/MercuryNamedResource.cpp
Mercury2/src/OGLExtensions.cpp
Mercury2/src/OGLExtensions.h
Mercury2/src/Shader.cpp
Mercury2/src/Win32Window.cpp
Modified: Mercury2/Mercury2.vcproj
===================================================================
--- Mercury2/Mercury2.vcproj 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/Mercury2.vcproj 2009-07-10 02:52:18 UTC (rev 419)
@@ -6,7 +6,6 @@
ProjectGUID="{071CC088-86A7-4A9F-9FEE-50BD69132886}"
RootNamespace="Mercury2"
Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@@ -66,8 +65,6 @@
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@@ -89,6 +86,9 @@
Name="VCAppVerifierTool"
/>
<Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -142,8 +142,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@@ -165,6 +163,9 @@
Name="VCAppVerifierTool"
/>
<Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -190,10 +191,6 @@
>
</File>
<File
- RelativePath=".\src\Camera.h"
- >
- </File>
- <File
RelativePath=".\src\Frustum.cpp"
>
</File>
@@ -202,10 +199,6 @@
>
</File>
<File
- RelativePath=".\src\FullscreenQuad.h"
- >
- </File>
- <File
RelativePath=".\src\GLHelpers.cpp"
>
</File>
@@ -278,6 +271,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryNamedResource.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryNode.cpp"
>
</File>
@@ -290,10 +287,18 @@
>
</File>
<File
+ RelativePath=".\src\MercuryPrefs.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryString.cpp"
>
</File>
<File
+ RelativePath=".\src\MercuryTheme.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryThreads.cpp"
>
</File>
@@ -322,10 +327,6 @@
>
</File>
<File
- RelativePath=".\src\ModuleManager.h"
- >
- </File>
- <File
RelativePath=".\src\MQuaternion.cpp"
>
</File>
@@ -400,10 +401,18 @@
>
</File>
<File
+ RelativePath=".\src\Camera.h"
+ >
+ </File>
+ <File
RelativePath=".\src\Frustum.h"
>
</File>
<File
+ RelativePath=".\src\FullscreenQuad.h"
+ >
+ </File>
+ <File
RelativePath=".\src\glext.h"
>
</File>
@@ -496,6 +505,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryNamedResource.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryNode.h"
>
</File>
@@ -508,10 +521,18 @@
>
</File>
<File
+ RelativePath=".\src\MercuryPrefs.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryString.h"
>
</File>
<File
+ RelativePath=".\src\MercuryTheme.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryThreads.h"
>
</File>
@@ -548,6 +569,10 @@
>
</File>
<File
+ RelativePath=".\src\ModuleManager.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MQuaternion.h"
>
</File>
Modified: Mercury2/src/MercuryNamedResource.cpp
===================================================================
--- Mercury2/src/MercuryNamedResource.cpp 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/src/MercuryNamedResource.cpp 2009-07-10 02:52:18 UTC (rev 419)
@@ -1,7 +1,7 @@
#include <MercuryNamedResource.h>
#include <MercuryUtil.h>
+#include <stdio.h>
-
MString MercuryNamedResource::GetValueS( const MString & sDataPointer )
{
MString ret;
@@ -35,7 +35,11 @@
void MercuryNamedResource::SetValueF( const MString & sDataPointer, float fValue )
{
char sset[64];
+#ifdef WIN32
+ _snprintf_s( sset, 63, "%f", fValue );
+#else
snprintf( sset, 63, "%f", fValue );
+#endif
SetValueS( sDataPointer, sset );
}
@@ -83,7 +87,11 @@
void MercuryNamedResource::SetValueI( const MString & sDataPointer, int iValue )
{
char sset[64];
+#ifdef WIN32
+ _snprintf_s( sset, 63, "%d", iValue );
+#else
snprintf( sset, 63, "%d", iValue );
+#endif
SetValueS( sDataPointer, sset );
}
Modified: Mercury2/src/OGLExtensions.cpp
===================================================================
--- Mercury2/src/OGLExtensions.cpp 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/src/OGLExtensions.cpp 2009-07-10 02:52:18 UTC (rev 419)
@@ -47,6 +47,12 @@
PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
+PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB;
+PFNGLGENQUERIESARBPROC glGenQueriesARB;
+PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB;
+PFNGLBEGINQUERYARBPROC glBeginQueryARB;
+PFNGLENDQUERYARBPROC glEndQueryARB;
+
#define EXTENSION( proc, name ) \
name = (proc)wglGetProcAddress( #name ); \
if( !name ) \
@@ -96,4 +102,11 @@
EXTENSION( PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC, glFramebufferRenderbufferEXT );
EXTENSION( PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT );
EXTENSION( PFNGLDRAWBUFFERSARBPROC, glDrawBuffersARB );
+
+
+EXTENSION( PFNGLDELETEQUERIESARBPROC, glDeleteQueriesARB );
+EXTENSION( PFNGLGENQUERIESARBPROC, glGenQueriesARB );
+EXTENSION( PFNGLGETQUERYOBJECTUIVARBPROC, glGetQueryObjectuivARB );
+EXTENSION( PFNGLBEGINQUERYARBPROC, glBeginQueryARB );
+EXTENSION( PFNGLENDQUERYARBPROC, glEndQueryARB );
}
Modified: Mercury2/src/OGLExtensions.h
===================================================================
--- Mercury2/src/OGLExtensions.h 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/src/OGLExtensions.h 2009-07-10 02:52:18 UTC (rev 419)
@@ -41,6 +41,13 @@
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
+
+extern PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB;
+extern PFNGLGENQUERIESARBPROC glGenQueriesARB;
+extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB;
+extern PFNGLBEGINQUERYARBPROC glBeginQueryARB;
+extern PFNGLENDQUERYARBPROC glEndQueryARB;
+
void SetupOGLExtensions();
#endif
\ No newline at end of file
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/src/Shader.cpp 2009-07-10 02:52:18 UTC (rev 419)
@@ -6,7 +6,9 @@
#include <string.h>
//Because we need to dynamically check for glProgramParameteriEXT, even in Linux.
+#ifndef WIN32
#include <GL/glx.h>
+#endif
using namespace std;
Modified: Mercury2/src/Win32Window.cpp
===================================================================
--- Mercury2/src/Win32Window.cpp 2009-07-10 02:44:44 UTC (rev 418)
+++ Mercury2/src/Win32Window.cpp 2009-07-10 02:52:18 UTC (rev 419)
@@ -116,6 +116,8 @@
ShowWindow(m_hwnd,SW_SHOW);
SetForegroundWindow(m_hwnd); // Slightly Higher Priority
SetFocus(m_hwnd); // Sets Keyboard Focus To The Window
+
+
}
void Win32Window::SetPixelType()
@@ -175,6 +177,12 @@
bool Win32Window::SwapBuffers()
{
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_NORMALIZE);
+ glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
return (::SwapBuffers( m_hdc )==TRUE);
}
@@ -184,14 +192,35 @@
while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
{
- // Stop Update if the user is trying to quit
- if (message.message == WM_QUIT)
+ switch( message.message )
+ {
+ case WM_QUIT:
return false;
- else
- {
- TranslateMessage(&message); // Translate The Message
- DispatchMessage(&message); // Dispatch The Message
+ case WM_KEYDOWN:
+ printf( "%d\n", message.lParam>>16 );
+ break;
+ case WM_KEYUP:
+ break;
+ case WM_MOUSEMOVE:
+ break;
+ case WM_LBUTTONDOWN:
+ break;
+ case WM_LBUTTONUP:
+ break;
+ case WM_RBUTTONDOWN:
+ break;
+ case WM_RBUTTONUP:
+ break;
+ case WM_MBUTTONDOWN:
+ break;
+ case WM_MBUTTONUP:
+ break;
+ case 0x020A: //Do nothing (at least now) It's a mouse wheel!
+ break;
}
+
+ TranslateMessage(&message); // Translate The Message
+ DispatchMessage(&message); // Dispatch The Message
}
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-07-01 17:27:03
|
Revision: 396
http://hgengine.svn.sourceforge.net/hgengine/?rev=396&view=rev
Author: cnlohr
Date: 2009-07-01 17:27:00 +0000 (Wed, 01 Jul 2009)
Log Message:
-----------
move stuff to the approprate places
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Mercury2/src/MercuryFile.cpp
Mercury2/src/MercuryTheme.cpp
Mercury2/src/MercuryTheme.h
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Added Paths:
-----------
Mercury2/Themes/default/File/
Mercury2/Themes/default/File/scenegraph.xml
Mercury2/Themes/default/Font/
Mercury2/Themes/default/Font/testfont.hgfont
Mercury2/Themes/default/Font/testfont.png
Mercury2/Themes/default/Graphic/
Mercury2/Themes/default/Graphic/flame.png
Mercury2/Themes/default/Graphic/test.bmp
Mercury2/Themes/default/Graphic/test.frag
Mercury2/Themes/default/Graphic/test.vert
Mercury2/Themes/default/Graphic/test2.bmp
Mercury2/Themes/default/Graphic/test2.png
Mercury2/Themes/default/Graphic/testShader.frag
Mercury2/Themes/default/Graphic/testShader.vert
Mercury2/Themes/default/Model/
Mercury2/Themes/default/Model/beerhall.hgmdl
Mercury2/Themes/default/Model/gunther.hgmdl
Mercury2/Themes/default/Model/gunther.png
Mercury2/Themes/default/Model/lamp.hgmdl
Mercury2/Themes/default/Model/lamp.png
Mercury2/Themes/default/Model/lampN.hgmdl
Mercury2/Themes/default/Model/map.hgmdl
Mercury2/Themes/default/Model/map.png
Removed Paths:
-------------
Mercury2/beerhall.hgmdl
Mercury2/flame.png
Mercury2/lamp.hgmdl
Mercury2/lamp.png
Mercury2/lampN.hgmdl
Mercury2/map.hgmdl
Mercury2/map.png
Mercury2/scenegraph.xml
Mercury2/test.bmp
Mercury2/test2.bmp
Mercury2/test2.png
Mercury2/testShader.frag
Mercury2/testShader.vert
Mercury2/testfont.hgfont
Mercury2/testfont.png
Added: Mercury2/Themes/default/File/scenegraph.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraph.xml (rev 0)
+++ Mercury2/Themes/default/File/scenegraph.xml 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,50 @@
+<SceneGraph name="root">
+<!-- <node type="cameranode" movx="6" movz="-5.5" movy="3" rotx="-45" roty="90">
+ <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
+ </node>
+-->
+ <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
+ <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp"/>
+ </node>
+
+ <node type="transformnode" movz="-5" >
+ <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="FONT:testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
+ </node>
+<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
+ <asset type="fullscreenquad"/>
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true">
+ <asset type="shader" file="testShader"/>
+--> <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
+ <asset type="texture" file="MODEL:map.png"/>
+ <asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
+ </node>
+ <node type="mercurynode" name="lampForest" >
+ <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
+ <node type="mercurynode" name="lamp">
+ <node type="transformnode" rotx="-90" >
+ <asset type="texture" file="MODEL:lamp.png"/>
+ <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
+ </node>
+ <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
+ <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
+ <asset type="texture" file="GRAPHIC:flame.png"/>
+ <asset type="quad"/>
+ </node>
+ </node>
+ </node>
+ <node type="transformnode" movx="1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="3" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
+ </node>
+ <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
+ </node>
+<!-- </node> -->
+</SceneGraph>
Added: Mercury2/Themes/default/Font/testfont.hgfont
===================================================================
--- Mercury2/Themes/default/Font/testfont.hgfont (rev 0)
+++ Mercury2/Themes/default/Font/testfont.hgfont 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,258 @@
+FONT:testfont.png
+64 4.000000 15.000000 80.000000
+0 0.000000 0.000000 0.031250 0.040039 32 41 8 41
+1 0.062500 0.000000 0.093750 0.040039 32 41 8 41
+2 0.125000 0.000000 0.156250 0.040039 32 41 8 41
+3 0.187500 0.000000 0.218750 0.040039 32 41 8 41
+4 0.250000 0.000000 0.281250 0.040039 32 41 8 41
+5 0.312500 0.000000 0.343750 0.040039 32 41 8 41
+6 0.375000 0.000000 0.406250 0.040039 32 41 8 41
+7 0.437500 0.000000 0.468750 0.040039 32 41 8 41
+8 0.500000 0.000000 0.531250 0.040039 32 41 8 41
+9 0.562500 0.000000 0.593750 0.040039 32 41 8 41
+10 0.625000 0.000000 0.656250 0.040039 32 41 8 41
+11 0.687500 0.000000 0.718750 0.040039 32 41 8 41
+12 0.750000 0.000000 0.781250 0.040039 32 41 8 41
+13 0.812500 0.000000 0.843750 0.040039 32 41 8 41
+14 0.875000 0.000000 0.906250 0.040039 32 41 8 41
+15 0.937500 0.000000 0.968750 0.040039 32 41 8 41
+16 0.000000 0.062500 0.031250 0.102539 32 41 8 41
+17 0.062500 0.062500 0.093750 0.102539 32 41 8 41
+18 0.125000 0.062500 0.156250 0.102539 32 41 8 41
+19 0.187500 0.062500 0.218750 0.102539 32 41 8 41
+20 0.250000 0.062500 0.281250 0.102539 32 41 8 41
+21 0.312500 0.062500 0.343750 0.102539 32 41 8 41
+22 0.375000 0.062500 0.406250 0.102539 32 41 8 41
+23 0.437500 0.062500 0.468750 0.102539 32 41 8 41
+24 0.500000 0.062500 0.531250 0.102539 32 41 8 41
+25 0.562500 0.062500 0.593750 0.102539 32 41 8 41
+26 0.625000 0.062500 0.656250 0.102539 32 41 8 41
+27 0.687500 0.062500 0.718750 0.102539 32 41 8 41
+28 0.750000 0.062500 0.781250 0.102539 32 41 8 41
+29 0.812500 0.062500 0.843750 0.102539 32 41 8 41
+30 0.875000 0.062500 0.906250 0.102539 32 41 8 41
+31 0.937500 0.062500 0.968750 0.102539 32 41 8 41
+32 0.000000 0.125000 0.000000 0.125000 0 0 0 0
+33 0.062500 0.125000 0.068359 0.169922 6 46 7 46
+34 0.125000 0.125000 0.141602 0.140625 17 16 3 46
+35 0.187500 0.125000 0.221680 0.169922 35 46 0 46
+36 0.250000 0.125000 0.279297 0.178711 30 55 3 48
+37 0.312500 0.125000 0.360352 0.171875 49 48 4 47
+38 0.375000 0.125000 0.413086 0.171875 39 48 3 47
+39 0.437500 0.125000 0.443359 0.140625 6 16 3 46
+40 0.500000 0.125000 0.515625 0.182617 16 59 4 46
+41 0.562500 0.125000 0.578125 0.182617 16 59 1 46
+42 0.625000 0.125000 0.645508 0.143555 21 19 2 46
+43 0.687500 0.125000 0.717773 0.155273 31 31 3 38
+44 0.750000 0.125000 0.755859 0.139648 6 15 6 6
+45 0.812500 0.125000 0.829102 0.129883 17 5 2 19
+46 0.875000 0.125000 0.880859 0.130859 6 6 6 6
+47 0.937500 0.125000 0.956055 0.169922 19 46 0 46
+48 0.000000 0.187500 0.029297 0.233398 30 47 3 46
+49 0.062500 0.187500 0.079102 0.232422 17 46 7 46
+50 0.125000 0.187500 0.155273 0.232422 31 46 1 46
+51 0.187500 0.187500 0.216797 0.233398 30 47 3 46
+52 0.250000 0.187500 0.281250 0.231445 32 45 1 45
+53 0.312500 0.187500 0.341797 0.232422 30 46 3 45
+54 0.375000 0.187500 0.405273 0.233398 31 47 2 46
+55 0.437500 0.187500 0.466797 0.231445 30 45 3 45
+56 0.500000 0.187500 0.529297 0.233398 30 47 3 46
+57 0.562500 0.187500 0.591797 0.233398 30 47 3 46
+58 0.625000 0.187500 0.630859 0.220703 6 34 6 34
+59 0.687500 0.187500 0.693359 0.229492 6 43 6 34
+60 0.750000 0.187500 0.778320 0.217773 29 31 4 38
+61 0.812500 0.187500 0.841797 0.206055 30 19 3 32
+62 0.875000 0.187500 0.903320 0.217773 29 31 4 38
+63 0.937500 0.187500 0.966797 0.233398 30 47 3 47
+64 0.000000 0.250000 0.057617 0.308594 59 60 3 47
+65 0.062500 0.250000 0.106445 0.294922 45 46 -1 46
+66 0.125000 0.250000 0.159180 0.294922 35 46 5 46
+67 0.187500 0.250000 0.226562 0.296875 40 48 3 47
+68 0.250000 0.250000 0.287109 0.294922 38 46 5 46
+69 0.312500 0.250000 0.346680 0.294922 35 46 5 46
+70 0.375000 0.250000 0.405273 0.294922 31 46 5 46
+71 0.437500 0.250000 0.479492 0.296875 43 48 3 47
+72 0.500000 0.250000 0.535156 0.294922 36 46 5 46
+73 0.562500 0.250000 0.568359 0.294922 6 46 6 46
+74 0.625000 0.250000 0.650391 0.295898 26 47 1 46
+75 0.687500 0.250000 0.724609 0.294922 38 46 5 46
+76 0.750000 0.250000 0.778320 0.294922 29 46 5 46
+77 0.812500 0.250000 0.854492 0.294922 43 46 5 46
+78 0.875000 0.250000 0.910156 0.294922 36 46 5 46
+79 0.937500 0.250000 0.980469 0.296875 44 48 3 47
+80 0.000000 0.312500 0.034180 0.357422 35 46 5 46
+81 0.062500 0.312500 0.105469 0.362305 44 51 3 47
+82 0.125000 0.312500 0.164062 0.357422 40 46 5 46
+83 0.187500 0.312500 0.223633 0.359375 37 48 3 47
+84 0.250000 0.312500 0.285156 0.357422 36 46 2 46
+85 0.312500 0.312500 0.347656 0.358398 36 47 5 46
+86 0.375000 0.312500 0.418945 0.357422 45 46 -1 46
+87 0.437500 0.312500 0.499023 0.357422 63 46 0 46
+88 0.500000 0.312500 0.540039 0.357422 41 46 -1 46
+89 0.562500 0.312500 0.603516 0.357422 42 46 0 46
+90 0.625000 0.312500 0.660156 0.357422 36 46 1 46
+91 0.687500 0.312500 0.699219 0.370117 12 59 4 46
+92 0.750000 0.312500 0.768555 0.357422 19 46 -1 46
+93 0.812500 0.312500 0.824219 0.370117 12 59 2 46
+94 0.875000 0.312500 0.899414 0.336914 25 25 1 47
+95 0.937500 0.312500 0.973633 0.317383 37 5 -1 -8
+96 0.000000 0.375000 0.010742 0.383789 11 9 3 46
+97 0.062500 0.375000 0.091797 0.410156 30 36 3 35
+98 0.125000 0.375000 0.153320 0.420898 29 47 4 46
+99 0.187500 0.375000 0.215820 0.410156 29 36 3 35
+100 0.250000 0.375000 0.278320 0.420898 29 47 2 46
+101 0.312500 0.375000 0.342773 0.410156 31 36 2 35
+102 0.375000 0.375000 0.394531 0.420898 20 47 1 47
+103 0.437500 0.375000 0.465820 0.422852 29 49 2 35
+104 0.500000 0.375000 0.527344 0.419922 28 46 4 46
+105 0.562500 0.375000 0.568359 0.419922 6 46 4 46
+106 0.625000 0.375000 0.637695 0.433594 13 60 -3 46
+107 0.687500 0.375000 0.714844 0.419922 28 46 4 46
+108 0.750000 0.375000 0.755859 0.419922 6 46 4 46
+109 0.812500 0.375000 0.857422 0.409180 46 35 4 35
+110 0.875000 0.375000 0.902344 0.409180 28 35 4 35
+111 0.937500 0.375000 0.966797 0.410156 30 36 3 35
+112 0.000000 0.437500 0.028320 0.484375 29 48 4 35
+113 0.062500 0.437500 0.090820 0.484375 29 48 2 35
+114 0.125000 0.437500 0.142578 0.471680 18 35 4 35
+115 0.187500 0.437500 0.213867 0.472656 27 36 2 35
+116 0.250000 0.437500 0.265625 0.483398 16 47 1 46
+117 0.312500 0.437500 0.339844 0.471680 28 35 4 34
+118 0.375000 0.437500 0.405273 0.470703 31 34 1 34
+119 0.437500 0.437500 0.485352 0.470703 49 34 -1 34
+120 0.500000 0.437500 0.531250 0.470703 32 34 0 34
+121 0.562500 0.437500 0.593750 0.484375 32 48 0 34
+122 0.625000 0.437500 0.653320 0.470703 29 34 1 34
+123 0.687500 0.437500 0.705078 0.497070 18 61 1 47
+124 0.750000 0.437500 0.754883 0.496094 5 60 6 46
+125 0.812500 0.437500 0.830078 0.497070 18 61 2 47
+126 0.875000 0.437500 0.906250 0.448242 32 11 2 28
+127 0.937500 0.437500 0.968750 0.477539 32 41 8 41
+128 0.000000 0.500000 0.031250 0.540039 32 41 8 41
+129 0.062500 0.500000 0.093750 0.540039 32 41 8 41
+130 0.125000 0.500000 0.156250 0.540039 32 41 8 41
+131 0.187500 0.500000 0.218750 0.540039 32 41 8 41
+132 0.250000 0.500000 0.281250 0.540039 32 41 8 41
+133 0.312500 0.500000 0.343750 0.540039 32 41 8 41
+134 0.375000 0.500000 0.406250 0.540039 32 41 8 41
+135 0.437500 0.500000 0.468750 0.540039 32 41 8 41
+136 0.500000 0.500000 0.531250 0.540039 32 41 8 41
+137 0.562500 0.500000 0.593750 0.540039 32 41 8 41
+138 0.625000 0.500000 0.656250 0.540039 32 41 8 41
+139 0.687500 0.500000 0.718750 0.540039 32 41 8 41
+140 0.750000 0.500000 0.781250 0.540039 32 41 8 41
+141 0.812500 0.500000 0.843750 0.540039 32 41 8 41
+142 0.875000 0.500000 0.906250 0.540039 32 41 8 41
+143 0.937500 0.500000 0.968750 0.540039 32 41 8 41
+144 0.000000 0.562500 0.031250 0.602539 32 41 8 41
+145 0.062500 0.562500 0.093750 0.602539 32 41 8 41
+146 0.125000 0.562500 0.156250 0.602539 32 41 8 41
+147 0.187500 0.562500 0.218750 0.602539 32 41 8 41
+148 0.250000 0.562500 0.281250 0.602539 32 41 8 41
+149 0.312500 0.562500 0.343750 0.602539 32 41 8 41
+150 0.375000 0.562500 0.406250 0.602539 32 41 8 41
+151 0.437500 0.562500 0.468750 0.602539 32 41 8 41
+152 0.500000 0.562500 0.531250 0.602539 32 41 8 41
+153 0.562500 0.562500 0.593750 0.602539 32 41 8 41
+154 0.625000 0.562500 0.656250 0.602539 32 41 8 41
+155 0.687500 0.562500 0.718750 0.602539 32 41 8 41
+156 0.750000 0.562500 0.781250 0.602539 32 41 8 41
+157 0.812500 0.562500 0.843750 0.602539 32 41 8 41
+158 0.875000 0.562500 0.906250 0.602539 32 41 8 41
+159 0.937500 0.562500 0.968750 0.602539 32 41 8 41
+160 0.000000 0.625000 0.000000 0.625000 0 0 0 0
+161 0.062500 0.625000 0.068359 0.670898 6 47 7 34
+162 0.125000 0.625000 0.153320 0.682617 29 59 3 46
+163 0.187500 0.625000 0.219727 0.671875 33 48 1 47
+164 0.250000 0.625000 0.281250 0.652344 32 28 1 36
+165 0.312500 0.625000 0.346680 0.669922 35 46 -1 46
+166 0.375000 0.625000 0.379883 0.683594 5 60 6 46
+167 0.437500 0.625000 0.466797 0.683594 30 60 3 47
+168 0.500000 0.625000 0.517578 0.630859 18 6 2 46
+169 0.562500 0.625000 0.608398 0.671875 47 48 0 47
+170 0.625000 0.625000 0.646484 0.647461 22 23 1 47
+171 0.687500 0.625000 0.713867 0.653320 27 29 4 31
+172 0.750000 0.625000 0.779297 0.643555 30 19 3 32
+173 0.812500 0.625000 0.829102 0.629883 17 5 2 19
+174 0.875000 0.625000 0.920898 0.671875 47 48 0 47
+175 0.937500 0.625000 0.973633 0.629883 37 5 -1 54
+176 0.000000 0.687500 0.016602 0.704102 17 17 4 47
+177 0.062500 0.687500 0.092773 0.724609 31 38 2 38
+178 0.125000 0.687500 0.143555 0.709961 19 23 1 47
+179 0.187500 0.687500 0.206055 0.709961 19 23 1 47
+180 0.250000 0.687500 0.260742 0.696289 11 9 7 45
+181 0.312500 0.687500 0.338867 0.733398 27 47 5 34
+182 0.375000 0.687500 0.408203 0.745117 34 59 0 46
+183 0.437500 0.687500 0.443359 0.693359 6 6 6 25
+184 0.500000 0.687500 0.512695 0.701172 13 14 3 0
+185 0.562500 0.687500 0.574219 0.709961 12 23 4 47
+186 0.625000 0.687500 0.645508 0.709961 21 23 1 47
+187 0.687500 0.687500 0.713867 0.715820 27 29 5 31
+188 0.750000 0.687500 0.796875 0.735352 48 49 4 47
+189 0.812500 0.687500 0.859375 0.734375 48 48 4 47
+190 0.875000 0.687500 0.924805 0.735352 51 49 1 47
+191 0.937500 0.687500 0.965820 0.734375 29 48 5 34
+192 0.000000 0.750000 0.043945 0.806641 45 58 -1 58
+193 0.062500 0.750000 0.106445 0.806641 45 58 -1 58
+194 0.125000 0.750000 0.168945 0.806641 45 58 -1 58
+195 0.187500 0.750000 0.231445 0.805664 45 57 -1 57
+196 0.250000 0.750000 0.293945 0.803711 45 55 -1 55
+197 0.312500 0.750000 0.356445 0.803711 45 55 -1 55
+198 0.375000 0.750000 0.435547 0.794922 62 46 -1 46
+199 0.437500 0.750000 0.476562 0.809570 40 61 3 47
+200 0.500000 0.750000 0.534180 0.806641 35 58 5 58
+201 0.562500 0.750000 0.596680 0.806641 35 58 5 58
+202 0.625000 0.750000 0.659180 0.806641 35 58 5 58
+203 0.687500 0.750000 0.721680 0.803711 35 55 5 55
+204 0.750000 0.750000 0.760742 0.806641 11 58 2 58
+205 0.812500 0.750000 0.823242 0.806641 11 58 5 58
+206 0.875000 0.750000 0.894531 0.806641 20 58 -1 58
+207 0.937500 0.750000 0.955078 0.803711 18 55 0 55
+208 0.000000 0.812500 0.041992 0.857422 43 46 0 46
+209 0.062500 0.812500 0.097656 0.868164 36 57 5 57
+210 0.125000 0.812500 0.167969 0.870117 44 59 3 58
+211 0.187500 0.812500 0.230469 0.870117 44 59 3 58
+212 0.250000 0.812500 0.292969 0.870117 44 59 3 58
+213 0.312500 0.812500 0.355469 0.869141 44 58 3 57
+214 0.375000 0.812500 0.417969 0.867188 44 56 3 55
+215 0.437500 0.812500 0.463867 0.838867 27 27 5 36
+216 0.500000 0.812500 0.543945 0.861328 45 50 3 47
+217 0.562500 0.812500 0.597656 0.870117 36 59 5 58
+218 0.625000 0.812500 0.660156 0.870117 36 59 5 58
+219 0.687500 0.812500 0.722656 0.870117 36 59 5 58
+220 0.750000 0.812500 0.785156 0.867188 36 56 5 55
+221 0.812500 0.812500 0.853516 0.869141 42 58 0 58
+222 0.875000 0.812500 0.909180 0.857422 35 46 5 46
+223 0.937500 0.812500 0.968750 0.859375 32 48 5 47
+224 0.000000 0.875000 0.029297 0.920898 30 47 3 46
+225 0.062500 0.875000 0.091797 0.920898 30 47 3 46
+226 0.125000 0.875000 0.154297 0.920898 30 47 3 46
+227 0.187500 0.875000 0.216797 0.919922 30 46 3 45
+228 0.250000 0.875000 0.279297 0.917969 30 44 3 43
+229 0.312500 0.875000 0.341797 0.922852 30 49 3 48
+230 0.375000 0.875000 0.425781 0.910156 52 36 2 35
+231 0.437500 0.875000 0.465820 0.922852 29 49 3 35
+232 0.500000 0.875000 0.530273 0.920898 31 47 2 46
+233 0.562500 0.875000 0.592773 0.920898 31 47 2 46
+234 0.625000 0.875000 0.655273 0.920898 31 47 2 46
+235 0.687500 0.875000 0.717773 0.917969 31 44 2 43
+236 0.750000 0.875000 0.760742 0.919922 11 46 2 46
+237 0.812500 0.875000 0.823242 0.919922 11 46 5 46
+238 0.875000 0.875000 0.894531 0.919922 20 46 -1 46
+239 0.937500 0.875000 0.955078 0.916992 18 43 0 43
+240 0.000000 0.937500 0.030273 0.983398 31 47 2 46
+241 0.062500 0.937500 0.089844 0.981445 28 45 4 45
+242 0.125000 0.937500 0.154297 0.983398 30 47 3 46
+243 0.187500 0.937500 0.216797 0.983398 30 47 3 46
+244 0.250000 0.937500 0.279297 0.983398 30 47 3 46
+245 0.312500 0.937500 0.341797 0.982422 30 46 3 45
+246 0.375000 0.937500 0.404297 0.980469 30 44 3 43
+247 0.437500 0.937500 0.468750 0.961914 32 25 3 35
+248 0.500000 0.937500 0.531250 0.977539 32 41 3 38
+249 0.562500 0.937500 0.589844 0.983398 28 47 4 46
+250 0.625000 0.937500 0.652344 0.983398 28 47 4 46
+251 0.687500 0.937500 0.714844 0.983398 28 47 4 46
+252 0.750000 0.937500 0.777344 0.980469 28 44 4 43
+253 0.812500 0.937500 0.843750 0.996094 32 60 0 46
+254 0.875000 0.937500 0.903320 0.995117 29 59 4 46
+255 0.937500 0.937500 0.968750 0.993164 32 57 0 43
Added: Mercury2/Themes/default/Font/testfont.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Font/testfont.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Graphic/flame.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Graphic/flame.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Graphic/test.bmp
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Graphic/test.bmp
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Graphic/test.frag
===================================================================
--- Mercury2/Themes/default/Graphic/test.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/test.frag 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_FragColor = vec4( 1., 0., 1., 1. );
+}
\ No newline at end of file
Added: Mercury2/Themes/default/Graphic/test.vert
===================================================================
--- Mercury2/Themes/default/Graphic/test.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/test.vert 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_Position = ftransform();
+}
\ No newline at end of file
Added: Mercury2/Themes/default/Graphic/test2.bmp
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Graphic/test2.bmp
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Graphic/test2.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Graphic/test2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Graphic/testShader.frag
===================================================================
--- Mercury2/Themes/default/Graphic/testShader.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/testShader.frag 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,9 @@
+uniform sampler2D HG_Texture0;
+varying vec3 normal;
+
+void main()
+{
+// gl_FragData[0] = texture2D(HG_Texture0, gl_TexCoord[0].st);
+ vec3 n = normalize(normal);
+ gl_FragData[0].rgb = 0.5 + 0.5 * n;
+}
Added: Mercury2/Themes/default/Graphic/testShader.vert
===================================================================
--- Mercury2/Themes/default/Graphic/testShader.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/testShader.vert 2009-07-01 17:27:00 UTC (rev 396)
@@ -0,0 +1,13 @@
+varying vec3 normal;
+uniform mat4 HG_ModelMatrix;
+
+void main()
+{
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+
+ vec4 n = vec4(gl_Normal, 0);
+
+ //normalize in fragment
+ normal = (HG_ModelMatrix * n).xyz;
+}
Added: Mercury2/Themes/default/Model/beerhall.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/beerhall.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/gunther.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/gunther.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/gunther.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/gunther.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/lamp.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/lamp.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/lamp.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/lamp.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/lampN.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/lampN.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/map.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/map.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/Themes/default/Model/map.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Model/map.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: Mercury2/beerhall.hgmdl
===================================================================
(Binary files differ)
Deleted: Mercury2/flame.png
===================================================================
(Binary files differ)
Deleted: Mercury2/lamp.hgmdl
===================================================================
(Binary files differ)
Deleted: Mercury2/lamp.png
===================================================================
(Binary files differ)
Deleted: Mercury2/lampN.hgmdl
===================================================================
(Binary files differ)
Deleted: Mercury2/map.hgmdl
===================================================================
(Binary files differ)
Deleted: Mercury2/map.png
===================================================================
(Binary files differ)
Deleted: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-30 03:01:02 UTC (rev 395)
+++ Mercury2/scenegraph.xml 2009-07-01 17:27:00 UTC (rev 396)
@@ -1,50 +0,0 @@
-<SceneGraph name="root">
-<!-- <node type="cameranode" movx="6" movz="-5.5" movy="3" rotx="-45" roty="90">
- <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
- </node>
--->
- <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp"/>
- </node>
-
- <node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
- </node>
-<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
- <asset type="fullscreenquad"/>
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true">
- <asset type="shader" file="testShader"/>
---> <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
- <asset type="texture" file="map.png"/>
- <asset type="hgmdlmodel" file="map.hgmdl" />
- </node>
- <node type="mercurynode" name="lampForest" >
- <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
- <node type="mercurynode" name="lamp">
- <node type="transformnode" rotx="-90" >
- <asset type="texture" file="lamp.png"/>
- <asset type="hgmdlmodel" file="lampN.hgmdl" />
- </node>
- <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
- <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
- <asset type="texture" file="flame.png"/>
- <asset type="quad"/>
- </node>
- </node>
- </node>
- <node type="transformnode" movx="1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="3" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
- </node>
- <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
- </node>
-<!-- </node> -->
-</SceneGraph>
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-06-30 03:01:02 UTC (rev 395)
+++ Mercury2/src/Mercury2.cpp 2009-07-01 17:27:00 UTC (rev 396)
@@ -17,7 +17,7 @@
#include <Texture.h>
#include <GLHeaders.h>
#include <ModuleManager.h>
-
+#include <MercuryFile.h>
bool SHOWBOUNDINGVOLUME = false;
MSemaphore UpdateLoopGo;
@@ -57,7 +57,7 @@
MercuryNode* root = new MercuryNode();
- XMLDocument* doc = XMLDocument::Load("scenegraph.xml");
+ XMLDocument* doc = XMLDocument::Load("FILE:scenegraph.xml");
XMLNode r = doc->GetRootNode();
root->LoadFromXML( r );
Modified: Mercury2/src/MercuryFile.cpp
===================================================================
--- Mercury2/src/MercuryFile.cpp 2009-06-30 03:01:02 UTC (rev 395)
+++ Mercury2/src/MercuryFile.cpp 2009-07-01 17:27:00 UTC (rev 396)
@@ -1,10 +1,11 @@
#include "MercuryFile.h"
-#include <MercuryVector.h>
-#include <MercuryFileDriverDirect.h>
-#include <MercuryFileDriverNet.h>
-#include <MercuryFileDriverMem.h>
-#include <MercuryFileDriverZipped.h>
-#include <MercuryFileDriverPacked.h>
+#include "MercuryVector.h"
+#include "MercuryFileDriverDirect.h"
+#include "MercuryFileDriverNet.h"
+#include "MercuryFileDriverMem.h"
+#include "MercuryFileDriverZipped.h"
+#include "MercuryFileDriverPacked.h"
+#include "MercuryTheme.h"
/********************FILE MANAGER**************************/
@@ -50,19 +51,27 @@
if( sPath.empty() )
return NULL;
-//XXX !!! XXX NOTE TODO
-//This code below is very useful, but cannot be implemented until we get a theme system. Once then, we can give it a shot.
+ //Tricky: We can support all caps colon (GRAPHIC:, FILE:, etc.)
+ //So, instead of doing some checking in multiple passes, we are doing
+ //a generalized system to handle getting it.
+ {
+ const char * c;
+ for( c = sPath.c_str(); (*c <= 'Z' && *c >= 'A'); c++ );
+ if( *c == ':' )
+ {
+ c++;
+ MString ExtString = ToProper( MString( sPath.c_str(), c-sPath.c_str()-1 ) ) + "/" + c;
+ const MVector< MercuryThemeManager::Theme > & th = THEME.GetThemes();
+...
[truncated message content] |
|
From: <cn...@us...> - 2009-07-23 03:50:12
|
Revision: 433
http://hgengine.svn.sourceforge.net/hgengine/?rev=433&view=rev
Author: cnlohr
Date: 2009-07-23 03:50:09 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
Update windows project, fixing some 64-bit compat issues.
Modified Paths:
--------------
Mercury2/Mercury2.vcproj
Mercury2/modules/TextNode.cpp
Mercury2/src/GLHelpers.cpp
Mercury2/src/MercuryFile.cpp
Mercury2/src/MercuryFileDriverDirect.cpp
Mercury2/src/MercuryMath.h
Mercury2/src/MercuryNamedResource.cpp
Modified: Mercury2/Mercury2.vcproj
===================================================================
--- Mercury2/Mercury2.vcproj 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/Mercury2.vcproj 2009-07-23 03:50:09 UTC (rev 433)
@@ -6,6 +6,7 @@
ProjectGUID="{071CC088-86A7-4A9F-9FEE-50BD69132886}"
RootNamespace="Mercury2"
Keyword="Win32Proj"
+ TargetFrameworkVersion="0"
>
<Platforms>
<Platform
@@ -41,13 +42,12 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;src;src/include;src/include/png;src/include/zlib"
- PreprocessorDefinitions="HGENGINE,WIN32"
+ PreprocessorDefinitions="HGENGINE;WIN32;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
- Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
@@ -86,9 +86,6 @@
Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -118,11 +115,10 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;src;src/include;src/include/png;src/include/zlib"
- PreprocessorDefinitions="HGENGINE,WIN32"
+ PreprocessorDefinitions="HGENGINE;WIN32;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
@@ -163,9 +159,6 @@
Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -283,10 +276,6 @@
>
</File>
<File
- RelativePath=".\src\MercuryPoint.cpp"
- >
- </File>
- <File
RelativePath=".\src\MercuryPrefs.cpp"
>
</File>
@@ -517,10 +506,6 @@
>
</File>
<File
- RelativePath=".\src\MercuryPoint.h"
- >
- </File>
- <File
RelativePath=".\src\MercuryPrefs.h"
>
</File>
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/modules/TextNode.cpp 2009-07-23 03:50:09 UTC (rev 433)
@@ -242,8 +242,8 @@
}
//Stage 3: Actually generate the geometry.
- ((MercuryVBO*)m_kVBO.Ptr())->AllocateIndexSpace(chars.size()*6);
- ((MercuryVBO*)m_kVBO.Ptr())->AllocateVertexSpace(chars.size()*4);
+ ((MercuryVBO*)m_kVBO.Ptr())->AllocateIndexSpace((unsigned)chars.size()*6);
+ ((MercuryVBO*)m_kVBO.Ptr())->AllocateVertexSpace((unsigned)chars.size()*4);
for( unsigned i = 0; i < chars.size(); i++ )
{
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/src/GLHelpers.cpp 2009-07-23 03:50:09 UTC (rev 433)
@@ -75,7 +75,7 @@
winX, winY, winZ,
modelview, projection, viewport,
&mouseX, &mouseY, &mouseZ);
- return MercuryVertex( mouseX, mouseY, mouseZ );
+ return MercuryVertex( (float)mouseX, (float)mouseY, (float)mouseZ );
}
/****************************************************************************
Modified: Mercury2/src/MercuryFile.cpp
===================================================================
--- Mercury2/src/MercuryFile.cpp 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/src/MercuryFile.cpp 2009-07-23 03:50:09 UTC (rev 433)
@@ -60,7 +60,7 @@
if( *c == ':' )
{
c++;
- MString ExtString = ToProper( MString( sPath.c_str(), c-sPath.c_str()-1 ) ) + "/" + c;
+ MString ExtString = ToProper( MString( sPath.c_str(), (int)(c-sPath.c_str()-1) ) ) + "/" + c;
const MVector< MercuryThemeManager::Theme > & th = THEME.GetThemes();
for( int i = (int)th.size()-1; i >= 0; i-- )
{
Modified: Mercury2/src/MercuryFileDriverDirect.cpp
===================================================================
--- Mercury2/src/MercuryFileDriverDirect.cpp 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/src/MercuryFileDriverDirect.cpp 2009-07-23 03:50:09 UTC (rev 433)
@@ -150,7 +150,7 @@
{
if ( m_fF == NULL )
return false;
- return ( fread( data, 1, length, m_fF) );
+ return (unsigned long)( fread( data, 1, length, m_fF) );
}
bool MercuryFileObjectDirect::Check()
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/src/MercuryMath.h 2009-07-23 03:50:09 UTC (rev 433)
@@ -13,9 +13,10 @@
#ifdef WIN32
#include <limits>
#define INFINITY (std::numeric_limits<float>::infinity())
+#else
+#define MAXINT (0x7FFFFFFF)
#endif
-#define MAXINT (0x7FFFFFFF)
void ZeroFloatRow(FloatRow& r);
Modified: Mercury2/src/MercuryNamedResource.cpp
===================================================================
--- Mercury2/src/MercuryNamedResource.cpp 2009-07-21 01:52:34 UTC (rev 432)
+++ Mercury2/src/MercuryNamedResource.cpp 2009-07-23 03:50:09 UTC (rev 433)
@@ -56,7 +56,7 @@
if( tmpret.compare( "YES" ) == 0 ) return 1;
if( tmpret.compare( "NO" ) == 0 ) return 0;
- return StrToInt( tmpret );
+ return StrToInt( tmpret ) != 0;
}
if( bSetValue )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-07-25 20:25:23
|
Revision: 438
http://hgengine.svn.sourceforge.net/hgengine/?rev=438&view=rev
Author: axlecrusher
Date: 2009-07-25 20:25:16 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
orthographic is still broken, but we are getting closer
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraph.xml
Mercury2/adv_set.c
Mercury2/src/Camera.cpp
Mercury2/src/Camera.h
Mercury2/src/MercuryVBO.cpp
Mercury2/src/Orthographic.cpp
Mercury2/src/Orthographic.h
Mercury2/src/Viewport.cpp
Mercury2/src/Viewport.h
Modified: Mercury2/Themes/default/File/scenegraph.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraph.xml 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/Themes/default/File/scenegraph.xml 2009-07-25 20:25:16 UTC (rev 438)
@@ -1,50 +1,44 @@
<SceneGraph name="root">
-<!-- <node type="cameranode" movx="6" movz="-5.5" movy="3" rotx="-45" roty="90">
- <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
- </node>
--->
- <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp"/>
- </node>
-
- <node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="FONT:testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
- </node>
-<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
- <asset type="fullscreenquad"/>
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true">
- <asset type="shader" file="testShader"/>
---> <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
- <asset type="texture" file="MODEL:map.png"/>
- <asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
- </node>
- <node type="mercurynode" name="lampForest" >
- <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
- <node type="mercurynode" name="lamp">
- <node type="transformnode" rotx="-90" >
- <asset type="texture" file="MODEL:lamp.png"/>
- <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- </node>
- <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
- <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
- <asset type="texture" file="GRAPHIC:flame.png"/>
- <asset type="quad"/>
+ <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
+ <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
+ <node type="transformnode" movz="-5" >
+ <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="FONT:testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
+ </node>
+ <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
+ <asset type="texture" file="MODEL:map.png"/>
+ <asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
+ </node>
+ <node type="mercurynode" name="lampForest" >
+ <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
+ <node type="mercurynode" name="lamp">
+ <node type="transformnode" rotx="-90" >
+ <asset type="texture" file="MODEL:lamp.png"/>
+ <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
</node>
+ <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
+ <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
+ <asset type="texture" file="GRAPHIC:flame.png"/>
+ <asset type="quad"/>
+ </node>
+ </node>
</node>
+ <node type="transformnode" movx="1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="3" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
</node>
- <node type="transformnode" movx="1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="3" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
+ <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
</node>
- <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
</node>
-<!-- </node> -->
+ </node>
+<!-- <node type="orthographic" left="0" right="1" top="0" bottom="1" near="-1" far="1">
+ <asset type="quad"/>
+ </node> -->
</SceneGraph>
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/adv_set.c 2009-07-25 20:25:16 UTC (rev 438)
@@ -13,7 +13,7 @@
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp \
- src/MercuryTheme.cpp"
+ src/MercuryTheme.cpp src/Orthographic.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Camera.cpp 2009-07-25 20:25:16 UTC (rev 438)
@@ -12,6 +12,18 @@
REGISTER_FOR_MESSAGE( INPUTEVENT_MOUSE );
}
+void CameraNode::PreRender(const MercuryMatrix& matrix)
+{
+ VIEWMATRIX = m_viewMatrix;
+ TransformNode::PreRender(matrix);
+}
+
+void CameraNode::Render(const MercuryMatrix& matrix)
+{
+ VIEWMATRIX = m_viewMatrix;
+ TransformNode::Render(matrix);
+}
+
void CameraNode::ComputeMatrix()
{
m_tainted = false;
@@ -33,7 +45,7 @@
local.Translate( GetPosition()*-1 );
// m_globalMatrix = local * parent; //fold in any parent transform in reverse (correct rotation)
- VIEWMATRIX = local * parent;
+ m_viewMatrix = local * parent;
//compute camera position in world space (broken if camera is in transform node)
local = MercuryMatrix::Identity();
Modified: Mercury2/src/Camera.h
===================================================================
--- Mercury2/src/Camera.h 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Camera.h 2009-07-25 20:25:16 UTC (rev 438)
@@ -11,11 +11,14 @@
virtual void ComputeMatrix();
virtual void HandleMessage(const MString& message, const MessageData* data);
virtual void Update(float dTime);
+ virtual void PreRender(const MercuryMatrix& matrix);
+ virtual void Render(const MercuryMatrix& matrix);
GENRTTI(CameraNode);
private:
MercuryVector m_lookAt;
float m_x, m_y;
+ MercuryMatrix m_viewMatrix;
};
#endif
Modified: Mercury2/src/MercuryVBO.cpp
===================================================================
--- Mercury2/src/MercuryVBO.cpp 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/MercuryVBO.cpp 2009-07-25 20:25:16 UTC (rev 438)
@@ -29,7 +29,6 @@
uint16_t stride = sizeof(float)*8;
if ( !m_initiated ) InitVBO();
-glDisable(GL_CULL_FACE);
if ( this != m_lastVBOrendered )
{
Modified: Mercury2/src/Orthographic.cpp
===================================================================
--- Mercury2/src/Orthographic.cpp 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Orthographic.cpp 2009-07-25 20:25:16 UTC (rev 438)
@@ -18,8 +18,22 @@
glMatrixMode(GL_MODELVIEW);
VIEWMATRIX = matrix;
+ MercuryNode::PreRender(matrix);
}
+void Orthographic::Render(const MercuryMatrix& matrix)
+{
+ FRUSTUM = &m_frustum;
+
+ //Load the frustum into the projection
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrix( m_frustum.GetMatrix() );
+ glMatrixMode(GL_MODELVIEW);
+
+ VIEWMATRIX = matrix;
+ MercuryNode::Render(matrix);
+}
+
void Orthographic::LoadFromXML(const XMLNode& node)
{
MercuryWindow* w = MercuryWindow::GetCurrentWindow();
Modified: Mercury2/src/Orthographic.h
===================================================================
--- Mercury2/src/Orthographic.h 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Orthographic.h 2009-07-25 20:25:16 UTC (rev 438)
@@ -12,6 +12,7 @@
public:
Orthographic();
virtual void PreRender(const MercuryMatrix& matrix);
+ virtual void Render(const MercuryMatrix& matrix);
virtual void LoadFromXML(const XMLNode& node);
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Viewport.cpp 2009-07-25 20:25:16 UTC (rev 438)
@@ -49,6 +49,42 @@
m_frustum.LookAt(EYE, LOOKAT, MercuryVertex(0,1,0));
}
+void Viewport::Render(const MercuryMatrix& matrix)
+{
+ FRUSTUM = &m_frustum;
+
+ MercuryWindow* w = MercuryWindow::GetCurrentWindow();
+ glViewport(m_minx, m_miny, (GLsizei)(w->Width()*m_xFactor), (GLsizei)(w->Height()*m_yFactor));
+
+ //Load the frustum into the projection
+ //"eye" position does not go into projection
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrix( m_frustum.GetMatrix() );
+
+ glMatrixMode(GL_MODELVIEW);
+
+ //compute the position of the eye
+// EYE = MercuryVertex(0,0,0,1); //wrong
+// EYE = matrix * EYE;
+
+// VIEWMATRIX = matrix;
+
+ //the camera sets this (the calculation here is wrong)
+// MercuryVector z(0,0,-1); //look down Z by default
+// LOOKAT = (matrix * z).Normalize();
+
+// matrix.Print();
+// EYE.Print("Eye");
+// LOOKAT.Print("Lookat");
+// printf("******\n");
+// LOOKAT = (matrix * l).Normalize();
+// LOOKAT.
+// LOOKAT.Print();
+
+ //Sets up the clipping frustum
+// m_frustum.LookAt(EYE, LOOKAT, MercuryVertex(0,1,0));
+}
+
void Viewport::LoadFromXML(const XMLNode& node)
{
m_xFactor = StrToFloat(node.Attribute("xfactor"), 1.0f);
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2009-07-25 20:09:25 UTC (rev 437)
+++ Mercury2/src/Viewport.h 2009-07-25 20:25:16 UTC (rev 438)
@@ -12,6 +12,7 @@
public:
Viewport();
virtual void PreRender(const MercuryMatrix& matrix);
+ virtual void Render(const MercuryMatrix& matrix);
virtual void LoadFromXML(const XMLNode& node);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 13:00:29
|
Revision: 460
http://hgengine.svn.sourceforge.net/hgengine/?rev=460&view=rev
Author: axlecrusher
Date: 2009-08-08 13:00:20 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
more improvements for lights
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/Themes/default/Graphic/differedStep1.frag
Mercury2/Themes/default/Graphic/differedStep1.vert
Mercury2/Themes/default/Graphic/differedStep2.frag
Mercury2/Themes/default/Graphic/differedStep2.vert
Mercury2/src/Camera.cpp
Mercury2/src/Frustum.cpp
Mercury2/src/Frustum.h
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Mercury2/src/RenderDifferedLights.cpp
Mercury2/src/Shader.h
Mercury2/src/Viewport.cpp
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,10 +1,10 @@
<SceneGraph name="root">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
<asset type="shader" file="GRAPHIC:differedStep1"/>
- <asset type="light" atten="10,0,0" fullscreen="true"/>
-<!-- <asset type="shader" file="GRAPHIC:test"/> -->
+<!-- <asset type="light" atten="10,0,0" fullscreen="true"/>
+ <asset type="shader" file="GRAPHIC:test"/> -->
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<asset type="texture" file="MODEL:map.png"/>
<asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
@@ -15,7 +15,7 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <asset type="light" atten="0.7,50,0.0" />
+ <node type="light" atten="0.7,100,0.0" shader="GRAPHIC:differedStep2" />
</node>
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
@@ -41,7 +41,6 @@
</node>
<asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="texture" file="screenFBO_1" dynamic="true"/>
- <asset type="shader" file="GRAPHIC:differedStep2"/>
<asset type="renderdifferedlights"/>
</node>
</node>
Modified: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,12 +1,27 @@
varying vec3 normal;
varying vec3 pos;
+varying float dist;
+uniform vec4 HG_DepthRange;
+uniform vec4 HG_EyePos;
+vec2 CartesianToSpherical(vec3 cartesian)
+{
+ vec2 spherical;
+
+ spherical.x = atan2(cartesian.y, cartesian.x) / 3.14159;
+ spherical.y = cartesian.z;
+
+ return spherical * 0.5 + 0.5;
+}
+
void main()
{
- //store position
- gl_FragData[0] = vec4(pos, 1.0);
+ //linear clip space depth
+ float d = -dist/HG_DepthRange.z;
//store normal, a unused
- gl_FragData[1] = vec4( normalize(normal), 1.0);
+ vec3 n = normalize(normal);
+ n.xy = CartesianToSpherical( n );
+ gl_FragData[0] = vec4( n.xy, d, 1.0);
}
Modified: Mercury2/Themes/default/Graphic/differedStep1.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,7 +1,9 @@
+uniform vec4 HG_EyePos;
uniform mat4 HG_ModelMatrix;
-
+uniform vec4 HG_DepthRange;
varying vec3 normal;
varying vec3 pos;
+varying float dist;
void main()
{
@@ -10,8 +12,10 @@
vec4 n = vec4(gl_Normal, 0);
- //normalize in fragment
- normal = (HG_ModelMatrix * n).xyz;
+ //viewspace normal
+ normal = (gl_ModelViewMatrix * n).xyz;
- pos = (HG_ModelMatrix * gl_Vertex).xyz;
+ //clip space depth
+ pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
+ dist = pos.z;
}
Modified: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,25 +1,47 @@
uniform sampler2D HG_Texture0;
-uniform sampler2D HG_Texture1;
-uniform sampler2D HG_Texture2;
uniform vec4 HG_EyePos;
uniform ivec4 HG_ViewPort;
uniform vec4 HG_LightPos;
uniform vec4 HG_LightAtten;
uniform vec4 HG_LightColor;
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+vec3 SphericalToCartesian(vec2 spherical)
+{
+ vec2 sinCosTheta, sinCosPhi;
+
+ spherical = spherical * 2.0 - 1.0;
+ sincos(spherical.x * 3.14159, sinCosTheta.x, sinCosTheta.y);
+ sinCosPhi = vec2(sqrt(1.0 - spherical.y * spherical.y), spherical.y);
+
+ return vec3(sinCosTheta.y * sinCosPhi.x, sinCosTheta.x * sinCosPhi.x, sinCosPhi.y);
+}
+
void main()
{
- vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw);
- vec3 pos = texture2D(HG_Texture0, coord).xyz;
- vec3 norm = texture2D(HG_Texture1, coord).rgb;
+ vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
+ vec4 t1 = texture2D(HG_Texture0, coord);
+// vec3 norm = texture2D(HG_Texture1, coord).rgb;
+ vec3 norm = SphericalToCartesian( t1.rg );
+ float depth = t1.b;
-// norm = normalize(norm);
+ vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
+ vec3 pos = ray * depth;
- vec3 eyeVec = normalize(HG_EyePos.xyz - pos);
- vec3 lightDir = HG_LightPos.xyz - pos;
+ vec3 eyeVec = normalize(ecEye - pos);
+ vec3 lightDir = ecLight - pos;
float dist = length(lightDir);
lightDir /= dist; //normalize
+// gl_FragColor = vec4(vec3(mod(depth,0.998)), 1.0);
+// gl_FragColor = vec4((norm+1.0)*0.5, 1.0);
+
float NdotL = max(dot(norm, lightDir),0.0);
if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
@@ -34,12 +56,12 @@
vec3 color = att * (HG_LightColor.rgb * NdotL);
- vec3 hv = normalize( lightDir+(HG_EyePos.xyz-pos) );
+ vec3 hv = normalize( lightDir+(ecEye-pos) );
float NdotHV = max(dot(norm,hv),0.0);
//pow(max(dot(H, normal.xyz), 0.0)
color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
- gl_FragColor.rgb = clamp(color, 0.0, 1.0);
+ color = clamp(color, 0.0, 1.0);
+ gl_FragColor = vec4(color, 1.0);
}
-
Modified: Mercury2/Themes/default/Graphic/differedStep2.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,9 +1,20 @@
-uniform mat4 HG_WorldMatrix;
-//vec3 lightPos;
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_EyePos;
+uniform vec4 HG_LightPos;
+//uniform vec4 HG_NearClip;
+uniform vec4 HG_FarClip;
+//uniform vec4 HG_ClipExtends;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
void main()
{
-// gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
-// lightPos = (HG_WorldMatrix * vec4(0,0,0,1)).xyz;
+ ecFrag = (gl_ModelViewMatrix * gl_Vertex).xyz; //world position
+
+ ecEye = (gl_ModelViewMatrix * HG_EyePos).xyz;
+ ecLight = (gl_ModelViewMatrix * vec4(0,0,0,1)).xyz;
}
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Camera.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -23,6 +23,12 @@
void CameraNode::Render(const MercuryMatrix& matrix)
{
VIEWMATRIX = m_viewMatrix;
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = m_viewMatrix.Ptr();
+ Shader::SetAttribute("HG_ViewMatrix", sa);
+
TransformNode::Render(matrix);
}
@@ -66,6 +72,7 @@
sa.value.fFloatV4[0] = EYE.GetX();
sa.value.fFloatV4[1] = EYE.GetY();
sa.value.fFloatV4[2] = EYE.GetZ();
+ sa.value.fFloatV4[3] = 1.0f;
Shader::SetAttribute("HG_EyePos", sa);
// EYE.Print();
Modified: Mercury2/src/Frustum.cpp
===================================================================
--- Mercury2/src/Frustum.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Frustum.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -89,6 +89,15 @@
aux.NormalizeSelf();
normal = Y.CrossProduct(aux);
m_planes[PRIGHT].Setup(m_nc+X*m_nw,normal);
+
+
+ //near frustum points
+ m_ntl = m_planes[PNEAR].GetCenter() + (Y * m_nh/2.0f) - (X * m_nw/2.0f);
+ m_nbr = m_planes[PNEAR].GetCenter() - (Y * m_nh/2.0f) + (X * m_nw/2.0f);
+
+ //far frustum points
+ m_ftl = m_planes[PFAR].GetCenter() + (Y * m_fh/2.0f) - (X * m_fw/2.0f);
+ m_fbr = m_planes[PFAR].GetCenter() - (Y * m_fh/2.0f) + (X * m_fw/2.0f);
}
void Frustum::Ortho(float left, float right, float bottom, float top, float near, float far)
Modified: Mercury2/src/Frustum.h
===================================================================
--- Mercury2/src/Frustum.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Frustum.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -28,6 +28,11 @@
inline float ZNear() const { return m_zNear; }
inline float ZFar() const { return m_zFar; }
inline float DepthRange() const { return m_zFar - m_zNear; }
+
+ inline float NearWidth() const { return m_nw; }
+ inline float NearHeight() const { return m_nh; }
+ inline float FarWidth() const { return m_fw; }
+ inline float FarHeight() const { return m_fh; }
private:
MercuryPlane m_planes[6];
@@ -37,6 +42,7 @@
float m_nh, m_nw, m_fh, m_fw;
MercuryVector m_nc, m_fc;
+ MercuryVertex m_ntl, m_nbr, m_ftl, m_fbr;
};
extern const Frustum* FRUSTUM;
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Light.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -7,10 +7,10 @@
#include <Shader.h>
-REGISTER_ASSET_TYPE(Light);
+REGISTER_NODE_TYPE(Light);
Light::Light()
- :MercuryAsset()
+ :MercuryNode(), m_boundingVolume( NULL )
{
m_atten[0] = m_atten[1] = m_atten[2] = 0.0f;
m_color[0] = m_color[1] = m_color[2] = 1.0f;
@@ -22,12 +22,13 @@
{
}
-void Light::Render(const MercuryNode* node)
+void Light::Render(const MercuryMatrix& matrix)
{
- m_worldPosition = glGetMatrix(GL_MODELVIEW_MATRIX);
- m_worldPosition2 = node->FindGlobalMatrix();
+// printf("render!\n");
+ m_worldPosition = FindModelViewMatrix();
+ m_worldPosition2 = FindGlobalMatrix();
CURRENTRENDERGRAPH->AddDifferedLight( this );
- m_parent = node;
+// m_parent = node;
}
void Light::LoadFromXML(const XMLNode& node)
@@ -38,9 +39,25 @@
if ( !node.Attribute("fullscreen").empty() )
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ if ( !node.Attribute("shader").empty() )
+ {
+ MString key = node.Attribute("shader");
+ MAutoPtr< MercuryAsset > asset( AssetFactory::GetInstance().Generate( "shader", key ) );
+ if ( asset.IsValid() )
+ {
+ Shader* shader = dynamic_cast<Shader*>( asset.Ptr() );
+// shader->LoadFromXML( node );
+ shader->LoadShader(key, 0);
+ SetShader( shader );
+// shader->Init( this );
+ }
+
+ m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ }
+
ComputeRadius();
- MercuryAsset::LoadFromXML( node );
+ MercuryNode::LoadFromXML( node );
}
void Light::StrTo3Float(const MString& s, float* a)
@@ -96,19 +113,24 @@
glLoadMatrix( m_worldPosition );
if ( !m_boundingVolume ) return;
+ m_shader->Render( this );
+
BoundingBox* bb = (BoundingBox*)m_boundingVolume;
// bb->Render();
MercuryVertex p(0,0,0,1);
p = m_worldPosition2 * p;
-// p.Print();
-
ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = m_worldPosition2.Ptr();
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
sa.type = ShaderAttribute::TYPE_FLOATV4;
sa.value.fFloatV4[0] = p.GetX();
sa.value.fFloatV4[1] = p.GetY();
sa.value.fFloatV4[2] = p.GetZ();
+ sa.value.fFloatV4[3] = 1.0f;
Shader::SetAttribute("HG_LightPos", sa);
sa.value.fFloatV4[0] = m_atten[0];
@@ -125,11 +147,14 @@
if (m_fullscreen)
{
glCullFace(GL_BACK);
- m_fullScreenQuad.Render( m_parent );
+ m_fullScreenQuad.Render( this );
glCullFace(GL_FRONT);
}
else
bb->RenderFaces();
+
+ m_shader->PostRender( this);
+
}
/****************************************************************************
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Light.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,10 +1,11 @@
-#include <MercuryAsset.h>
-#include <FullscreenQuad.h>
-
#ifndef MLIGHT_H
#define MLIGHT_H
-class Light : public MercuryAsset
+#include <MercuryNode.h>
+#include <FullscreenQuad.h>
+#include <Shader.h>
+
+class Light : public MercuryNode
{
public:
Light();
@@ -17,7 +18,7 @@
Currently only occlusion culling test is run here.**/
// virtual void PreRender(const MercuryNode* node);
- virtual void Render(const MercuryNode* node);
+ virtual void Render(const MercuryMatrix& matrix);
// virtual void PostRender(const MercuryNode* node) {};
///Loads an asset from an XMLAsset representing itself
@@ -26,6 +27,7 @@
static Light* Generate();
void DifferedRender();
+ inline void SetShader( Shader* shader) { m_shader = shader; }
private:
void StrTo3Float(const MString& s, float* a);
void ComputeRadius();
@@ -37,9 +39,13 @@
MercuryMatrix m_worldPosition2;
bool m_fullscreen;
- const MercuryNode* m_parent;
+// const MercuryNode* m_parent;
FullscreenQuad m_fullScreenQuad;
+
+ MAutoPtr< Shader > m_shader;
+
+ BoundingVolume* m_boundingVolume;
};
#endif
Modified: Mercury2/src/RenderDifferedLights.cpp
===================================================================
--- Mercury2/src/RenderDifferedLights.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/RenderDifferedLights.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -29,9 +29,8 @@
}
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POLYGON_BIT);
-// glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
-
+
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glBlendFunc(GL_ONE, GL_ONE);
@@ -39,7 +38,6 @@
CURRENTRENDERGRAPH->DoDifferedLightPass();
glPopAttrib( );
-// glCullFace(GL_BACK);
}
RenderDifferedLights* RenderDifferedLights::Generate()
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Shader.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -89,8 +89,8 @@
///Explicitly get the OpenGL ProgramID in the event you need it for advanced techniques
unsigned int GetProgramID() { return iProgramID; }
inline static Shader* GetCurrentShader() { return CurrentShader; }
+ void LoadShader( const MString& path, float priority );
private:
- void LoadShader( const MString& path, float priority );
int32_t GetUniformLocation(const MString& n);
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Viewport.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -60,6 +60,28 @@
sa.value.fFloatV4[2] = m_frustum.DepthRange();
sa.value.fFloatV4[3] = 1.0f/m_frustum.DepthRange();
Shader::SetAttribute("HG_DepthRange", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = m_frustum.ZNear();
+ sa.value.fFloatV4[1] = m_frustum.ZFar();
+ sa.value.fFloatV4[2] = m_frustum.DepthRange();
+ sa.value.fFloatV4[3] = 1.0f/m_frustum.DepthRange();
+ Shader::SetAttribute("HG_DepthRange", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ m_frustum.GetPlane(PNEAR).GetCenter().ConvertToVector3( sa.value.fFloatV4 );
+ Shader::SetAttribute("HG_NearClip", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ m_frustum.GetPlane(PFAR).GetCenter().ConvertToVector3( sa.value.fFloatV4 );
+ Shader::SetAttribute("HG_FarClip", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = m_frustum.NearWidth()*0.5f;
+ sa.value.fFloatV4[1] = m_frustum.NearHeight()*0.5f;
+ sa.value.fFloatV4[2] = m_frustum.FarWidth()*0.5f;
+ sa.value.fFloatV4[3] = m_frustum.FarHeight()*0.5f;
+ Shader::SetAttribute("HG_ClipExtends", sa);
}
void Viewport::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-10 00:49:43
|
Revision: 469
http://hgengine.svn.sourceforge.net/hgengine/?rev=469&view=rev
Author: axlecrusher
Date: 2009-08-10 00:49:35 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
assets can't be culled because they are instanced
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/src/HGMDLModel.cpp
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:49:35 UTC (rev 469)
@@ -17,8 +17,8 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <node type="light" atten="0.7,0,30" power="4.0" shader="GRAPHIC:pointLight" />
</node>
+ <node type="light" atten="0.7,0,30" power="4.0" shader="GRAPHIC:pointLight" />
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
<asset type="texture" file="GRAPHIC:flame.png"/>
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -69,7 +69,6 @@
for(uint16_t i = 0; i < m_meshes.size(); ++i)
culled = culled && m_meshes[i]->DoCullingTests(n, matrix);
}
- m_culled = culled;
return culled;
}
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -6,7 +6,7 @@
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset()
- :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_culled(false)
+ :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE)
{
}
@@ -48,7 +48,6 @@
if ( !culled && DOOCCLUSIONCULL)
m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
}
- m_culled = culled;
return culled;
}
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryAsset.h 2009-08-10 00:49:35 UTC (rev 469)
@@ -57,8 +57,6 @@
inline void SetExcludeFromCull(bool t) { m_excludeFromCull = t; }
inline bool ExcludeFromCull() const { return m_excludeFromCull; }
-
- inline bool IsCulled() const { return m_culled; }
protected:
void SetLoadState(LoadState ls); //thread safe
LoadState GetLoadState(); //thread safe
@@ -66,7 +64,6 @@
bool m_isInstanced;
BoundingVolume* m_boundingVolume;
MString m_path;
- bool m_culled;
private:
LoadState m_loadState;
MSemaphore m_lock;
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryNode.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -250,10 +250,7 @@
{
list< MercuryAsset* >::iterator i;
for (i = m_render.begin(); i != m_render.end(); ++i )
- {
- if ( !(*i)->IsCulled() )
- (*i)->Render(this);
- }
+ (*i)->Render(this);
}
void MercuryNode::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|