You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(46) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(185) |
Feb
(242) |
Mar
(237) |
Apr
(180) |
May
(102) |
Jun
(278) |
Jul
(114) |
Aug
(92) |
Sep
(246) |
Oct
(212) |
Nov
(279) |
Dec
(99) |
| 2007 |
Jan
(130) |
Feb
(194) |
Mar
(22) |
Apr
(72) |
May
(40) |
Jun
(111) |
Jul
(114) |
Aug
(154) |
Sep
(114) |
Oct
(2) |
Nov
(1) |
Dec
(5) |
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(51) |
Nov
(34) |
Dec
(130) |
| 2009 |
Jan
(22) |
Feb
(20) |
Mar
(41) |
Apr
(45) |
May
(82) |
Jun
(96) |
Jul
(48) |
Aug
(90) |
Sep
(13) |
Oct
(49) |
Nov
(31) |
Dec
(21) |
| 2010 |
Jan
(25) |
Feb
(9) |
Mar
(7) |
Apr
(28) |
May
(27) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(13) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <axl...@us...> - 2009-04-12 22:24:47
|
Revision: 210
http://hgengine.svn.sourceforge.net/hgengine/?rev=210&view=rev
Author: axlecrusher
Date: 2009-04-12 22:24:37 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Start making out own list (not working)
Added Paths:
-----------
Mercury2/src/MercuryList.h
Added: Mercury2/src/MercuryList.h
===================================================================
--- Mercury2/src/MercuryList.h (rev 0)
+++ Mercury2/src/MercuryList.h 2009-04-12 22:24:37 UTC (rev 210)
@@ -0,0 +1,138 @@
+#ifndef MERCURYLIST_H
+#define MERCURYLIST_H
+
+template<typename T>
+class MercuryList
+{
+ public:
+ class Entry
+ {
+ friend class MercuryList;
+ public:
+ Entry()
+ :m_previous(NULL), m_next(NULL)
+ {
+ }
+
+ Entry(T& data, Entry* previous = NULL, Entry* next = NULL)
+ :m_previous(previous), m_next(next), m_data(data)
+ {
+ }
+
+ Entry* Previous() const { return m_previous; }
+ Entry* Next() const { return m_next; }
+ T& Data() { return m_data; }
+
+ //dereference operator
+ const T& operator->*(Entry& p) const { return p.m_data; }
+ T& operator->*(Entry& p) { return p.m_data; }
+
+ Entry& operator=(const Entry& rhs)
+ {
+ this->m_previous = rhs.m_previous;
+ this->m_next = rhs.m_next;
+ this->m_data = rhs.m_data;
+ return *this;
+ }
+
+ bool operator==(const Entry& rhs) const
+ {
+ return (rhs.m_previous == m_previous) && (rhs.m_next == m_next) && (rhs.m_data == m_data);
+ }
+
+
+ bool operator!=(const Entry& rhs) const
+ {
+ return !(rhs==*this);
+ }
+
+ private:
+ Entry* m_previous;
+ Entry* m_next;
+ T m_data;
+ };
+
+ MercuryList()
+ :m_head(NULL), m_tail(NULL), m_entries(NULL)
+ {
+ }
+
+ void push_back(T& data)
+ {
+ Entry* e = new Entry(data, m_tail, NULL);
+
+ if ( m_tail ) m_tail->m_next = e; //set previous's next
+ m_tail = e;
+
+ if ( !m_head ) m_head = e;
+ if ( !m_entries ) m_entries = e;
+ }
+
+ Entry* Head() const { return m_head; }
+ Entry* Tail() const { return m_tail; }
+
+ void clear()
+ {
+ if (!m_entries) return;
+ for (Entry* i = m_tail; i != NULL; i = i->Previous() )
+ {
+ delete i;
+ i = NULL;
+ }
+ m_entries = m_head = m_tail = NULL;
+ }
+
+ bool isEmpty() const
+ {
+ return !(m_head || m_tail);
+ }
+
+ void erase(Entry* n)
+ {
+ if (m_head == n) m_head = n->Next();
+ if (m_tail == n) m_tail = n->Previous();
+ if (m_entries == n) m_entries = n->Next();
+ if (n->Previous()) n->Previous()->m_next = n->Next();
+ if (n->Next()) n->Next()->m_previous = n->Previous();
+ delete n;
+ }
+
+ private:
+ Entry* m_head;
+ Entry* m_tail; //always last entry
+ Entry* m_entries; //just a single entry
+};
+
+#endif
+
+/****************************************************************************
+ * 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-04-12 18:09:50
|
Revision: 209
http://hgengine.svn.sourceforge.net/hgengine/?rev=209&view=rev
Author: axlecrusher
Date: 2009-04-12 18:09:46 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
more updates to improve speed of basic math functions
Modified Paths:
--------------
Mercury2/src/MercuryMath.cpp
Mercury2/src/MercuryMath.h
Mercury2/src/MercuryMatrix.cpp
Mercury2/src/MercuryMatrix.h
Mercury2/src/RenderGraph.h
Mercury2/src/RenderableNode.cpp
Mercury2/src/TransformNode.cpp
Modified: Mercury2/src/MercuryMath.cpp
===================================================================
--- Mercury2/src/MercuryMath.cpp 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/MercuryMath.cpp 2009-04-12 18:09:46 UTC (rev 209)
@@ -65,20 +65,17 @@
void Copy4f( void * dest, const void * source )
{
- for (uint8_t i = 0; i < 4; ++i)
- ((float*)dest)[i] = ((float*)source)[i];
+ COPY<float,4>((float*)source, (float*)dest);
}
void Copy8f( void * dest, const void * source )
{
- for (uint8_t i = 0; i < 8; ++i)
- ((float*)dest)[i] = ((float*)source)[i];
+ COPY<float,8>((float*)source, (float*)dest);
}
void Copy16f( void * dest, const void * source )
{
- for (uint8_t i = 0; i < 16; ++i)
- ((float*)dest)[i] = ((float*)source)[i];
+ COPY<float,16>((float*)source, (float*)dest);
}
void MatrixMultiply4f ( const FloatRow* in1a, const FloatRow* in2a, FloatRow* outa)
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/MercuryMath.h 2009-04-12 18:09:46 UTC (rev 209)
@@ -16,6 +16,18 @@
#define RADDEG 57.2957795130823208767f //radian to degree
#define Q_PI 3.14159265358979323846f
+template<typename t, unsigned i>
+inline void COPY(const t* s, t*d)
+{
+ d[i-1] = s[i-1];
+ COPY<t,i-1>(s,d);
+}
+
+template<> inline void COPY<float,0>(const float* s, float* d)
+{
+ d[0] = s[0];
+}
+
#if defined(WIN32)
//In win32, sin works faster than sinf and similar functions
#define SIN( x ) float( sin ( x ) )
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/MercuryMatrix.cpp 2009-04-12 18:09:46 UTC (rev 209)
@@ -3,7 +3,7 @@
MercuryMatrix::MercuryMatrix()
{
- Identity();
+ *this = Identity();
}
const MercuryMatrix& MercuryMatrix::operator=(const MercuryMatrix& m)
@@ -26,14 +26,19 @@
ZeroFloatRow( m_matrix[3] );
}
-void MercuryMatrix::Identity()
+const MercuryMatrix& MercuryMatrix::Identity()
{
- const static float Identity[16] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
- Copy16f(&m_matrix[0], Identity );
+ if (IdentityMatrix.m_matrix[0][0] != 1.0f)
+ {
+ float identity[16] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f };
+ Copy16f(MercuryMatrix::IdentityMatrix.m_matrix[0], identity );
+ }
+
+ return IdentityMatrix;
}
void MercuryMatrix::Translate(float x, float y, float z)
Modified: Mercury2/src/MercuryMatrix.h
===================================================================
--- Mercury2/src/MercuryMatrix.h 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/MercuryMatrix.h 2009-04-12 18:09:46 UTC (rev 209)
@@ -15,6 +15,8 @@
///[row][column] (The internal matrix)
// float m_matrix[4][4];
FloatRow m_matrix[4];
+
+ static MercuryMatrix IdentityMatrix;
public:
MercuryMatrix();
inline MercuryMatrix(const MercuryMatrix& m) { *this = m; }
@@ -41,10 +43,9 @@
inline void Transpose() { TransposeMatrix( m_matrix ); }
void Zero();
- void Identity();
+ static const MercuryMatrix& Identity();
void Print() const;
- static MercuryMatrix IdentityMatrix;
}
#if !defined( WIN32 ) || defined( _MSC_VER )
M_ALIGN(64);
Modified: Mercury2/src/RenderGraph.h
===================================================================
--- Mercury2/src/RenderGraph.h 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/RenderGraph.h 2009-04-12 18:09:46 UTC (rev 209)
@@ -8,8 +8,14 @@
{
friend class RenderGraph;
public:
- RenderGraphEntry(const MercuryMatrix* matrix = &MercuryMatrix::IdentityMatrix, RenderableNode* node = NULL)
- :m_node(node), m_matrix(matrix)
+ RenderGraphEntry()
+ {
+ m_node = NULL;
+ m_matrix = &MercuryMatrix::Identity();
+ }
+
+ RenderGraphEntry(const MercuryMatrix* matrix, RenderableNode* node)
+ :m_node(node), m_matrix(matrix)
{}
void AddChild(RenderGraphEntry entry);
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/RenderableNode.cpp 2009-04-12 18:09:46 UTC (rev 209)
@@ -70,7 +70,7 @@
if ( (tn = TransformNode::Cast(n)) )
return tn->GetGlobalMatrix();
- return MercuryMatrix::IdentityMatrix;
+ return MercuryMatrix::Identity();
}
void RenderableNode::AddPreRender(MercuryAsset* asset)
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-04-12 16:32:55 UTC (rev 208)
+++ Mercury2/src/TransformNode.cpp 2009-04-12 18:09:46 UTC (rev 209)
@@ -71,7 +71,7 @@
n = n->Parent();
}
- return MercuryMatrix::IdentityMatrix;
+ return MercuryMatrix::Identity();
}
void TransformNode::RippleTaintDown()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-12 16:32:57
|
Revision: 208
http://hgengine.svn.sourceforge.net/hgengine/?rev=208&view=rev
Author: axlecrusher
Date: 2009-04-12 16:32:55 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Move frustum into own file
Added Paths:
-----------
Mercury2/src/Frustum.cpp
Mercury2/src/Frustum.h
Added: Mercury2/src/Frustum.cpp
===================================================================
--- Mercury2/src/Frustum.cpp (rev 0)
+++ Mercury2/src/Frustum.cpp 2009-04-12 16:32:55 UTC (rev 208)
@@ -0,0 +1,135 @@
+#include <Frustum.h>
+
+void Frustum::SetPerspective( float fov, float aspect, float znear, float zfar )
+{
+ float xmin, xmax, ymin, ymax;
+
+ m_fov = fov;
+ m_aspect = aspect;
+ m_zNear = znear;
+ m_zFar = zfar;
+
+ float tang = TAN(m_fov * Q_PI / 360.0);
+
+ m_nh = ymax = m_zNear * tang; //nh
+ ymin = -ymax;
+ xmin = ymin * m_aspect;
+ m_nw = xmax = ymax * m_aspect; //nw
+
+ m_fh = m_zFar*tang;
+ m_fw = m_fh*aspect;
+
+ ComputeFrustum(xmin, xmax, ymin, ymax, m_zNear, m_zFar);
+}
+
+void Frustum::ComputeFrustum(float left, float right, float bottom, float top, float zNear, float zFar)
+{
+ float near2 = 2*zNear;
+ float rml = right-left;
+ float tmb = top - bottom;
+ float fmn = zFar - zNear;
+
+ float A = (right+left)/rml;
+ float B = (top+bottom)/tmb;
+ float C = -(zFar+zNear)/fmn;
+ float D = -(near2*zFar)/fmn;
+
+ m_frustum.Zero();
+
+ //row major
+ m_frustum[0][0] = near2/rml;
+ m_frustum[0][2] = A;
+ m_frustum[1][1] = near2/tmb;
+ m_frustum[1][2] = B;
+ m_frustum[2][2] = C;
+ m_frustum[2][3] = D;
+ m_frustum[3][2] = -1;
+
+// m_frustum.Transpose(); //XXX fix it to remove this
+}
+
+void Frustum::LookAt(const MercuryVertex& eye, const MercuryVector& look, const MercuryVector& up)
+{
+ //Right now this only builds the frustum planes
+ MercuryVector X,Y,Z;
+
+ Z = (eye - look).Normalize(); //direction behind camera
+ X = (up.CrossProduct(Z)).Normalize(); //X axis
+ Y = Z.CrossProduct( X ); //real up
+
+ m_nc = (eye - Z) * m_zNear;
+ m_fc = (eye - Z) * m_zFar;
+
+ m_planes[PNEAR].Setup(m_nc, Z*(-1));
+ m_planes[PFAR].Setup(m_fc, Z);
+// m_fc.Print();
+// Z.Print();
+ MercuryVector aux,normal;
+
+ aux = (m_nc + Y*m_nh) - eye;
+ aux.NormalizeSelf();
+ normal = aux * X;
+ m_planes[PTOP].Setup(m_nc+Y*m_nh,normal);
+
+ aux = (m_nc - Y*m_nh) - eye;
+ aux.NormalizeSelf();
+ normal = X * aux;
+ m_planes[PBOTTOM].Setup(m_nc-Y*m_nh,normal);
+
+ aux = (m_nc - X*m_nw) - eye;
+ aux.NormalizeSelf();
+ normal = aux * Y;
+ m_planes[PLEFT].Setup(m_nc-X*m_nw,normal);
+
+ aux = (m_nc + X*m_nw) - eye;
+ aux.NormalizeSelf();
+ normal = Y * aux;
+ m_planes[PRIGHT].Setup(m_nc+X*m_nw,normal);
+}
+
+/*
+void Frustum::LookAt()
+{
+
+}
+*/
+/*
+bool Frustum::IsPointInFrustum( float x, float y, float z )
+{
+ for( uint16_t i = 0; i < 6; ++i )
+ if( frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3] <= 0 )
+ return false;
+ return true;
+}*/
+
+/****************************************************************************
+ * 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/Frustum.h
===================================================================
--- Mercury2/src/Frustum.h (rev 0)
+++ Mercury2/src/Frustum.h 2009-04-12 16:32:55 UTC (rev 208)
@@ -0,0 +1,70 @@
+#ifndef FRUSTUM_H
+#define FRUSTUM_H
+
+#include <MercuryMatrix.h>
+#include <MercuryPlane.h>
+
+enum PlanePos
+{
+ PTOP = 0,
+ PBOTTOM,
+ PLEFT,
+ PRIGHT,
+ PNEAR,
+ PFAR
+};
+
+class Frustum
+{
+
+ public:
+ void SetPerspective( float fov, float aspect, float znear, float zfar );
+ const MercuryMatrix& GetMatrix() const { return m_frustum; }
+ void ComputeFrustum(float left, float right, float bottom, float top, float zNear, float zFar);
+ void LookAt(const MercuryVertex& eye, const MercuryVector& look, const MercuryVector& up);
+
+ inline const MercuryPlane& GetPlane(int i) const { return m_planes[i]; }
+ private:
+
+ MercuryPlane m_planes[6];
+ MercuryMatrix m_frustum;
+
+ float m_aspect, m_fov, m_zNear, m_zFar;
+ float m_nh, m_nw, m_fh, m_fw;
+
+ MercuryVector m_nc, m_fc;
+};
+
+#endif
+
+/****************************************************************************
+ * 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-04-12 16:31:21
|
Revision: 207
http://hgengine.svn.sourceforge.net/hgengine/?rev=207&view=rev
Author: axlecrusher
Date: 2009-04-12 16:31:19 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
new test models
Modified Paths:
--------------
Mercury2/mercury2.kdevelop
Added Paths:
-----------
Mercury2/lamp.hgmdl
Mercury2/lamp.png
Mercury2/map.hgmdl
Mercury2/map.png
Added: Mercury2/lamp.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/lamp.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/lamp.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/lamp.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/map.hgmdl
===================================================================
(Binary files differ)
Property changes on: Mercury2/map.hgmdl
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: Mercury2/map.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/map.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: Mercury2/mercury2.kdevelop
===================================================================
--- Mercury2/mercury2.kdevelop 2009-04-12 16:29:42 UTC (rev 206)
+++ Mercury2/mercury2.kdevelop 2009-04-12 16:31:19 UTC (rev 207)
@@ -2,7 +2,7 @@
<kdevelop>
<general>
<author>Joshua Allen</author>
- <email/>
+ <email></email>
<version>2.0</version>
<projectmanagement>KDevAutoProject</projectmanagement>
<primarylanguage>C++</primarylanguage>
@@ -14,8 +14,8 @@
<projectname>Mercury2</projectname>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
- <description/>
- <defaultencoding/>
+ <description></description>
+ <defaultencoding></defaultencoding>
<versioncontrol/>
</general>
<kdevautoproject>
@@ -61,14 +61,14 @@
<f77compiler>kdevg77options</f77compiler>
<cxxflags>-O0 -g -Wall</cxxflags>
<envvars/>
- <topsourcedir/>
- <cppflags>-Isrc/ -I/usr/include/libxml2/ -DHGENGINE -DRUN_FROM_START_FOLDER</cppflags>
- <ldflags>-lpthread -lX11 -lGL -lxml2 -lpng</ldflags>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
+ <topsourcedir></topsourcedir>
+ <cppflags>-Isrc/ -I/usr/include/libxml2/ -DHGENGINE -DRUN_FROM_START_FOLDER -pg</cppflags>
+ <ldflags>-lpthread -lX11 -lGL -lxml2 -lpng -pg</ldflags>
+ <ccompilerbinary></ccompilerbinary>
+ <cxxcompilerbinary></cxxcompilerbinary>
+ <f77compilerbinary></f77compilerbinary>
<cflags>-O0 -g -Wall</cflags>
- <f77flags/>
+ <f77flags></f77flags>
</debug>
<default>
<envvars/>
@@ -222,7 +222,7 @@
<includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
- <prefixGet/>
+ <prefixGet></prefixGet>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
@@ -243,11 +243,11 @@
</cppsupportpart>
<kdevdebugger>
<general>
- <gdbpath/>
+ <gdbpath></gdbpath>
<dbgshell>libtool</dbgshell>
- <configGdbScript/>
- <runShellScript/>
- <runGdbScript/>
+ <configGdbScript></configGdbScript>
+ <runShellScript></runShellScript>
+ <runGdbScript></runGdbScript>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-12 16:29:44
|
Revision: 206
http://hgengine.svn.sourceforge.net/hgengine/?rev=206&view=rev
Author: axlecrusher
Date: 2009-04-12 16:29:42 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
reduce the number of texture binds
Modified Paths:
--------------
Mercury2/scenegraph.xml
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-04-12 16:28:55 UTC (rev 205)
+++ Mercury2/scenegraph.xml 2009-04-12 16:29:42 UTC (rev 206)
@@ -2,29 +2,32 @@
<node type="transformnode" movz="0" roty="0">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/>
</node>
- <node type="transformnode" movz="-3" name="fallbackTest">
+ <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<node type="renderablenode">
- <asset type="texture" file="test.bmp"/>
- <asset type="quad"/>
+ <asset type="texture" file="map.png"/>
+ <asset type="hgmdlmodel" file="map.hgmdl" />
</node>
</node>
- <node type="transformnode" movz="-3" movx="-1" movy="-1">
- <node type="renderablenode">
- <asset type="quad"/>
- </node>
- </node>
- <node type="transformnode" movz="-3" movx="1" movy="-1" >
- <node type="renderablenode">
- <asset type="texture" file="test2.png"/>
- <asset type="texture" file="test.bmp"/>
- <asset type="quad"/>
- </node>
- </node>
- <node type="transformnode" movx="1" movy="1" fallback="fallbackTest">
- <node type="transformnode" movx="-2">
- <node type="renderablenode">
- <asset type="quad"/>
+ <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="renderablenode" >
+ <asset type="hgmdlmodel" file="lamp.hgmdl" />
+ </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" 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-04-12 16:29:02
|
Revision: 205
http://hgengine.svn.sourceforge.net/hgengine/?rev=205&view=rev
Author: axlecrusher
Date: 2009-04-12 16:28:55 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
updates
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Mercury2/src/MercuryMatrix.cpp
Mercury2/src/MercuryVBO.cpp
Mercury2/src/MercuryVBO.h
Mercury2/src/Texture.cpp
Mercury2/src/Texture.h
Mercury2/src/TransformNode.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/Mercury2.cpp 2009-04-12 16:28:55 UTC (rev 205)
@@ -14,7 +14,10 @@
#include <MercuryTimer.h>
#include <RenderGraph.h>
+#include <Texture.h>
+bool SHOWBOUNDINGVOLUME = false;
+
MSemaphore UpdateLoopGo;
void* UpdateThread(void* node)
{
@@ -80,7 +83,8 @@
if (fpsTimer.Age() > 1)
{
float batches = MercuryVBO::ResetBatchCount()/(float)m_count;
- printf("FPS: %f, VBO batches %f\n", m_count/fpsTimer.Age(), batches);
+ float binds = Texture::ReadAndResetBindCount()/(float)m_count;
+ printf("FPS: %f, VBO batches %f, TBinds %f\n", m_count/fpsTimer.Age(), batches, binds);
m_count = 0;
fpsTimer = timer;
}
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/MercuryMatrix.cpp 2009-04-12 16:28:55 UTC (rev 205)
@@ -1,11 +1,6 @@
#include "MercuryMatrix.h"
#include <stdio.h>
-namespace MercuryMath
-{
- static MercuryMatrix IdentityMatrix;
-}
-
MercuryMatrix::MercuryMatrix()
{
Identity();
Modified: Mercury2/src/MercuryVBO.cpp
===================================================================
--- Mercury2/src/MercuryVBO.cpp 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/MercuryVBO.cpp 2009-04-12 16:28:55 UTC (rev 205)
@@ -9,6 +9,8 @@
#define BUFFER_OFFSET(i) ((char*)NULL + (i))
+extern bool SHOWBOUNDINGVOLUME;
+
MercuryVBO::MercuryVBO()
:MercuryAsset(), m_initiated(false)
{
@@ -49,11 +51,11 @@
}
glDrawRangeElements(GL_TRIANGLES, 0, m_indexData.Length()-1, m_indexData.Length(), GL_UNSIGNED_SHORT, NULL);
- m_vboBatches.Increment();
+ m_vboBatches++;
m_lastVBOrendered = this;
- if (m_boundingVolume) m_boundingVolume->Render();
+ if (m_boundingVolume && SHOWBOUNDINGVOLUME) m_boundingVolume->Render();
}
void MercuryVBO::InitVBO()
@@ -84,7 +86,7 @@
}
void* MercuryVBO::m_lastVBOrendered = NULL;
-MSemaphore MercuryVBO::m_vboBatches;
+uint32_t MercuryVBO::m_vboBatches;
/****************************************************************************
* Copyright (C) 2008 by Joshua Allen *
Modified: Mercury2/src/MercuryVBO.h
===================================================================
--- Mercury2/src/MercuryVBO.h 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/MercuryVBO.h 2009-04-12 16:28:55 UTC (rev 205)
@@ -18,8 +18,8 @@
void AllocateVertexSpace(unsigned int count);
void AllocateIndexSpace(unsigned int count);
- static uint32_t BatchCount() { return m_vboBatches.Read(); }
- static uint32_t ResetBatchCount() { return m_vboBatches.ReadAndClear(); }
+ static uint32_t BatchCount() { return m_vboBatches; }
+ static uint32_t ResetBatchCount() { uint32_t t = m_vboBatches; m_vboBatches = 0; return t; }
private:
virtual void InitVBO();
@@ -32,7 +32,7 @@
AlignedBuffer<float> m_vertexData;
AlignedBuffer<uint16_t> m_indexData;
- static MSemaphore m_vboBatches;
+ static uint32_t m_vboBatches;
};
#endif
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/Texture.cpp 2009-04-12 16:28:55 UTC (rev 205)
@@ -99,14 +99,15 @@
void Texture::BindTexture()
{
- m_textureResource = GL_TEXTURE0+m_activeTextures;
- glActiveTexture( m_textureResource );
- glClientActiveTextureARB(m_textureResource);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable( GL_TEXTURE_2D );
- glBindTexture(GL_TEXTURE_2D, m_textureID);
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
- ++m_activeTextures;
+ m_textureResource = GL_TEXTURE0+m_activeTextures;
+ glActiveTexture( m_textureResource );
+ glClientActiveTextureARB(m_textureResource);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnable( GL_TEXTURE_2D );
+ glBindTexture(GL_TEXTURE_2D, m_textureID);
+ glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
+ ++m_activeTextures;
+ ++m_textureBinds;
}
void Texture::UnbindTexture()
@@ -145,8 +146,8 @@
bool Texture::m_initTextureSuccess = false;
unsigned short Texture::m_activeTextures = 0;
+uint32_t Texture::m_textureBinds = 0;
-
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/Texture.h
===================================================================
--- Mercury2/src/Texture.h 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/Texture.h 2009-04-12 16:28:55 UTC (rev 205)
@@ -20,6 +20,7 @@
void LoadFromRaw(const RawImageData* raw);
inline static unsigned short NumberActiveTextures() { return m_activeTextures; }
+ inline static uint32_t ReadAndResetBindCount() { uint32_t t = m_textureBinds; m_textureBinds = 0; return t; }
static Texture* Generate();
static MAutoPtr< Texture > LoadFromFile(const MString& path);
@@ -35,6 +36,7 @@
static bool m_initTextureSuccess;
static unsigned short m_activeTextures;
+ static uint32_t m_textureBinds;
MString m_filename;
};
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-04-12 14:18:33 UTC (rev 204)
+++ Mercury2/src/TransformNode.cpp 2009-04-12 16:28:55 UTC (rev 205)
@@ -52,7 +52,7 @@
m_tainted = false;
MercuryMatrix local;
- local.Identity();
+// local.Identity();
local.Transotale( m_position.x, m_position.y, m_position.z,
m_rotation.x, m_rotation.y, m_rotation.z,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-12 14:18:35
|
Revision: 204
http://hgengine.svn.sourceforge.net/hgengine/?rev=204&view=rev
Author: axlecrusher
Date: 2009-04-12 14:18:33 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Move around the bounding box test logic. This avoids having to use Cast
to figure out which cull test to run
Modified Paths:
--------------
Mercury2/src/BoundingBox.cpp
Mercury2/src/BoundingBox.h
Mercury2/src/Mercury2.cpp
Mercury2/src/MercuryPlane.cpp
Mercury2/src/MercuryPlane.h
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderableNode.cpp
Mercury2/src/RenderableNode.h
Mercury2/src/Viewport.cpp
Mercury2/src/Viewport.h
Modified: Mercury2/src/BoundingBox.cpp
===================================================================
--- Mercury2/src/BoundingBox.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/BoundingBox.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -4,6 +4,11 @@
#include <string.h>
#include <Viewport.h>
+#define SIGNED_DIST(x) m_normal.DotProduct(x)
+
+// origional algorithim was -x<0
+#define BEHIND_PLANE(x) x>=0
+
BoundingBox::BoundingBox(const MercuryVertex& center, const MercuryVertex& extend)
:m_center(center), m_extend(extend)
{
@@ -55,6 +60,32 @@
*this = bb;
}
+bool BoundingBox::Clip( const MercuryPlane& p )
+{
+ MercuryVertex dp = p.GetNormal().DotProduct3(m_normals[0], m_normals[1], m_normals[2]);
+ float x = ABS( m_extend.GetX() * dp[0] );
+ x += ABS( m_extend.GetY() * dp[1] );
+ x += ABS( m_extend.GetZ() * dp[2] );
+
+ float d = p.GetNormal().DotProduct( m_center+p.GetCenter() ); //signed distance
+ if ( ABS(d) <= x ) //intersection
+ return false;
+
+ return BEHIND_PLANE(d); //if we don't intersect, just see what side we are on
+}
+
+bool BoundingBox::Clip( const Frustum& f )
+{
+ bool inView = true;
+ for (uint8_t i = 0; (i < 6) && inView; ++i)
+ {
+ inView = Clip( f.GetPlane(i) )?false:inView;
+ }
+
+ return !inView;
+}
+
+
void BoundingBox::Render()
{
// BoundingBox gbb = *this;
Modified: Mercury2/src/BoundingBox.h
===================================================================
--- Mercury2/src/BoundingBox.h 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/BoundingBox.h 2009-04-12 14:18:33 UTC (rev 204)
@@ -4,7 +4,9 @@
#include <MercuryNode.h>
#include <MercuryVertex.h>
#include <MercuryMatrix.h>
+#include <Frustum.h>
#include <stdint.h>
+#include <MercuryPlane.h>
class BoundingVolume
{
@@ -15,6 +17,9 @@
virtual void Transform( const MercuryMatrix& m ) = 0;
virtual void Render() {};
virtual BoundingVolume* SpawnClone() const = 0;
+
+ virtual bool Clip( const MercuryPlane& p ) = 0;
+ virtual bool Clip( const Frustum& f ) = 0;
};
class BoundingBox : public BoundingVolume
@@ -37,6 +42,9 @@
virtual void Render();
virtual BoundingVolume* SpawnClone() const;
+ virtual bool Clip( const MercuryPlane& p );
+ virtual bool Clip( const Frustum& f );
+
private:
void ComputeNormals();
@@ -45,17 +53,7 @@
MercuryVector m_normals[3];
};
-/*
-class RenderableBoundingBox : public MercuryAsset
-{
- public:
- RenderableBoundingBox(const BoundingBox* bb);
- virtual void Render(MercuryNode* node);
- private:
- const BoundingBox* m_bb;
-};
-*/
#endif
/****************************************************************************
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/Mercury2.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -70,6 +70,7 @@
renderGraph.Build(root);
}
+
renderGraph.Render();
// RenderableNode::RecursiveRender(root);
w->SwapBuffers();
Modified: Mercury2/src/MercuryPlane.cpp
===================================================================
--- Mercury2/src/MercuryPlane.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/MercuryPlane.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -12,27 +12,6 @@
return BEHIND_PLANE( SIGNED_DIST( point+m_center ) );
}
-bool MercuryPlane::IsBehindPlane(const BoundingBox& bb) const
-{
- const MercuryVertex& center = bb.GetCenter();
- const MercuryVertex& extends = bb.GetExtend();
-
- const MercuryVertex &A1(bb.Normal(0)), &A2(bb.Normal(1)), &A3(bb.Normal(2));
-
- MercuryVertex dp = m_normal.DotProduct3(A1, A2, A3);
- float x = ABS( extends.GetX() * dp[0] );
- x += ABS( extends.GetY() * dp[1] );
- x += ABS( extends.GetZ() * dp[2] );
-
- float d = SIGNED_DIST( center+m_center );
- if ( ABS(d) <= x ) //intersection
- return false;
-
- return BEHIND_PLANE(d); //if we don't intersect, just see what side we are on
-}
-
-
-
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
* *
Modified: Mercury2/src/MercuryPlane.h
===================================================================
--- Mercury2/src/MercuryPlane.h 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/MercuryPlane.h 2009-04-12 14:18:33 UTC (rev 204)
@@ -2,7 +2,7 @@
#define MERCURYPLANE_H
#include <MercuryVertex.h>
-#include <BoundingBox.h>
+//#include <BoundingBox.h>
class MercuryPlane
{
@@ -16,8 +16,10 @@
inline void SetCenter(const MercuryVertex& center) { m_center = center; }
inline void SetNormal(const MercuryVertex& normal) { m_normal = normal.Normalize(); }
+ inline const MercuryVector& GetNormal() const { return m_normal; }
+ inline const MercuryVector& GetCenter() const { return m_center; }
+
bool IsBehindPlane(const MercuryVertex& point) const;
- bool IsBehindPlane(const BoundingBox& bb) const;
private:
MercuryVertex m_center;
MercuryVector m_normal;
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/RenderGraph.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -6,17 +6,15 @@
void RenderGraphEntry::Render()
{
MercuryMatrix m;
-
+
if (m_node)
{
- if ( !(m_node->IsHidden() || m_node->IsCulled()) )
- {
- m = *m_matrix;
- m.Transpose();
- glLoadMatrixf( m.Ptr() );
- m_node->PreRender( m );
- m_node->Render( m );
- }
+ if ( m_node->IsHidden() || m_node->IsCulled(*m_matrix) ) return;
+ m = *m_matrix;
+ m.Transpose();
+ glLoadMatrixf( m.Ptr() );
+ m_node->PreRender( m );
+ m_node->Render( m );
}
std::list< RenderGraphEntry >::iterator i;
@@ -25,17 +23,14 @@
if (m_node)
{
- if ( !(m_node->IsHidden() || m_node->IsCulled()) )
- {
- glLoadMatrixf( m.Ptr() );
- m_node->PostRender( m );
- }
+ glLoadMatrixf( m.Ptr() );
+ m_node->PostRender( m );
}
}
void RenderGraph::Build( MercuryNode* node )
{
- printf("rebuilding render graph\n");
+// printf("rebuilding render graph\n");
m_root = RenderGraphEntry();
Build(node, m_root);
}
@@ -48,7 +43,6 @@
if ( rn )
{
//found a new renderable
- printf("Found renderable %p\n", rn);
entry.m_children.push_back( RenderGraphEntry(&rn->FindGlobalMatrix(), rn) );
lastEntry = &(entry.m_children.back());
}
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/RenderableNode.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -3,6 +3,7 @@
#include <GL/gl.h>
#include <TransformNode.h>
#include <unistd.h>
+#include <Viewport.h>
using namespace std;
@@ -22,6 +23,7 @@
void RenderableNode::Update(float dTime)
{
+ /*
MercuryMatrix m = FindGlobalMatrix();
std::list< MAutoPtr< MercuryAsset > >::iterator i;
@@ -36,6 +38,7 @@
//do some stuff to figure out if this node is culled
}
}
+ */
}
void RenderableNode::PreRender(const MercuryMatrix& matrix)
@@ -130,6 +133,28 @@
MercuryNode::LoadFromXML( node );
}
+bool RenderableNode::IsCulled(const MercuryMatrix& matrix)
+{
+ bool clip = false;
+
+ std::list< MAutoPtr< MercuryAsset > >::iterator i;
+ for (i = m_assets.begin(); i != m_assets.end(); ++i )
+ {
+ const BoundingVolume* bv = (*i)->GetBoundingVolume();
+ if (bv)
+ {
+ BoundingVolume* v = bv->SpawnClone();
+ v->Transform( matrix );
+ clip = v->Clip( *FRUSTUM );
+ delete v;
+ if ( clip == false ) return false;
+ }
+ else
+ return false;
+ }
+ return clip;
+}
+
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/RenderableNode.h
===================================================================
--- Mercury2/src/RenderableNode.h 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/RenderableNode.h 2009-04-12 14:18:33 UTC (rev 204)
@@ -32,7 +32,7 @@
const MercuryMatrix& FindGlobalMatrix() const;
- virtual bool IsCulled() { return false; }
+ virtual bool IsCulled(const MercuryMatrix& matrix);
bool IsHidden() { return m_hidden; }
GENRTTI(RenderableNode);
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/Viewport.cpp 2009-04-12 14:18:33 UTC (rev 204)
@@ -2,9 +2,12 @@
#include <GL/gl.h>
REGISTER_NODE_TYPE(Viewport);
+const Frustum* FRUSTUM;
void Viewport::Render(const MercuryMatrix& matrix)
{
+ FRUSTUM = &m_frustum;
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
@@ -31,119 +34,7 @@
RenderableNode::LoadFromXML(node);
}
-void Frustum::SetPerspective( float fov, float aspect, float znear, float zfar )
-{
- float xmin, xmax, ymin, ymax;
-
- m_fov = fov;
- m_aspect = aspect;
- m_zNear = znear;
- m_zFar = zfar;
- float tang = TAN(m_fov * Q_PI / 360.0);
-
- m_nh = ymax = m_zNear * tang; //nh
- ymin = -ymax;
- xmin = ymin * m_aspect;
- m_nw = xmax = ymax * m_aspect; //nw
-
- m_fh = m_zFar*tang;
- m_fw = m_fh*aspect;
-
- ComputeFrustum(xmin, xmax, ymin, ymax, m_zNear, m_zFar);
-}
-
-void Frustum::ComputeFrustum(float left, float right, float bottom, float top, float zNear, float zFar)
-{
- float near2 = 2*zNear;
- float rml = right-left;
- float tmb = top - bottom;
- float fmn = zFar - zNear;
-
- float A = (right+left)/rml;
- float B = (top+bottom)/tmb;
- float C = -(zFar+zNear)/fmn;
- float D = -(near2*zFar)/fmn;
-
- m_frustum.Zero();
-
- //row major
- m_frustum[0][0] = near2/rml;
- m_frustum[0][2] = A;
- m_frustum[1][1] = near2/tmb;
- m_frustum[1][2] = B;
- m_frustum[2][2] = C;
- m_frustum[2][3] = D;
- m_frustum[3][2] = -1;
-
-// m_frustum.Transpose(); //XXX fix it to remove this
-}
-
-void Frustum::LookAt(const MercuryVertex& eye, const MercuryVector& look, const MercuryVector& up)
-{
- //Right now this only builds the frustum planes
- MercuryVector X,Y,Z;
-
- Z = (eye - look).Normalize(); //direction behind camera
- X = (up.CrossProduct(Z)).Normalize(); //X axis
- Y = Z.CrossProduct( X ); //real up
-
- m_nc = (eye - Z) * m_zNear;
- m_fc = (eye - Z) * m_zFar;
-
- m_planes[PNEAR].Setup(m_nc, Z*(-1));
- m_planes[PFAR].Setup(m_fc, Z);
-// m_fc.Print();
-// Z.Print();
- MercuryVector aux,normal;
-
- aux = (m_nc + Y*m_nh) - eye;
- aux.NormalizeSelf();
- normal = aux * X;
- m_planes[PTOP].Setup(m_nc+Y*m_nh,normal);
-
- aux = (m_nc - Y*m_nh) - eye;
- aux.NormalizeSelf();
- normal = X * aux;
- m_planes[PBOTTOM].Setup(m_nc-Y*m_nh,normal);
-
- aux = (m_nc - X*m_nw) - eye;
- aux.NormalizeSelf();
- normal = aux * Y;
- m_planes[PLEFT].Setup(m_nc-X*m_nw,normal);
-
- aux = (m_nc + X*m_nw) - eye;
- aux.NormalizeSelf();
- normal = Y * aux;
- m_planes[PRIGHT].Setup(m_nc+X*m_nw,normal);
-}
-
-bool Frustum::Clip(const BoundingBox& bb) const
-{
- bool inView = true;
- for (uint8_t i = 0; (i < 6) && inView; ++i)
- {
- inView = m_planes[i].IsBehindPlane( bb )?false:inView;
- }
-
- return !inView;
-};
-
-/*
-void Frustum::LookAt()
-{
-
-}
-*/
-/*
-bool Frustum::IsPointInFrustum( float x, float y, float z )
-{
- for( uint16_t i = 0; i < 6; ++i )
- if( frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3] <= 0 )
- return false;
- return true;
-}*/
-
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2009-04-05 23:21:37 UTC (rev 203)
+++ Mercury2/src/Viewport.h 2009-04-12 14:18:33 UTC (rev 204)
@@ -5,36 +5,8 @@
#include <MercuryMatrix.h>
#include <MercuryVertex.h>
#include <MercuryPlane.h>
+#include <Frustum.h>
-enum PlanePos
-{
- PTOP = 0,
- PBOTTOM,
- PLEFT,
- PRIGHT,
- PNEAR,
- PFAR
-};
-
-class Frustum
-{
-
- public:
- void SetPerspective( float fov, float aspect, float znear, float zfar );
- const MercuryMatrix& GetMatrix() const { return m_frustum; }
- void ComputeFrustum(float left, float right, float bottom, float top, float zNear, float zFar);
- void LookAt(const MercuryVertex& eye, const MercuryVector& look, const MercuryVector& up);
- bool Clip(const BoundingBox& bb) const;
- private:
- MercuryPlane m_planes[6];
- MercuryMatrix m_frustum;
-
- float m_aspect, m_fov, m_zNear, m_zFar;
- float m_nh, m_nw, m_fh, m_fw;
-
- MercuryVector m_nc, m_fc;
-};
-
extern const Frustum* FRUSTUM;
class Viewport : public RenderableNode
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-05 23:21:52
|
Revision: 203
http://hgengine.svn.sourceforge.net/hgengine/?rev=203&view=rev
Author: axlecrusher
Date: 2009-04-05 23:21:37 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
fix fallback nodes not having documents attached
Modified Paths:
--------------
Mercury2/src/XMLParser.cpp
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2009-04-05 14:35:16 UTC (rev 202)
+++ Mercury2/src/XMLParser.cpp 2009-04-05 23:21:37 UTC (rev 203)
@@ -100,8 +100,11 @@
}
else
{
- XMLNode fall = FindFallbackNode();
- data = fall.Attribute(tag);
+ if (tag != "name") //probably don't want to fallback for names if a name does not exist
+ {
+ XMLNode fall = FindFallbackNode();
+ data = fall.Attribute(tag);
+ }
}
return data;
@@ -115,7 +118,7 @@
if (d)
{
//start searching at the root
- XMLNode root( xmlDocGetRootElement(m_doc) );
+ XMLNode root( xmlDocGetRootElement(m_doc), m_doc );
//prevent infinite recursion on self
if ( root.m_node != m_node )
{
@@ -133,16 +136,13 @@
if (path.length() > 0)
{
- printf("finding fallback %s\n", path.c_str());
int pos = path.find(".");
MString name = pos<=0?path:path.substr(0, pos);
MString rpath = pos<=0?"":path.substr(pos+1); //skip the period
for (XMLNode n = this->Child(); n.IsValid(); n = n.NextNode())
if (n.Attribute("name") == name)
- {
- printf("found fallback %s\n", name.c_str());
return n.RecursiveFindFallbackNode(rpath);
- }
+
return XMLNode();
}
return *this;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Charles L. <cn...@us...> - 2009-04-05 17:20:36
|
Update of /cvsroot/hgengine/Mercury/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23856 Modified Files: ScreenOutdoors.h Log Message: need acces to light. Index: ScreenOutdoors.h =================================================================== RCS file: /cvsroot/hgengine/Mercury/src/ScreenOutdoors.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ScreenOutdoors.h 30 Jun 2007 13:42:48 -0000 1.9 --- ScreenOutdoors.h 5 Apr 2009 17:20:27 -0000 1.10 *************** *** 24,27 **** --- 24,28 ---- virtual void Init(); CLASS_RTTI( ScreenOutdoors, MercuryScreen ); + inline MercuryLight * GetLight() { return &m_light; } protected: MercurySkyBox* m_pSkyBox; |
|
From: <axl...@us...> - 2009-04-05 14:35:18
|
Revision: 202
http://hgengine.svn.sourceforge.net/hgengine/?rev=202&view=rev
Author: axlecrusher
Date: 2009-04-05 14:35:16 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
fix parsing of nested fallback path
Modified Paths:
--------------
Mercury2/src/XMLParser.cpp
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2009-04-05 04:10:31 UTC (rev 201)
+++ Mercury2/src/XMLParser.cpp 2009-04-05 14:35:16 UTC (rev 202)
@@ -133,11 +133,16 @@
if (path.length() > 0)
{
+ printf("finding fallback %s\n", path.c_str());
int pos = path.find(".");
MString name = pos<=0?path:path.substr(0, pos);
- MString rpath = pos<=0?"":path.substr(pos);
+ MString rpath = pos<=0?"":path.substr(pos+1); //skip the period
for (XMLNode n = this->Child(); n.IsValid(); n = n.NextNode())
- if (n.Attribute("name") == name) return n.RecursiveFindFallbackNode(rpath);
+ if (n.Attribute("name") == name)
+ {
+ printf("found fallback %s\n", name.c_str());
+ return n.RecursiveFindFallbackNode(rpath);
+ }
return XMLNode();
}
return *this;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Charles L. <cn...@us...> - 2009-04-05 06:25:06
|
Update of /cvsroot/hgengine/Mercury In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9840 Modified Files: ode_single.dll Log Message: remove asserts for normalization resutls. Index: ode_single.dll =================================================================== RCS file: /cvsroot/hgengine/Mercury/ode_single.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs3MmSnE and /tmp/cvsSxeG4l differ |
|
From: <axl...@us...> - 2009-04-05 04:10:36
|
Revision: 201
http://hgengine.svn.sourceforge.net/hgengine/?rev=201&view=rev
Author: axlecrusher
Date: 2009-04-05 04:10:31 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
update renderable's matrix logic
Modified Paths:
--------------
Mercury2/src/MercuryMatrix.cpp
Mercury2/src/MercuryMatrix.h
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderGraph.h
Mercury2/src/RenderableNode.cpp
Mercury2/src/TransformNode.cpp
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/MercuryMatrix.cpp 2009-04-05 04:10:31 UTC (rev 201)
@@ -3,7 +3,7 @@
namespace MercuryMath
{
- MercuryMatrix IdentityMatrix;
+ static MercuryMatrix IdentityMatrix;
}
MercuryMatrix::MercuryMatrix()
@@ -202,6 +202,7 @@
return r;
}
+MercuryMatrix MercuryMatrix::IdentityMatrix;
/*
* Copyright (c) 2006 Joshua Allen
Modified: Mercury2/src/MercuryMatrix.h
===================================================================
--- Mercury2/src/MercuryMatrix.h 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/MercuryMatrix.h 2009-04-05 04:10:31 UTC (rev 201)
@@ -44,6 +44,7 @@
void Identity();
void Print() const;
+ static MercuryMatrix IdentityMatrix;
}
#if !defined( WIN32 ) || defined( _MSC_VER )
M_ALIGN(64);
@@ -51,10 +52,9 @@
M_ALIGN(16);
#endif
-namespace MercuryMath
-{
- extern MercuryMatrix IdentityMatrix;
-}
+//namespace MercuryMath
+//{
+//}
#endif
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/RenderGraph.cpp 2009-04-05 04:10:31 UTC (rev 201)
@@ -11,7 +11,7 @@
{
if ( !(m_node->IsHidden() || m_node->IsCulled()) )
{
- m = m_node->FindGlobalMatrix();
+ m = *m_matrix;
m.Transpose();
glLoadMatrixf( m.Ptr() );
m_node->PreRender( m );
@@ -49,7 +49,7 @@
{
//found a new renderable
printf("Found renderable %p\n", rn);
- entry.m_children.push_back( RenderGraphEntry(rn) );
+ entry.m_children.push_back( RenderGraphEntry(&rn->FindGlobalMatrix(), rn) );
lastEntry = &(entry.m_children.back());
}
Modified: Mercury2/src/RenderGraph.h
===================================================================
--- Mercury2/src/RenderGraph.h 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/RenderGraph.h 2009-04-05 04:10:31 UTC (rev 201)
@@ -8,8 +8,8 @@
{
friend class RenderGraph;
public:
- RenderGraphEntry(RenderableNode* node = NULL)
- :m_node(node)
+ RenderGraphEntry(const MercuryMatrix* matrix = &MercuryMatrix::IdentityMatrix, RenderableNode* node = NULL)
+ :m_node(node), m_matrix(matrix)
{}
void AddChild(RenderGraphEntry entry);
@@ -17,6 +17,7 @@
private:
RenderableNode* m_node; //we don't own this, no new or free
std::list< RenderGraphEntry > m_children;
+ const MercuryMatrix* m_matrix;
};
class RenderGraph
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/RenderableNode.cpp 2009-04-05 04:10:31 UTC (rev 201)
@@ -67,7 +67,7 @@
if ( (tn = TransformNode::Cast(n)) )
return tn->GetGlobalMatrix();
- return MercuryMath::IdentityMatrix;
+ return MercuryMatrix::IdentityMatrix;
}
void RenderableNode::AddPreRender(MercuryAsset* asset)
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-04-05 00:30:19 UTC (rev 200)
+++ Mercury2/src/TransformNode.cpp 2009-04-05 04:10:31 UTC (rev 201)
@@ -71,7 +71,7 @@
n = n->Parent();
}
- return MercuryMath::IdentityMatrix;
+ return MercuryMatrix::IdentityMatrix;
}
void TransformNode::RippleTaintDown()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-04-05 00:30:30
|
Revision: 200
http://hgengine.svn.sourceforge.net/hgengine/?rev=200&view=rev
Author: cnlohr
Date: 2009-04-05 00:30:19 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
yay adv_set
Modified Paths:
--------------
Mercury2/adv_set.c
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-04-04 23:23:21 UTC (rev 199)
+++ Mercury2/adv_set.c 2009-04-05 00:30:19 UTC (rev 200)
@@ -10,7 +10,7 @@
src/MercuryVBO.cpp src/MSemaphore.cpp src/UpdateThreader.cpp src/HGMDLMesh.cpp \
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/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-04 23:23:26
|
Revision: 199
http://hgengine.svn.sourceforge.net/hgengine/?rev=199&view=rev
Author: axlecrusher
Date: 2009-04-04 23:23:21 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
new render graph setup
Modified Paths:
--------------
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderableNode.cpp
Mercury2/src/RenderableNode.h
Mercury2/src/Viewport.cpp
Mercury2/src/Viewport.h
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-04-04 19:54:12 UTC (rev 198)
+++ Mercury2/src/RenderGraph.cpp 2009-04-04 23:23:21 UTC (rev 199)
@@ -1,15 +1,41 @@
+#include <MercuryMatrix.h>
#include <RenderGraph.h>
+#include <GL/gl.h>
+
void RenderGraphEntry::Render()
{
- if (m_node) m_node->Render();
+ MercuryMatrix m;
+
+ if (m_node)
+ {
+ if ( !(m_node->IsHidden() || m_node->IsCulled()) )
+ {
+ m = m_node->FindGlobalMatrix();
+ m.Transpose();
+ glLoadMatrixf( m.Ptr() );
+ m_node->PreRender( m );
+ m_node->Render( m );
+ }
+ }
+
std::list< RenderGraphEntry >::iterator i;
for (i = m_children.begin(); i != m_children.end(); ++i )
i->Render();
+
+ if (m_node)
+ {
+ if ( !(m_node->IsHidden() || m_node->IsCulled()) )
+ {
+ glLoadMatrixf( m.Ptr() );
+ m_node->PostRender( m );
+ }
+ }
}
void RenderGraph::Build( MercuryNode* node )
{
+ printf("rebuilding render graph\n");
m_root = RenderGraphEntry();
Build(node, m_root);
}
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-04-04 19:54:12 UTC (rev 198)
+++ Mercury2/src/RenderableNode.cpp 2009-04-04 23:23:21 UTC (rev 199)
@@ -38,22 +38,23 @@
}
}
-void RenderableNode::Render()
+void RenderableNode::PreRender(const MercuryMatrix& matrix)
{
list< MercuryAsset* >::iterator i;
- MercuryMatrix m = FindGlobalMatrix();
-
- if (m_hidden || IsCulled()) return;
-
- m.Transpose();
- glLoadMatrixf( m.Ptr() );
-
for (i = m_prerender.begin(); i != m_prerender.end(); ++i )
(*i)->PreRender(this);
+}
+void RenderableNode::Render(const MercuryMatrix& matrix)
+{
+ list< MercuryAsset* >::iterator i;
for (i = m_render.begin(); i != m_render.end(); ++i )
(*i)->Render(this);
-
+}
+
+void RenderableNode::PostRender(const MercuryMatrix& matrix)
+{
+ list< MercuryAsset* >::iterator i;
for (i = m_postrender.begin(); i != m_postrender.end(); ++i )
(*i)->PostRender(this);
}
@@ -106,21 +107,6 @@
return false;
}
-void RenderableNode::RecursiveRender( MercuryNode* n )
-{
- RenderableNode* rn;
- if ( ( rn = Cast(n) ) )
- {
- rn->Render();
- }
-
- const list< MercuryNode* >& children = n->Children();
- list< MercuryNode* >::const_iterator i;
-
- for (i = children.begin(); i != children.end(); ++i )
- RenderableNode::RecursiveRender( *i );
-}
-
void RenderableNode::LoadFromXML(const XMLNode& node)
{
if ( !node.Attribute("hidden").empty() )
Modified: Mercury2/src/RenderableNode.h
===================================================================
--- Mercury2/src/RenderableNode.h 2009-04-04 19:54:12 UTC (rev 198)
+++ Mercury2/src/RenderableNode.h 2009-04-04 23:23:21 UTC (rev 199)
@@ -16,21 +16,24 @@
RenderableNode();
~RenderableNode();
- virtual void Render();
virtual void Update(float dTime);
-
+
inline void AddAsset(MAutoPtr< MercuryAsset > asset) { m_assets.push_back(asset); }
void AddPreRender(MercuryAsset* asset);
void AddRender(MercuryAsset* asset);
void AddPostRender(MercuryAsset* asset);
- static void RecursiveRender( MercuryNode* n );
+ virtual void PreRender(const MercuryMatrix& matrix);
+ virtual void Render(const MercuryMatrix& matrix);
+ virtual void PostRender(const MercuryMatrix& matrix);
+
virtual void LoadFromXML(const XMLNode& node);
const MercuryMatrix& FindGlobalMatrix() const;
virtual bool IsCulled() { return false; }
+ bool IsHidden() { return m_hidden; }
GENRTTI(RenderableNode);
protected:
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-04-04 19:54:12 UTC (rev 198)
+++ Mercury2/src/Viewport.cpp 2009-04-04 23:23:21 UTC (rev 199)
@@ -3,22 +3,15 @@
REGISTER_NODE_TYPE(Viewport);
-const Frustum* FRUSTUM = NULL;
-
-void Viewport::Render()
+void Viewport::Render(const MercuryMatrix& matrix)
{
- FRUSTUM = &m_frustum;
-
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
-
- MercuryMatrix m = FindGlobalMatrix();
- m.Transpose();
MercuryMatrix f = m_frustum.GetMatrix();
f.Transpose();
- glLoadMatrixf( (m * f).Ptr() );
+ glLoadMatrixf( (matrix * f).Ptr() );
//The following 2 are equivelent to above
// glLoadMatrixf( m_frustum.Ptr() );
// glMultMatrixf( m.Ptr() );
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2009-04-04 19:54:12 UTC (rev 198)
+++ Mercury2/src/Viewport.h 2009-04-04 23:23:21 UTC (rev 199)
@@ -40,7 +40,7 @@
class Viewport : public RenderableNode
{
public:
- virtual void Render();
+ 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-04-04 19:54:22
|
Revision: 198
http://hgengine.svn.sourceforge.net/hgengine/?rev=198&view=rev
Author: axlecrusher
Date: 2009-04-04 19:54:12 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
add methid for reading and resetting render graph rebuild flag
Modified Paths:
--------------
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-04-04 19:53:20 UTC (rev 197)
+++ Mercury2/src/MercuryNode.h 2009-04-04 19:54:12 UTC (rev 198)
@@ -60,6 +60,8 @@
virtual void OnRemoved() {};
GENRTTI(MercuryNode);
+
+ inline static bool NeedsRebuild() { bool t=m_rebuildRenderGraph; m_rebuildRenderGraph = false; return t; }
protected:
std::list< MercuryNode* > m_children; //These nodes are unique, not instanced
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-04 19:53:28
|
Revision: 197
http://hgengine.svn.sourceforge.net/hgengine/?rev=197&view=rev
Author: axlecrusher
Date: 2009-04-04 19:53:20 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
remove unused
Modified Paths:
--------------
Mercury2/src/RenderableNode.h
Modified: Mercury2/src/RenderableNode.h
===================================================================
--- Mercury2/src/RenderableNode.h 2009-04-04 19:51:27 UTC (rev 196)
+++ Mercury2/src/RenderableNode.h 2009-04-04 19:53:20 UTC (rev 197)
@@ -10,10 +10,6 @@
#define MCHECKASSETS
-//extern uint64_t RenderWaited;
-//extern uint64_t UpdateWaited;
-//extern MercuryMatrix GLOBALMATRIX;
-
class RenderableNode : public MercuryNode
{
public:
@@ -23,9 +19,6 @@
virtual void Render();
virtual void Update(float dTime);
- ///Returnes true if N is of type RenderableNode
-// static bool IsMyType( MercuryNode* n );
-
inline void AddAsset(MAutoPtr< MercuryAsset > asset) { m_assets.push_back(asset); }
void AddPreRender(MercuryAsset* asset);
@@ -44,7 +37,7 @@
bool m_hidden;
private:
bool IsInAssetList(MercuryAsset* asset) const;
-
+
std::list< MAutoPtr< MercuryAsset > > m_assets; ///serves as a holder for memory
//we will just use normal pointers here because we don't want to waste too much time
@@ -53,11 +46,6 @@
std::list< MercuryAsset* > m_prerender;
std::list< MercuryAsset* > m_render;
std::list< MercuryAsset* > m_postrender;
-
-//Below is stuff for threaded rendering
-// unsigned long Spinlock( unsigned long value );
-// unsigned long SpinlockWait( unsigned long value, unsigned long usec );
-// MSemaphore m_semaphore;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-04 19:51:35
|
Revision: 196
http://hgengine.svn.sourceforge.net/hgengine/?rev=196&view=rev
Author: axlecrusher
Date: 2009-04-04 19:51:27 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
use the rendergraph to render
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-04-04 19:50:52 UTC (rev 195)
+++ Mercury2/src/Mercury2.cpp 2009-04-04 19:51:27 UTC (rev 196)
@@ -13,6 +13,7 @@
#include <MercuryMessageManager.h>
#include <MercuryTimer.h>
+#include <RenderGraph.h>
MSemaphore UpdateLoopGo;
void* UpdateThread(void* node)
@@ -53,6 +54,7 @@
MercuryTimer timer;
MercuryTimer fpsTimer;
+ RenderGraph renderGraph;
//uncomment the next 2 lines to use threads
// MercuryThread updateThread;
@@ -62,7 +64,14 @@
timer.Touch();
MESSAGEMAN::GetInstance().PumpMessages( timer.MicrosecondsSinceInit() );
root->RecursiveUpdate( timer.Age() ); //comment to use threads
- RenderableNode::RecursiveRender(root);
+
+ if ( MercuryNode::NeedsRebuild() )
+ {
+ renderGraph.Build(root);
+ }
+
+ renderGraph.Render();
+// RenderableNode::RecursiveRender(root);
w->SwapBuffers();
++m_count;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-04 19:50:55
|
Revision: 195
http://hgengine.svn.sourceforge.net/hgengine/?rev=195&view=rev
Author: axlecrusher
Date: 2009-04-04 19:50:52 +0000 (Sat, 04 Apr 2009)
Log Message:
-----------
add render graph
Added Paths:
-----------
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderGraph.h
Added: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp (rev 0)
+++ Mercury2/src/RenderGraph.cpp 2009-04-04 19:50:52 UTC (rev 195)
@@ -0,0 +1,67 @@
+#include <RenderGraph.h>
+
+void RenderGraphEntry::Render()
+{
+ if (m_node) m_node->Render();
+ std::list< RenderGraphEntry >::iterator i;
+ for (i = m_children.begin(); i != m_children.end(); ++i )
+ i->Render();
+}
+
+void RenderGraph::Build( MercuryNode* node )
+{
+ m_root = RenderGraphEntry();
+ Build(node, m_root);
+}
+
+void RenderGraph::Build( MercuryNode* node, RenderGraphEntry& entry)
+{
+ RenderGraphEntry* lastEntry = &entry;
+ RenderableNode* rn = RenderableNode::Cast(node);
+
+ if ( rn )
+ {
+ //found a new renderable
+ printf("Found renderable %p\n", rn);
+ entry.m_children.push_back( RenderGraphEntry(rn) );
+ lastEntry = &(entry.m_children.back());
+ }
+
+ for (MercuryNode* child = node->FirstChild(); child != NULL; child = node->NextChild(child))
+ Build(child, *lastEntry);
+
+ //coming back up the tree
+// entry = lastEntry;
+}
+
+/****************************************************************************
+ * 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/RenderGraph.h
===================================================================
--- Mercury2/src/RenderGraph.h (rev 0)
+++ Mercury2/src/RenderGraph.h 2009-04-04 19:50:52 UTC (rev 195)
@@ -0,0 +1,64 @@
+#ifndef RENDERGRAPH_H
+#define RENDERGRAPH_H
+
+#include <MercuryNode.h>
+#include <RenderableNode.h>
+
+class RenderGraphEntry
+{
+ friend class RenderGraph;
+ public:
+ RenderGraphEntry(RenderableNode* node = NULL)
+ :m_node(node)
+ {}
+
+ void AddChild(RenderGraphEntry entry);
+ void Render();
+ private:
+ RenderableNode* m_node; //we don't own this, no new or free
+ std::list< RenderGraphEntry > m_children;
+};
+
+class RenderGraph
+{
+ public:
+ void Build( MercuryNode* node );
+ inline void Render() { m_root.Render(); }
+ private:
+ void Build( MercuryNode* node, RenderGraphEntry& entry );
+ RenderGraphEntry m_root;
+};
+
+#endif
+
+/****************************************************************************
+ * 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-04-02 00:24:02
|
Revision: 194
http://hgengine.svn.sourceforge.net/hgengine/?rev=194&view=rev
Author: axlecrusher
Date: 2009-04-02 00:23:56 +0000 (Thu, 02 Apr 2009)
Log Message:
-----------
remove old threaded stuff
Modified Paths:
--------------
Mercury2/src/RenderableNode.cpp
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-04-01 01:57:21 UTC (rev 193)
+++ Mercury2/src/RenderableNode.cpp 2009-04-02 00:23:56 UTC (rev 194)
@@ -7,12 +7,7 @@
using namespace std;
REGISTER_NODE_TYPE(RenderableNode);
-/*
-uint64_t RenderWaited = 0;
-uint64_t UpdateWaited = 0;
-MercuryMatrix GLOBALMATRIX;
-*/
RenderableNode::RenderableNode()
:m_hidden(false)
{
@@ -24,25 +19,6 @@
m_render.clear();
m_postrender.clear();
}
-/*
-//this function exists for threaded rendering
-void RenderableNode::Update(float dTime)
-{
- static unsigned long waitTime = 0;
- MSemaphoreIncOnDestroy s( &m_semaphore );
-// if ( Spinlock(0) ) ++UpdateWaited;
-// if ( SpinlockWait(0, 100000) ) ++UpdateWaited;
-// UpdateWaited += Spinlock(0);
-
- int unsigned long waited = SpinlockWait(0, waitTime);
- if (waited > 0)
- waitTime = (waitTime<1000000)?waitTime+1000:waitTime;
- else
- waitTime = (waitTime!=0)?waitTime-1000:0;
-
- UpdateWaited += waited;
-}
-*/
void RenderableNode::Update(float dTime)
{
@@ -132,19 +108,9 @@
void RenderableNode::RecursiveRender( MercuryNode* n )
{
-// static unsigned long waitTime = 0;
RenderableNode* rn;
if ( ( rn = Cast(n) ) )
{
-/*
- MSemaphoreDecOnDestroy s( &(rn->m_semaphore) );
- int unsigned long waited = rn->SpinlockWait(1, waitTime);
- if (waited > 0) waitTime = (waitTime<1000000)?waitTime+1000:waitTime;
- else waitTime = (waitTime!=0)?waitTime-1000:0;
- RenderWaited += waited;
-*/
-// ++RenderWaited += rn->Spinlock(1);
-
rn->Render();
}
@@ -177,28 +143,7 @@
MercuryNode::LoadFromXML( node );
}
-/*
-unsigned long RenderableNode::Spinlock( unsigned long value )
-{
- unsigned long waited = 0;
- while (m_semaphore.Read() != value) ++waited;
- return waited;
-}
-unsigned long RenderableNode::SpinlockWait( unsigned long value, unsigned long usec )
-{
- unsigned long waited = 0;
- while (m_semaphore.Read() != value)
- {
-// waited=true;
- ++waited;
- if (usec>0) usleep(usec);
- }
- return waited;
-}
-*/
-
-
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-01 02:22:31
|
Revision: 193
http://hgengine.svn.sourceforge.net/hgengine/?rev=193&view=rev
Author: axlecrusher
Date: 2009-04-01 01:57:21 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-04-01 01:25:21 UTC (rev 192)
+++ Mercury2/src/MercuryNode.cpp 2009-04-01 01:57:21 UTC (rev 193)
@@ -94,9 +94,8 @@
{
Update(dTime);
- list< MercuryNode* >::iterator i;
- for (i = m_children.begin(); i != m_children.end(); ++i )
- (*i)->RecursiveUpdate(dTime);
+ for (MercuryNode* child = FirstChild(); child != NULL; child = NextChild(child))
+ child->RecursiveUpdate(dTime);
}
void MercuryNode::ThreadedUpdate(float dTime)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-01 01:25:37
|
Revision: 192
http://hgengine.svn.sourceforge.net/hgengine/?rev=192&view=rev
Author: axlecrusher
Date: 2009-04-01 01:25:21 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
fix bug
Modified Paths:
--------------
Mercury2/src/XMLParser.cpp
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2009-04-01 01:22:53 UTC (rev 191)
+++ Mercury2/src/XMLParser.cpp 2009-04-01 01:25:21 UTC (rev 192)
@@ -147,6 +147,7 @@
{
m_node = n.m_node;
m_doc = n.m_doc;
+ return *this;
}
XMLDocument::XMLDocument()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-04-01 01:23:03
|
Revision: 191
http://hgengine.svn.sourceforge.net/hgengine/?rev=191&view=rev
Author: axlecrusher
Date: 2009-04-01 01:22:53 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
keep pointers to siblings and use them for finding children
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-03-28 13:22:39 UTC (rev 190)
+++ Mercury2/src/MercuryNode.cpp 2009-04-01 01:22:53 UTC (rev 191)
@@ -7,7 +7,7 @@
REGISTER_NODE_TYPE(MercuryNode);
MercuryNode::MercuryNode()
- :m_parent(NULL)
+ :m_parent(NULL), m_prevSibling(NULL), m_nextSibling(NULL)
{
}
@@ -24,11 +24,23 @@
void MercuryNode::AddChild(MercuryNode* n)
{
+// list< MercuryNode* >::iterator last = m_children.end();
+
+ n->m_prevSibling = NULL;
+ n->m_nextSibling = NULL;
+ if (m_children.end() != m_children.begin())
+ {
+ MercuryNode* last = m_children.back();
+ last->m_nextSibling = n;
+ n->m_prevSibling = last;
+ }
+
m_children.push_back(n);
n->m_parent = this;
OnAddChild();
n->OnAdded();
+ m_rebuildRenderGraph = true;
}
void MercuryNode::RemoveChild(MercuryNode* n)
@@ -38,48 +50,46 @@
{
if (*i == n)
{
+ MercuryNode* next = n->m_nextSibling;
+ MercuryNode* prev = n->m_prevSibling;
+
n->OnRemoved();
OnRemoveChild();
+
+ if (prev) prev->m_nextSibling = next;
+ if (next) next->m_prevSibling = prev;
+
+ n->m_nextSibling = NULL;
+ n->m_prevSibling = NULL;
n->m_parent = NULL;
+
m_children.erase(i);
+ m_rebuildRenderGraph = true;
+
return;
}
}
}
-MercuryNode* MercuryNode::Parent() const
+MercuryNode* MercuryNode::FirstChild() const
{
- return m_parent;
-}
-
-MercuryNode* MercuryNode::NextSibling() const
-{
- if (m_parent) return m_parent->NextChild(this);
+ if (m_children.begin() != m_children.end())
+ return *(m_children.begin());
return NULL;
}
-MercuryNode* MercuryNode::PrevSibling() const
+MercuryNode* MercuryNode::NextChild(const MercuryNode* child) const
{
- if (m_parent) return m_parent->PrevChild(this);
- return NULL;
+ if (child==NULL) return NULL;
+ return child->NextSibling();
}
-MercuryNode* MercuryNode::NextChild(const MercuryNode* n) const
+MercuryNode* MercuryNode::PrevChild(const MercuryNode* child) const
{
- list< MercuryNode* >::const_iterator i;
- for (i = m_children.begin(); i != m_children.end(); ++i )
- if (*i == n) return *i;
- return NULL;
+ if (child==NULL) return NULL;
+ return child->PrevSibling();
}
-MercuryNode* MercuryNode::PrevChild(const MercuryNode* n) const
-{
- list< MercuryNode* >::const_iterator i;
- for (i = m_children.end(); i != m_children.begin(); --i )
- if (*i == n) return *i;
- return NULL;
-}
-
void MercuryNode::RecursiveUpdate(float dTime)
{
Update(dTime);
@@ -140,6 +150,7 @@
return NULL;
}
+bool MercuryNode::m_rebuildRenderGraph = false;
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-03-28 13:22:39 UTC (rev 190)
+++ Mercury2/src/MercuryNode.h 2009-04-01 01:22:53 UTC (rev 191)
@@ -13,9 +13,9 @@
**/
#define GENRTTI(x) static const x* Cast(const MercuryNode* n) \
-{ return dynamic_cast<const x*>(n); } \
+{ if (n==NULL) return NULL; return dynamic_cast<const x*>(n); } \
static x* Cast(MercuryNode* n) \
-{ return dynamic_cast<x*>(n); }
+{ if (n==NULL) return NULL; return dynamic_cast<x*>(n); }
/*
#define GENRTTI(x) static bool IsMyType(const MercuryNode* n) \
@@ -32,9 +32,10 @@
void AddChild(MercuryNode* n);
void RemoveChild(MercuryNode* n);
- MercuryNode* Parent() const;
- MercuryNode* NextSibling() const;
- MercuryNode* PrevSibling() const;
+ inline MercuryNode* Parent() const { return m_parent; }
+ inline MercuryNode* NextSibling() const { return m_nextSibling; }
+ inline MercuryNode* PrevSibling() const { return m_prevSibling; }
+ MercuryNode* FirstChild() const;
MercuryNode* NextChild(const MercuryNode* n) const; ///Finds the next child in regards to n
MercuryNode* PrevChild(const MercuryNode* n) const; ///Finds the previous child in regards to n
const std::list< MercuryNode* >& Children() const { return m_children; }
@@ -63,6 +64,11 @@
protected:
std::list< MercuryNode* > m_children; //These nodes are unique, not instanced
MercuryNode* m_parent;
+ MercuryNode* m_prevSibling;
+ MercuryNode* m_nextSibling;
+
+ static bool m_rebuildRenderGraph;
+
};
class NodeFactory
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-03-28 13:22:45
|
Revision: 190
http://hgengine.svn.sourceforge.net/hgengine/?rev=190&view=rev
Author: axlecrusher
Date: 2009-03-28 13:22:39 +0000 (Sat, 28 Mar 2009)
Log Message:
-----------
fix compile
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-03-21 02:18:27 UTC (rev 189)
+++ Mercury2/src/Shader.cpp 2009-03-28 13:22:39 UTC (rev 190)
@@ -7,6 +7,8 @@
#include <GL/gl.h>
#include <GL/glext.h>
+#include <string.h>
+
using namespace std;
REGISTER_ASSET_TYPE( Shader );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-03-21 02:18:47
|
Revision: 189
http://hgengine.svn.sourceforge.net/hgengine/?rev=189&view=rev
Author: axlecrusher
Date: 2009-03-21 02:18:27 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
add more XML fallback
Modified Paths:
--------------
Mercury2/mercury2.kdevelop
Mercury2/scenegraph.xml
Mercury2/src/XMLParser.cpp
Mercury2/src/XMLParser.h
Modified: Mercury2/mercury2.kdevelop
===================================================================
--- Mercury2/mercury2.kdevelop 2009-03-20 04:03:50 UTC (rev 188)
+++ Mercury2/mercury2.kdevelop 2009-03-21 02:18:27 UTC (rev 189)
@@ -24,7 +24,7 @@
<useconfiguration>debug</useconfiguration>
</general>
<run>
- <mainprogram/>
+ <mainprogram>/home/josh/Mercury2/debug/src/mercury2</mainprogram>
<terminal>false</terminal>
<programargs/>
<globaldebugarguments/>
@@ -37,7 +37,7 @@
</run>
<configurations>
<optimized>
- <builddir>optimized</builddir>
+ <builddir>/home/josh/Mercury2/optimized</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevg77options</f77compiler>
@@ -55,14 +55,14 @@
</optimized>
<debug>
<configargs>--enable-debug=full</configargs>
- <builddir>debug</builddir>
+ <builddir>/home/josh/Mercury2/debug</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevg77options</f77compiler>
- <cxxflags>-O2 -g -Wall</cxxflags>
+ <cxxflags>-O0 -g -Wall</cxxflags>
<envvars/>
<topsourcedir/>
- <cppflags>-Isrc/ -I/usr/include/libxml2/ -DHGENGINE -DRUN_FROM_START_FOLDER -DUSE_SSE</cppflags>
+ <cppflags>-Isrc/ -I/usr/include/libxml2/ -DHGENGINE -DRUN_FROM_START_FOLDER</cppflags>
<ldflags>-lpthread -lX11 -lGL -lxml2 -lpng</ldflags>
<ccompilerbinary/>
<cxxcompilerbinary/>
@@ -259,4 +259,33 @@
<outputradix>10</outputradix>
</display>
</kdevdebugger>
+ <dist>
+ <custom>false</custom>
+ <bzip>false</bzip>
+ <archname/>
+ <appname>Mercury2</appname>
+ <version>2.0</version>
+ <release/>
+ <vendor/>
+ <licence/>
+ <summary/>
+ <group/>
+ <packager/>
+ <description/>
+ <changelog/>
+ <devpackage>false</devpackage>
+ <docspackage>false</docspackage>
+ <appicon>false</appicon>
+ <arch>2</arch>
+ <genHTML>false</genHTML>
+ <useRPM>false</useRPM>
+ <ftpkde>false</ftpkde>
+ <appskde>false</appskde>
+ <url/>
+ </dist>
+ <ctagspart>
+ <customArguments/>
+ <customTagfilePath>/home/josh/Mercury2/tags</customTagfilePath>
+ <activeTagsFiles/>
+ </ctagspart>
</kdevelop>
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-03-20 04:03:50 UTC (rev 188)
+++ Mercury2/scenegraph.xml 2009-03-21 02:18:27 UTC (rev 189)
@@ -7,28 +7,24 @@
<asset type="texture" file="test.bmp"/>
<asset type="quad"/>
</node>
- <node type="transformnode" movx="-1" movy="-1" fallback="fallbackTest">
- <node type="renderablenode">
- <asset type="quad"/>
- </node>
- </node>
</node>
- <node type="transformnode" movx="-1" movy="-1" fallback="fallbackTest">
+ <node type="transformnode" movz="-3" movx="-1" movy="-1">
<node type="renderablenode">
<asset type="quad"/>
</node>
</node>
- <node type="transformnode" movx="1" movy="-1" fallback="fallbackTest">
+ <node type="transformnode" movz="-3" movx="1" movy="-1" >
<node type="renderablenode">
<asset type="texture" file="test2.png"/>
<asset type="texture" file="test.bmp"/>
<asset type="quad"/>
</node>
</node>
- <node type="rotatornode" movy="0" movz="-2" scalex="0.25" scaley="0.25" scalez="0.25" >
- <node type="renderablenode">
- <asset type="texture" file="test.bmp"/>
- <asset type="hgmdlmodel" file="beerhall.hgmdl"/>
+ <node type="transformnode" movx="1" movy="1" fallback="fallbackTest">
+ <node type="transformnode" movx="-2">
+ <node type="renderablenode">
+ <asset type="quad"/>
+ </node>
</node>
</node>
</SceneGraph>
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2009-03-20 04:03:50 UTC (rev 188)
+++ Mercury2/src/XMLParser.cpp 2009-03-21 02:18:27 UTC (rev 189)
@@ -12,13 +12,14 @@
}
XMLNode::XMLNode(const XMLNode& n)
- :m_node(n.m_node)
+ :m_node(n.m_node), m_doc(n.m_doc)
{
}
XMLNode::~XMLNode()
{
m_node = NULL;
+ m_doc = NULL;
}
XMLNode XMLNode::NextNode() const
@@ -29,9 +30,9 @@
if (node->type == XML_ELEMENT_NODE)
return XMLNode(node,m_doc);
-//falling back here seem like a bad idea, high chance of infinite loops?
-// XMLNode fall = FindFallbackNode();
-// return fall.NextNode();
+ XMLNode parent(m_node->parent, m_doc);
+ XMLNode fall = parent.FindFallbackNode();
+ return fall.Child();
}
return XMLNode();
}
@@ -43,10 +44,6 @@
for (xmlNode* node = m_node->prev; node; node=node->prev)
if (node->type == XML_ELEMENT_NODE)
return XMLNode(node,m_doc);
-
-//falling back here seem like a bad idea, high chance of infinite loops?
-// XMLNode fall = FindFallbackNode();
-// return fall.PreviousNode();
}
return XMLNode();
}
@@ -58,9 +55,8 @@
for (xmlNode* node = m_node->children; node; node=node->next)
if (node->type == XML_ELEMENT_NODE) return XMLNode(node,m_doc);
-//falling back here seem like a bad idea, high chance of infinite loops?
-// XMLNode fall = FindFallbackNode();
-// return fall.Child();
+ XMLNode fall = FindFallbackNode();
+ return fall.Child();
}
return XMLNode();
}
@@ -147,6 +143,12 @@
return *this;
}
+const XMLNode& XMLNode::operator=(const XMLNode& n)
+{
+ m_node = n.m_node;
+ m_doc = n.m_doc;
+}
+
XMLDocument::XMLDocument()
:m_doc(NULL)
{
Modified: Mercury2/src/XMLParser.h
===================================================================
--- Mercury2/src/XMLParser.h 2009-03-20 04:03:50 UTC (rev 188)
+++ Mercury2/src/XMLParser.h 2009-03-21 02:18:27 UTC (rev 189)
@@ -33,6 +33,8 @@
inline bool IsValid() const { return m_node!=NULL; }
XMLNode FindFallbackNode() const;
+
+ const XMLNode& operator=(const XMLNode& n);
private:
XMLNode RecursiveFindFallbackNode(const MString& path) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-03-20 04:03:56
|
Revision: 188
http://hgengine.svn.sourceforge.net/hgengine/?rev=188&view=rev
Author: cnlohr
Date: 2009-03-20 04:03:50 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
fix shader (almost working)
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-03-20 03:37:43 UTC (rev 187)
+++ Mercury2/src/Shader.cpp 2009-03-20 04:03:50 UTC (rev 188)
@@ -54,6 +54,8 @@
{
bool bApply = true;
+ CheckForNewer();
+
//If there's a currnet shader, we may want to abort switching shaders
if( CurrentShader )
{
@@ -87,6 +89,7 @@
bool Shader::LoadShader( )
{
GetTimeCodes( iTimeCode );
+
MString s1 = sShaderName, s2 = sShaderName, s3 = sShaderName;
MercuryFile * f1;
MercuryFile * f2;
@@ -354,6 +357,7 @@
{
unsigned long iCurTimes[3];
GetTimeCodes( iCurTimes );
+
if( iCurTimes[0] != iTimeCode[0] || iCurTimes[1] != iTimeCode[1] || iCurTimes[2] != iTimeCode[2] )
{
DestroyShader( );
@@ -364,16 +368,28 @@
void Shader::GetTimeCodes( unsigned long * iOut )
{
MercuryFile * f = FILEMAN.Open( sShaderName + ".frag" );
- iOut[0] = f->GetModTime();
- f->Close();
+ if( f )
+ {
+ iOut[0] = f->GetModTime();
+ f->Close();
+ } else
+ iOut[0] = 0;
f = FILEMAN.Open( sShaderName + ".vert" );
- iOut[1] = f->GetModTime();
- f->Close();
+ if( f )
+ {
+ iOut[1] = f->GetModTime();
+ f->Close();
+ } else
+ iOut[1] = 0;
f = FILEMAN.Open( sShaderName + ".geom" );
- iOut[2] = f->GetModTime();
- f->Close();
+ if( f )
+ {
+ iOut[2] = f->GetModTime();
+ f->Close();
+ } else
+ iOut[2] = 0;
}
void Shader::ActivateShader()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|