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...> - 2010-04-22 00:01:43
|
Revision: 693
http://hgengine.svn.sourceforge.net/hgengine/?rev=693&view=rev
Author: axlecrusher
Date: 2010-04-22 00:01:37 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
construct can construct bounding boxes around triangles
can be used for terrain collision
Modified Paths:
--------------
Mercury2/src/DataTypes/MTriangle.cpp
Mercury2/src/DataTypes/MTriangle.h
Modified: Mercury2/src/DataTypes/MTriangle.cpp
===================================================================
--- Mercury2/src/DataTypes/MTriangle.cpp 2010-04-20 15:47:42 UTC (rev 692)
+++ Mercury2/src/DataTypes/MTriangle.cpp 2010-04-22 00:01:37 UTC (rev 693)
@@ -14,7 +14,6 @@
m_verts[0] = t.m_verts[0];
m_verts[1] = t.m_verts[1];
m_verts[2] = t.m_verts[2];
-
}
MTriangle::MTriangle(const MercuryVertex& a, const MercuryVertex& b, const MercuryVertex& c)
@@ -89,6 +88,32 @@
return true;
}
+BoundingBox MTriangle::MakeBoundingBox()
+{
+ float minX, minY, minZ;
+ float maxX, maxY, maxZ;
+ minX=minY=minZ = 9999999999999;
+ maxX=maxY=maxZ = -9999999999999;
+
+ for (uint8_t i = 0; i<3; ++i)
+ {
+ minX = MIN<float>(minX,m_verts[i].GetX());
+ minY = MIN<float>(minY,m_verts[i].GetY());
+ minZ = MIN<float>(minZ,m_verts[i].GetZ());
+ maxX = MAX<float>(maxX,m_verts[i].GetX());
+ maxY = MAX<float>(maxY,m_verts[i].GetY());
+ maxZ = MAX<float>(maxZ,m_verts[i].GetZ());
+ }
+
+ //compute center
+ MercuryVertex center( (maxX+minX)/2.0f, (maxY+minY)/2.0f, (maxZ+minZ)/2.0f );
+
+ //extends
+ MercuryVertex extend( (maxX-minX)/2.0, (maxY-minY)/2.0, (maxZ-minZ)/2.0 );
+
+ return BoundingBox(center, extend);
+}
+
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
* *
Modified: Mercury2/src/DataTypes/MTriangle.h
===================================================================
--- Mercury2/src/DataTypes/MTriangle.h 2010-04-20 15:47:42 UTC (rev 692)
+++ Mercury2/src/DataTypes/MTriangle.h 2010-04-22 00:01:37 UTC (rev 693)
@@ -2,6 +2,7 @@
#define MTRIANGLE_H
#include <MercuryVertex.h>
+#include <BoundingBox.h>
class MTriangle
{
@@ -17,6 +18,8 @@
MercuryVertex InterpolatePosition(const MercuryVertex& barycentric);
bool operator == (const MTriangle& rhs) const;
+
+ BoundingBox MakeBoundingBox();
// private:
MercuryVertex m_verts[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-04-20 15:47:49
|
Revision: 692
http://hgengine.svn.sourceforge.net/hgengine/?rev=692&view=rev
Author: axlecrusher
Date: 2010-04-20 15:47:42 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
add and use array3d
Modified Paths:
--------------
Mercury2/src/DataStructures/SpatialHash.h
Added Paths:
-----------
Mercury2/src/DataStructures/array3d.h
Modified: Mercury2/src/DataStructures/SpatialHash.h
===================================================================
--- Mercury2/src/DataStructures/SpatialHash.h 2010-04-20 15:45:40 UTC (rev 691)
+++ Mercury2/src/DataStructures/SpatialHash.h 2010-04-20 15:47:42 UTC (rev 692)
@@ -4,6 +4,7 @@
//#include <stdint.h>
#include <list>
#include <math.h>
+#include <array3d.h>
template<typename T>
class SpatialHash
@@ -29,8 +30,7 @@
cellCount = cellCount==0?1:cellCount;
m_cellCount = cellCount;
- uint32_t size = cellCount*cellCount*cellCount;
- m_hashTable = new std::list<T>[size];
+ m_hashTable = new Array3d< std::list<T> >(cellCount,cellCount,cellCount);
}
void Insert(float x, float y, float z, const T& d)
@@ -45,7 +45,7 @@
iz = iz % m_cellCount;
//check for and skip duplicate
- std::list<T>& cell = m_hashTable[ Index( ix, iy, iz ) ];
+ std::list<T>& cell = m_hashTable->Get( ix, iy, iz );
typename std::list<T>::iterator i = cell.begin();
for (;i != cell.end(); ++i)
@@ -70,7 +70,7 @@
std::list<T> r;
for (uint32_t iz = 0; iz < m_cellCount; ++iz)
- CopyIntoList(m_hashTable[Index(ix, iy, iz)], r);
+ CopyIntoList(m_hashTable->Get(ix, iy, iz), r);
return r;
}
@@ -87,19 +87,15 @@
std::list<T> r;
for (uint32_t iy = 0; iy < m_cellCount; ++iy)
- CopyIntoList(m_hashTable[Index(ix, iy, iz)], r);
+ CopyIntoList(m_hashTable->Get(ix, iy, iz), r);
return r;
}
private:
- inline uint32_t Index(uint32_t x, uint32_t y, uint32_t z)
- {
- return x + (m_cellCount * y) + (m_cellCount * m_cellCount * z);
- }
void DeleteHash()
{
- if (m_hashTable) delete[] m_hashTable;
+ if (m_hashTable) delete m_hashTable;
m_spacing = 1;
m_cellCount = 0;
}
@@ -111,7 +107,7 @@
for (;i != in.end(); ++i) r.push_back(*i);
}
- std::list<T>* m_hashTable;
+ Array3d< std::list<T> >* m_hashTable;
float m_spacing;
uint32_t m_cellCount;
};
Added: Mercury2/src/DataStructures/array3d.h
===================================================================
--- Mercury2/src/DataStructures/array3d.h (rev 0)
+++ Mercury2/src/DataStructures/array3d.h 2010-04-20 15:47:42 UTC (rev 692)
@@ -0,0 +1,75 @@
+#ifndef ARRAY3D_h
+#define ARRAY3D_h
+
+class Array3dOutOfBounds
+{
+ public:
+ Array3dOutOfBounds(uint16_t xx, uint16_t yy, uint16_t zz, uint16_t mx, uint16_t my, uint16_t mz)
+ :X(xx), Y(yy), Z(zz), MaxX(mx), MaxY(my), MaxZ(mz)
+ { }
+ uint16_t X,Y,Z;
+ uint16_t MaxX,MaxY,MaxZ;
+};
+
+template<typename T>
+class Array3d
+{
+ public:
+ Array3d(uint16_t x, uint16_t y, uint16_t z)
+ :m_array(0), m_x(x), m_y(y), m_z(z)
+ {
+ m_array = new T[m_x*m_y*m_z];
+ }
+
+ ~Array3d()
+ {
+ if (m_array!=0) delete[] m_array;
+ m_array=0;
+ m_x = m_y = m_z = 0;
+ }
+
+ inline T& Get(uint16_t x, uint16_t y, uint16_t z)
+ {
+ if (x>=m_x || y>=m_y || z>=m_z) throw Array3dOutOfBounds(x,y,z,m_x,m_y,m_z);
+ return m_array[x + (m_x * y) + (m_x * m_y * z)];
+ }
+
+ private:
+ T* m_array;
+ uint16_t m_x,m_y,m_z;
+};
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2010 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...> - 2010-04-20 15:45:46
|
Revision: 691
http://hgengine.svn.sourceforge.net/hgengine/?rev=691&view=rev
Author: axlecrusher
Date: 2010-04-20 15:45:40 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
oops we need to know the true age at all times
Modified Paths:
--------------
Mercury2/modules/ParticleEmitter.cpp
Modified: Mercury2/modules/ParticleEmitter.cpp
===================================================================
--- Mercury2/modules/ParticleEmitter.cpp 2010-04-20 13:13:56 UTC (rev 690)
+++ Mercury2/modules/ParticleEmitter.cpp 2010-04-20 15:45:40 UTC (rev 691)
@@ -96,14 +96,15 @@
void ParticleBase::Deactivate()
{
- m_age = 0;
- WriteAgeToVBO();
+// m_age = 0; //doing this breaks IsActive()
+// WriteAgeToVBO();
for (uint8_t i = 0; i < 4; ++i)
{
//zero vertices should enable fast empty set culling but does not work might need FBO
WriteFloatToVertices(0,i,0);
WriteFloatToVertices(0,i,1);
WriteFloatToVertices(0,i,2);
+ WriteFloatToVertices(0,i,3); //fake zero age
}
m_emitter->SetDirtyVBO();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-04-20 13:14:03
|
Revision: 690
http://hgengine.svn.sourceforge.net/hgengine/?rev=690&view=rev
Author: axlecrusher
Date: 2010-04-20 13:13:56 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
fix screwy deactivation
Modified Paths:
--------------
Mercury2/modules/ParticleEmitter.cpp
Modified: Mercury2/modules/ParticleEmitter.cpp
===================================================================
--- Mercury2/modules/ParticleEmitter.cpp 2010-04-08 03:48:44 UTC (rev 689)
+++ Mercury2/modules/ParticleEmitter.cpp 2010-04-20 13:13:56 UTC (rev 690)
@@ -96,8 +96,11 @@
void ParticleBase::Deactivate()
{
+ m_age = 0;
+ WriteAgeToVBO();
for (uint8_t i = 0; i < 4; ++i)
{
+ //zero vertices should enable fast empty set culling but does not work might need FBO
WriteFloatToVertices(0,i,0);
WriteFloatToVertices(0,i,1);
WriteFloatToVertices(0,i,2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-04-08 03:48:50
|
Revision: 689
http://hgengine.svn.sourceforge.net/hgengine/?rev=689&view=rev
Author: cnlohr
Date: 2010-04-08 03:48:44 +0000 (Thu, 08 Apr 2010)
Log Message:
-----------
whoops forgot this stuff
Modified Paths:
--------------
Mercury2/src/MercuryVBO.cpp
Mercury2/src/MercuryVBO.h
Added Paths:
-----------
Mercury2/src/MercuryTransform.cpp
Mercury2/src/MercuryTransform.h
Mercury2/src/MercuryTween.cpp
Mercury2/src/MercuryTween.h
Mercury2/src/VariableRegister.h
Added: Mercury2/src/MercuryTransform.cpp
===================================================================
--- Mercury2/src/MercuryTransform.cpp (rev 0)
+++ Mercury2/src/MercuryTransform.cpp 2010-04-08 03:48:44 UTC (rev 689)
@@ -0,0 +1,57 @@
+#include <MercuryTransform.h>
+
+MercuryTransform::MercuryTransform() : m_bDirty( true )
+{
+ Scale[0] = Scale[1] = Scale[2] = 1;
+}
+
+void MercuryTransform::SetTween( const MercuryTransform & left, const MercuryTransform & right, float fPercent )
+{
+ Position = left.Position * (1-fPercent) + right.Position * fPercent;
+ Scale = left.Scale * (1-fPercent) + right.Scale * fPercent;
+ Rotation = SLERP( left.Rotation, right.Rotation, fPercent );
+ Dirty();
+}
+
+MercuryMatrix & MercuryTransform::GetMatrix()
+{
+ if( m_bDirty )
+ {
+ m_Matrix = MercuryMatrix::Identity();
+ m_Matrix.Translate( Position[0], Position[1], Position[2] );
+ m_Matrix.Rotate( Rotation );
+ m_Matrix.Scale( Scale[0], Scale[1], Scale[2] );
+ m_bDirty = 0;
+ }
+ return m_Matrix;
+}
+
+
+/*
+ * Copyright (c) 2010 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/MercuryTransform.h
===================================================================
--- Mercury2/src/MercuryTransform.h (rev 0)
+++ Mercury2/src/MercuryTransform.h 2010-04-08 03:48:44 UTC (rev 689)
@@ -0,0 +1,60 @@
+#ifndef _MERCURYTRANSFORM_H
+#define _MERCURYTRANSFORM_H
+
+#include <MercuryMatrix.h>
+
+class MercuryTransform
+{
+public:
+ MercuryTransform();
+
+ void SetTween( const MercuryTransform & left, const MercuryTransform & right, float fPercent );
+
+ MercuryMatrix & GetMatrix();
+ inline void Dirty() { m_bDirty = true; }
+ inline bool IsDirty() { return m_bDirty; }
+ MQuaternion Rotation;
+ MercuryVertex Position;
+ MercuryVertex Scale;
+private:
+ MercuryMatrix m_Matrix;
+ bool m_bDirty;
+};
+
+inline void SetTween( MercuryTransform & ActOn, const MercuryTransform & left, const MercuryTransform & right, float fPercent )
+{
+ ActOn.SetTween( left, right, fPercent );
+}
+
+
+#endif
+
+
+/*
+ * Copyright (c) 2010 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/MercuryTween.cpp
===================================================================
--- Mercury2/src/MercuryTween.cpp (rev 0)
+++ Mercury2/src/MercuryTween.cpp 2010-04-08 03:48:44 UTC (rev 689)
@@ -0,0 +1,33 @@
+#include <MercuryTween.h>
+
+//This file is just to make sure MercuryTween compiles OK.
+
+
+/*
+ * Copyright (c) 2010 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/MercuryTween.h
===================================================================
--- Mercury2/src/MercuryTween.h (rev 0)
+++ Mercury2/src/MercuryTween.h 2010-04-08 03:48:44 UTC (rev 689)
@@ -0,0 +1,125 @@
+#ifndef _MERCURYTWEEN_H
+#define _MERCURYTWEEN_H
+
+#include <deque>
+#include "MercuryUtil.h"
+
+typedef float (*TweenFunction)( float, float );
+
+template< typename T >
+class MercuryTweenState
+{
+public:
+ T Target;
+
+ TweenFunction Function;
+ float FunctionP;
+
+ float Time;
+};
+
+template< typename T >
+class MercuryTween
+{
+public:
+ MercuryTween() : Current( 0 ), m_fInOnThisTween( 0 ){ }
+ T * Current;
+
+ void Attach( T * val )
+ {
+ Current = val;
+ m_Last = *Current;
+ }
+
+ void Update( float fDelta )
+ {
+ if( !Current || !m_FutureTweens.size() )
+ return;
+
+ //The following few lines are incredibly convoluted. I do not suggest trying to figure it out.
+ m_fInOnThisTween += fDelta;
+
+ while( m_FutureTweens.size() && m_fInOnThisTween > m_FutureTweens.front().Time )
+ {
+ m_Last = *Current;
+ *Current = m_FutureTweens.front().Target;
+ m_fInOnThisTween -= m_FutureTweens.front().Time;
+ m_FutureTweens.pop_front();
+ }
+
+ if( !m_FutureTweens.size() )
+ {
+ m_fInOnThisTween = 0;
+ m_Last = *Current;
+ return;
+ }
+
+ MercuryTweenState<T> & ts = m_FutureTweens.front();
+
+ SetTween( *Current, m_Last, ts.Target, ts.Function( m_fInOnThisTween/ts.Time, ts.FunctionP ) );
+ }
+
+ void Finish()
+ {
+ Current = m_FutureTweens.back().Target;
+ m_FutureTweens.clear();
+ m_fInOnThisTween = 0;
+ }
+
+ void Stop()
+ {
+ m_FutureTweens.clear();
+ m_fInOnThisTween = 0;
+ }
+
+ void AddTween( MercuryTweenState< T > s )
+ {
+ m_FutureTweens.push_back( s );
+ }
+
+ void AddTween( MString & sTweenSet )
+ {
+ MVector < MString > out;
+ SplitStrings( sTweenSet, out, ";\n", " \t", 2, 2 );
+// for( unsigned i = 0
+ }
+
+private:
+ float m_fInOnThisTween;
+ T m_Last;
+ std::deque< MercuryTweenState< T > > m_FutureTweens;
+};
+
+
+
+#endif
+
+
+/*
+ * Copyright (c) 2010 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.
+ */
+
Modified: Mercury2/src/MercuryVBO.cpp
===================================================================
--- Mercury2/src/MercuryVBO.cpp 2010-04-05 06:12:33 UTC (rev 688)
+++ Mercury2/src/MercuryVBO.cpp 2010-04-08 03:48:44 UTC (rev 689)
@@ -10,7 +10,7 @@
extern bool SHOWAXISES;
MercuryVBO::MercuryVBO( const MString & key, bool bInstanced, bool useVertexColor )
- :MercuryAsset( key, bInstanced ), m_initiated(false), m_useVertexColor(useVertexColor)
+ :MercuryAsset( key, bInstanced ), m_initiated(false), m_useVertexColor(useVertexColor), m_iIndexCountOverride( -1 )
{
m_bufferIDs[0] = m_bufferIDs[1] = m_bufferIDs[2] = 0;
m_bDirtyIndices = m_bDirtyVertices = m_bDirtyVertexColor = false;
@@ -59,7 +59,11 @@
GLCALL( glEnableClientState( GL_NORMAL_ARRAY ) );
GLCALL( glNormalPointer(GL_FLOAT, STRIDE*sizeof(float), BUFFER_OFFSET(sizeof(float)*2)) );
- GLCALL( glDrawRangeElements(GL_TRIANGLES, 0, m_indexData.Length()-1, m_indexData.Length(), GL_UNSIGNED_SHORT, NULL) );
+ unsigned long iElemsToDraw = (m_iIndexCountOverride!=-1)?m_iIndexCountOverride:(m_indexData.Length()-1);
+//printf( "%d (%d,%d)\n", iElemsToDraw,m_iIndexCountOverride,m_indexData.Length()-1 );
+ GLCALL( glDrawRangeElements( GL_TRIANGLES, 0, iElemsToDraw,
+ iElemsToDraw+1, GL_UNSIGNED_SHORT, NULL) );
+
IncrementBatches();
if (m_boundingVolume && SHOWBOUNDINGVOLUME) m_boundingVolume->Render();
Modified: Mercury2/src/MercuryVBO.h
===================================================================
--- Mercury2/src/MercuryVBO.h 2010-04-05 06:12:33 UTC (rev 688)
+++ Mercury2/src/MercuryVBO.h 2010-04-08 03:48:44 UTC (rev 689)
@@ -45,12 +45,15 @@
inline static const void* GetLastRendered() { return m_lastVBOrendered; }
inline static void IncrementBatches() { ++m_vboBatches; }
+ inline void SetIndexCountOverride( int iCount ) { m_iIndexCountOverride = iCount; }
GENRTTI( MercuryVBO );
protected:
virtual bool CheckForNewer() { return false; }
virtual void Reload() {};
private:
+
+ unsigned long m_iIndexCountOverride;
virtual void InitVBO();
static void* m_lastVBOrendered;
Added: Mercury2/src/VariableRegister.h
===================================================================
--- Mercury2/src/VariableRegister.h (rev 0)
+++ Mercury2/src/VariableRegister.h 2010-04-08 03:48:44 UTC (rev 689)
@@ -0,0 +1,74 @@
+#ifndef _VARIABLE_REGISTER_H
+#define _VARIABLE_REGISTER_H
+
+class VariableReceiver
+{
+public:
+ void VariableDelegate( const MString & sChangedVariable, const MString & sChangedValue );
+};
+
+typedef void (VariableReceiver::*VariableDelegate)( const MString & sChangedVariable, const MString & sChangedValue );
+
+///Variable Register
+/**This is a tool that can be used by programmers and the like to control global variables.
+ It is quite useful in situations where you want to be able to change variables without
+ use of code, and be able to catch changes. */
+class VariablesRegister
+{
+public:
+ void RegisterListener( const MString & sVariable, VariableDelegate d );
+ const MString & GetVariable( const MString & var ) { MString * s = m_mVariables->Get( var ); return s?*s:""; }
+ static MercuryMessageManager& GetInstance();
+private:
+ MHash< MString > m_mVariables;
+
+ struct Sender
+ {
+ VariableDelegate * d;
+
+ };
+ MHash< VariableDelegate > m_mDelegates;
+ MHash<
+};
+
+
+
+static InstanceCounter<VariablesRegister> MMcounter("VariablesRegister");
+
+#define VARIABLES VariablesRegister::GetInstance()
+
+
+#endif
+
+/****************************************************************************
+ * Copyright (C) 2008 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...> - 2010-04-05 06:12:42
|
Revision: 688
http://hgengine.svn.sourceforge.net/hgengine/?rev=688&view=rev
Author: cnlohr
Date: 2010-04-05 06:12:33 +0000 (Mon, 05 Apr 2010)
Log Message:
-----------
Tweak to allow detection of actual mouse-motion commands, as to prevent confusing the rest of the system.
Modified Paths:
--------------
Mercury2/modules/Cu2.cpp
Mercury2/src/MercuryInput.cpp
Mercury2/src/MercuryInput.h
Mercury2/src/X11Window.cpp
Modified: Mercury2/modules/Cu2.cpp
===================================================================
--- Mercury2/modules/Cu2.cpp 2010-03-29 18:38:45 UTC (rev 687)
+++ Mercury2/modules/Cu2.cpp 2010-04-05 06:12:33 UTC (rev 688)
@@ -59,7 +59,7 @@
m_bWasMouseInThisFrame = bIsInside;
- for( unsigned button = 0; button < 8; button++ )
+ for( unsigned button = 0; button < 3; button++ )
{
unsigned char Mask = 1<<button;
bool bWasDown = iLastButtonMask & Mask;
Modified: Mercury2/src/MercuryInput.cpp
===================================================================
--- Mercury2/src/MercuryInput.cpp 2010-03-29 18:38:45 UTC (rev 687)
+++ Mercury2/src/MercuryInput.cpp 2010-04-05 06:12:33 UTC (rev 688)
@@ -11,7 +11,7 @@
buttons.data = 0;
}
-void MouseInput::ProcessMouseInput(int dx, int dy, bool leftButton, bool rightButton, bool centerButton, bool scrollUpButton, bool scrollDownButton)
+void MouseInput::ProcessMouseInput(int dx, int dy, bool leftButton, bool rightButton, bool centerButton, bool scrollUpButton, bool scrollDownButton, bool bMotionEvent )
{
MouseInput* mi = new MouseInput();
mi->dx = dx;
@@ -23,6 +23,7 @@
buttons.scrollup = scrollUpButton;
buttons.scrolldown = scrollDownButton;
mi->buttons = buttons;
+ mi->buttons.motion = bMotionEvent;
currentButtonMasks = buttons;
GlobalMouseX_Set.Set( dx );
Modified: Mercury2/src/MercuryInput.h
===================================================================
--- Mercury2/src/MercuryInput.h 2010-03-29 18:38:45 UTC (rev 687)
+++ Mercury2/src/MercuryInput.h 2010-04-05 06:12:33 UTC (rev 688)
@@ -19,14 +19,15 @@
unsigned int center: 1;
unsigned int scrollup: 1;
unsigned int scrolldown: 1;
+ unsigned int motion : 1; //if 1, don't expect other button info, it's a mouse-motion event.
};
} buttonMask;
- static void ProcessMouseInput(int dx, int dy, bool leftButton, bool rightButton, bool centerButton, bool scrollUpButton, bool scrollDownButton);
+ static void ProcessMouseInput(int dx, int dy, bool leftButton, bool rightButton, bool centerButton, bool scrollUpButton, bool scrollDownButton, bool motionevent);
MouseInput();
int32_t dx, dy;
buttonMask buttons;
-
+
private:
static buttonMask currentButtonMasks;
};
Modified: Mercury2/src/X11Window.cpp
===================================================================
--- Mercury2/src/X11Window.cpp 2010-03-29 18:38:45 UTC (rev 687)
+++ Mercury2/src/X11Window.cpp 2010-04-05 06:12:33 UTC (rev 688)
@@ -289,7 +289,7 @@
sd = ((e->state & X11_MASK(MOUSE_BTN_SCROLL_DOWN))!=0) ^ (e->button == MOUSE_BTN_SCROLL_DOWN);
MouseInput::ProcessMouseInput(m_iLastMouseX, m_iLastMouseY ,
- left, right, center, su, sd);
+ left, right, center, su, sd, false);
break;
}
case KeyPress:
@@ -327,7 +327,7 @@
{
m_iLastMouseX = x;
m_iLastMouseY = y;
- MouseInput::ProcessMouseInput(x, y, left, right, center, su, sd);
+ MouseInput::ProcessMouseInput(x, y, left, right, center, su, sd, true);
XWarpPointer(m_display, None, m_window, 0,0,0,0,m_width/2,m_height/2);
}
}
@@ -335,7 +335,7 @@
{
m_iLastMouseX = e->x;
m_iLastMouseY = e->y;
- MouseInput::ProcessMouseInput(e->x, e->y, left, right, center, su, sd);
+ MouseInput::ProcessMouseInput(e->x, e->y, left, right, center, su, sd, true);
}
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-03-29 18:38:52
|
Revision: 687
http://hgengine.svn.sourceforge.net/hgengine/?rev=687&view=rev
Author: axlecrusher
Date: 2010-03-29 18:38:45 +0000 (Mon, 29 Mar 2010)
Log Message:
-----------
Minor changes i have had sitting round for a while.
Modified Paths:
--------------
Mercury2/modules/Terrain.cpp
Mercury2/src/Shader.cpp
Modified: Mercury2/modules/Terrain.cpp
===================================================================
--- Mercury2/modules/Terrain.cpp 2010-03-14 23:04:33 UTC (rev 686)
+++ Mercury2/modules/Terrain.cpp 2010-03-29 18:38:45 UTC (rev 687)
@@ -167,7 +167,7 @@
{
if( Asset().GetLoadState() == LOADING )
{
- POST_MESSAGE( "QueryTerrainPoint", new VertexDataMessage( dynamic_cast<const VertexDataMessage&>(data) ), 0.0001 );
+ POST_MESSAGE( "QueryTerrainPoint", new VertexDataMessage( dynamic_cast<const VertexDataMessage&>(data) ), 0.0001f );
return;
}
const VertexDataMessage& v( dynamic_cast<const VertexDataMessage&>(data) );
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2010-03-14 23:04:33 UTC (rev 686)
+++ Mercury2/src/Shader.cpp 2010-03-29 18:38:45 UTC (rev 687)
@@ -410,25 +410,25 @@
if( f )
{
iOut[0] = f->GetModTime();
- delete f;
} else
iOut[0] = 0;
+ SAFE_DELETE(f);
f = FILEMAN.Open( sShaderName + ".vert" );
if( f )
{
iOut[1] = f->GetModTime();
- delete f;
} else
iOut[1] = 0;
+ SAFE_DELETE(f);
f = FILEMAN.Open( sShaderName + ".geom" );
if( f )
{
iOut[2] = f->GetModTime();
- delete f;
} else
iOut[2] = 0;
+ SAFE_DELETE(f);
}
void Shader::ActivateShader()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-14 23:04:41
|
Revision: 686
http://hgengine.svn.sourceforge.net/hgengine/?rev=686&view=rev
Author: cnlohr
Date: 2010-03-14 23:04:33 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
Working MQuat
Modified Paths:
--------------
Mercury2/src/MQuaternion.cpp
Mercury2/src/MQuaternion.h
Modified: Mercury2/src/MQuaternion.cpp
===================================================================
--- Mercury2/src/MQuaternion.cpp 2010-03-03 09:07:37 UTC (rev 685)
+++ Mercury2/src/MQuaternion.cpp 2010-03-14 23:04:33 UTC (rev 686)
@@ -7,7 +7,7 @@
m_wxyz[0] = 0;
m_wxyz[1] = 0;
m_wxyz[2] = 0;
- m_wxyz[3] = 0;
+ m_wxyz[3] = 1;
}
MQuaternion::MQuaternion(float W, float X, float Y, float Z)
Modified: Mercury2/src/MQuaternion.h
===================================================================
--- Mercury2/src/MQuaternion.h 2010-03-03 09:07:37 UTC (rev 685)
+++ Mercury2/src/MQuaternion.h 2010-03-14 23:04:33 UTC (rev 686)
@@ -86,6 +86,9 @@
///Produce a matrix out of a rotation x, then y then z (how Mercury does it)
void AngleMatrix (const MercuryVector & angles, MercuryMatrix & mat );
+///Spherically interpolate between two quaternions t = 0..1
+MQuaternion SLERP( const MQuaternion &a, const MQuaternion &b,float t);
+
#endif
/****************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-03 09:07:43
|
Revision: 685
http://hgengine.svn.sourceforge.net/hgengine/?rev=685&view=rev
Author: cnlohr
Date: 2010-03-03 09:07:37 +0000 (Wed, 03 Mar 2010)
Log Message:
-----------
add utility functions for new tweening template thingie that will be coming soon.
Modified Paths:
--------------
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Modified: Mercury2/src/MercuryUtil.cpp
===================================================================
--- Mercury2/src/MercuryUtil.cpp 2010-03-03 08:51:22 UTC (rev 684)
+++ Mercury2/src/MercuryUtil.cpp 2010-03-03 09:07:37 UTC (rev 685)
@@ -3,6 +3,7 @@
#include <Mint.h>
#include <MercuryVector.h>
#include <MercuryBacktrace.h>
+#include <math.h>
#ifdef WIN32
#include <Windows.h>
@@ -298,6 +299,34 @@
#endif
}
+float FLinear( float in, float slice )
+{
+ float fret = (in - 0.5) * slice;
+
+ if( fret > 0.5 ) fret = 0.5;
+ else if( fret < -0.5 ) fret = -0.5;
+ return fret + 0.5;
+}
+
+float FExponential( float in, float powx )
+{
+ return pow( in, powx );
+}
+
+float FStep( float in, float stepplace )
+{
+ return ( in < stepplace )?0:1;
+}
+
+float FSigmoid( float in, float fspeed )
+{
+ float fi = in - 0.5;
+ float fr = ( exp( fi * fspeed ) - 1 ) / ( exp( fi * fspeed ) + 1 );
+ float smax = ( exp( fspeed * 0.5 ) - 1 ) / ( exp( fspeed * 0.5 ) + 1 );
+ return (fr / smax) / 2. + 0.5;
+}
+
+
/* Copyright (c) 2009, Joshua Allen and Charles Lohr
* All rights reserved.
*
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2010-03-03 08:51:22 UTC (rev 684)
+++ Mercury2/src/MercuryUtil.h 2010-03-03 09:07:37 UTC (rev 685)
@@ -135,7 +135,19 @@
MString ConvertToUnformatted( const MString & cf );
///millisecond sleep
-void msleep(uint32_t msec);
+void msleep(uint32_t msec);
+
+///Utility linear function, in = [0..1] out = [0..1]; respectively, if slice >= 1
+float FLinear( float in, float slice = 1. );
+
+///Utility exponential function, in = [0..1] out = [0..1]; respectively; regardless of pow. If pow == 1, would be identical to linear.
+float FExponential( float in, float powx = 1. );
+
+///Utility step function; out = 0 when in < stepplace; out = 1 when in >= stepplace
+float FStep( float in, float stepplace = 1. );
+
+///Utility sigmoid function; in = [0..1] out = [0..1]; speed is the slope of change in the middle.
+float FSigmoid( float in, float fspeed = 1. );
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-03 08:51:28
|
Revision: 684
http://hgengine.svn.sourceforge.net/hgengine/?rev=684&view=rev
Author: cnlohr
Date: 2010-03-03 08:51:22 +0000 (Wed, 03 Mar 2010)
Log Message:
-----------
forgot camera .h and add more traditional lights to state changer, for those who which to manually control their lighting
Modified Paths:
--------------
Mercury2/src/Camera.h
Mercury2/src/StateChanger.cpp
Modified: Mercury2/src/Camera.h
===================================================================
--- Mercury2/src/Camera.h 2010-03-03 08:49:47 UTC (rev 683)
+++ Mercury2/src/Camera.h 2010-03-03 08:51:22 UTC (rev 684)
@@ -26,6 +26,7 @@
MercuryVertex m_origionalPosition;
MercuryVector m_lookAt;
float m_x, m_y;
+ bool m_bFreeFly;
MercuryMatrix m_viewMatrix;
};
Modified: Mercury2/src/StateChanger.cpp
===================================================================
--- Mercury2/src/StateChanger.cpp 2010-03-03 08:49:47 UTC (rev 683)
+++ Mercury2/src/StateChanger.cpp 2010-03-03 08:51:22 UTC (rev 684)
@@ -271,6 +271,7 @@
REGISTER_STATECHANGE( BlendFunc );
+///Change the alpha blending function (can be useful for non-shader farcry-like foliage)
class AlphaFunc : public StateChange
{
public:
@@ -334,6 +335,51 @@
REGISTER_STATECHANGE( AlphaFunc );
+///OpenGL-based fixed light
+class OGLLight : public StateChange
+{
+public:
+ OGLLight( const MVector< MString > & sParameters ) : StateChange( sParameters )
+ {
+ if( sParameters.size() < 5 )
+ {
+ LOG.Write( ssprintf( "Error: Light has invalid number of parameters(%d).", sParameters.size() ) );
+ return;
+ }
+
+ iLight = StrToInt( sParameters[0] );
+
+ for( unsigned i = 0; i < 16; i++ )
+ if( i+1 < sParameters.size() )
+ {
+ fParams[i] = StrToFloat( sParameters[i+1] );
+ }
+ }
+
+ void Stringify( MString & sOut )
+ {
+ sOut = ssprintf( "%d", iLight );
+ for( unsigned i = 0; i < 16; i++ )
+ sOut += ssprintf( ",%f", fParams[i] );
+ }
+
+ void Activate()
+ {
+ GLCALL( glEnable(GL_LIGHT0 + iLight) );
+ GLCALL( glLightfv(GL_LIGHT0, GL_POSITION, &fParams[0]) );
+ GLCALL( glLightfv(GL_LIGHT0, GL_DIFFUSE, &fParams[4]) );
+ GLCALL( glLightfv(GL_LIGHT0, GL_AMBIENT, &fParams[8]) );
+ GLCALL( glLightfv(GL_LIGHT0, GL_SPECULAR, &fParams[12]) );
+
+ }
+
+ STATECHANGE_RTTI( OGLLight );
+
+ int iLight;
+ float fParams[16]; //Position, Diffuse, Ambient, Specular; each [4]
+};
+
+REGISTER_STATECHANGE( OGLLight );
//////////////////////////////////////STATE CHANGE CHUNK//////////////////////////////////////
StateChangeRegister & StateChangeRegister::Instance()
@@ -442,7 +488,7 @@
MString sParameters = sFile.substr( f+1 );
MVector< MString > vsParameters;
- SplitStrings( sParameters, vsParameters, ",", " ", 1, 1 );
+ SplitStrings( sParameters, vsParameters, ",;", " ", 2, 1 );
MAutoPtr< StateChange > s = StateChangeRegister::Instance().Create( sType, vsParameters );
if( s.Ptr() )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-03 08:49:53
|
Revision: 683
http://hgengine.svn.sourceforge.net/hgengine/?rev=683&view=rev
Author: cnlohr
Date: 2010-03-03 08:49:47 +0000 (Wed, 03 Mar 2010)
Log Message:
-----------
add option to allow camera free fly "freeFly=true/false"
Modified Paths:
--------------
Mercury2/src/Camera.cpp
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2010-03-02 03:24:08 UTC (rev 682)
+++ Mercury2/src/Camera.cpp 2010-03-03 08:49:47 UTC (rev 683)
@@ -10,7 +10,7 @@
REGISTER_NODE_TYPE(CameraNode);
CameraNode::CameraNode()
- :TransformNode(), m_x(0), m_y(0)
+ :TransformNode(), m_x(0), m_y(0), m_bFreeFly( false )
{
m_lookAt = MercuryVector(0,0,-1);
REGISTER_MESSAGE_WITH_DELEGATE( INPUTEVENT_MOUSE, &CameraNode::HandleMouseInput );
@@ -135,7 +135,8 @@
p += m_lookAt * a;
p += Xaxis * b;
// p.SetY(0); //lock to ground
-// SetPosition( p );
+ if( m_bFreeFly )
+ SetPosition( p );
m_origionalPosition = p;
TransformNode::Update( dTime );
@@ -155,12 +156,16 @@
SetPosition( m_origionalPosition );
TransformNode::SaveToXMLTag( sXMLStream );
SetPosition( OrigPos );
+ if( m_bFreeFly )
+ sXMLStream += ssprintf( "freeFly=\"%d\" ", m_bFreeFly );
}
void CameraNode::LoadFromXML(const XMLNode& node)
{
TransformNode::LoadFromXML( node );
m_origionalPosition = GetPosition();
+
+ LOAD_FROM_XML( "freeFly", m_bFreeFly, StrToBool );
POST_MESSAGE("QueryTerrainPoint", new VertexDataMessage(GetPosition()), 0.00001f);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-02 03:24:15
|
Revision: 682
http://hgengine.svn.sourceforge.net/hgengine/?rev=682&view=rev
Author: cnlohr
Date: 2010-03-02 03:24:08 +0000 (Tue, 02 Mar 2010)
Log Message:
-----------
allow obj2hgmdl to compile
Modified Paths:
--------------
Mercury2/src/MQuaternion.cpp
Mercury2/src/MQuaternion.h
Mercury2/src/MercuryVertex.cpp
Mercury2/src/MercuryVertex.h
Mercury2/tools/obj2hgmdl/Makefile
Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
Modified: Mercury2/src/MQuaternion.cpp
===================================================================
--- Mercury2/src/MQuaternion.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MQuaternion.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -1,7 +1,6 @@
#include <MQuaternion.h>
#include <MercuryMath.h>
#include <MercuryMatrix.h>
-#include <MercuryLog.h>
MQuaternion::MQuaternion()
{
@@ -264,9 +263,9 @@
return v;
}
-void MQuaternion::Print(const MString& s) const
+MString MQuaternion::Stringify(const MString& s) const
{
- LOG.Write( ssprintf("%s: %f %f %f %f", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]) );
+ return ssprintf("%s: %f %f %f %f", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]);
}
//Returns the Euclidian Inner Product of two MQuaternions (Similar to Vector Dot-Product)
Modified: Mercury2/src/MQuaternion.h
===================================================================
--- Mercury2/src/MQuaternion.h 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MQuaternion.h 2010-03-02 03:24:08 UTC (rev 682)
@@ -69,7 +69,7 @@
bool operator==(const MQuaternion &rhs) const;
inline bool operator!=(const MQuaternion &rhs) const { return !(*this == rhs); }
- void Print(const MString& s = "MQuaternion") const;
+ MString Stringify(const MString& s = "MQuaternion") const;
inline float& W() { return m_wxyz[0]; }
inline float& X() { return m_wxyz[1]; }
Modified: Mercury2/src/MercuryVertex.cpp
===================================================================
--- Mercury2/src/MercuryVertex.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MercuryVertex.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -2,7 +2,6 @@
#include <MercuryUtil.h>
#include <MercuryMath.h>
#include <MQuaternion.h>
-#include <MercuryLog.h>
#include <MercuryMatrix.h>
@@ -149,9 +148,9 @@
return GetX() + GetY() + GetZ() + GetW();
}
-void MercuryVertex::Print(const MString& s) const
+MString MercuryVertex::Stringify(const MString& s) const
{
- LOG.Write(ssprintf("%s: %f %f %f %f", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]));
+ return ssprintf("%s: %f %f %f %f", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]);
}
MercuryVertex MercuryVertex::Rotate(const MQuaternion& q) const
Modified: Mercury2/src/MercuryVertex.h
===================================================================
--- Mercury2/src/MercuryVertex.h 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MercuryVertex.h 2010-03-02 03:24:08 UTC (rev 682)
@@ -88,7 +88,7 @@
float DotProduct(const MercuryVertex& rhs) const;
MercuryVertex DotProduct3(const MercuryVertex& rhs1, const MercuryVertex& rhs2, const MercuryVertex& rhs3) const;
- void Print(const MString& s = "Vertex") const;
+ MString Stringify(const MString& s = "Vertex") const;
MercuryVertex Rotate(const MQuaternion& q) const;
Modified: Mercury2/tools/obj2hgmdl/Makefile
===================================================================
--- Mercury2/tools/obj2hgmdl/Makefile 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/tools/obj2hgmdl/Makefile 2010-03-02 03:24:08 UTC (rev 682)
@@ -1,2 +1,2 @@
all:
- g++ obj2hgmdl.cpp ../../src/MQuaternion.cpp ../../src/MercuryVertex.cpp -I../../src -I../.. -DHGENGINE -g -o obj2hgmdl
+ g++ obj2hgmdl.cpp ../../src/MQuaternion.cpp ../../src/MercuryVertex.cpp ../../src/MercuryString.cpp -I../../src -I../.. -DHGENGINE -g -o obj2hgmdl
Modified: Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
===================================================================
--- Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -5,6 +5,7 @@
#include <MercuryVertex.h>
#include <map>
#include <math.h>
+#include <stdlib.h>
using namespace std;
@@ -85,7 +86,8 @@
bool found = false;
tv[i].position = v[ iv[i]-1 ];
tv[i].normal = vn[ ivn[i]-1 ];
- tv[i].uv = vt[ ivt[i]-1 ];
+ if( vt.size() > ivt[i]-1 )
+ tv[i].uv = vt[ ivt[i]-1 ];
for (unsigned long j = 0; j < vertice.size(); ++j)
{
@@ -181,6 +183,12 @@
FILE *mbmf;
ifstream obj;
+ if( argc != 3 )
+ {
+ fprintf( stderr, "Usage: %s [OBJ File] [HGMDL File]\n", argv[0] );
+ exit( -1 );
+ }
+
obj.open(argv[1]);
mbmf = fopen(argv[2], "wb");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-03-02 02:00:22
|
Revision: 681
http://hgengine.svn.sourceforge.net/hgengine/?rev=681&view=rev
Author: cnlohr
Date: 2010-03-02 02:00:15 +0000 (Tue, 02 Mar 2010)
Log Message:
-----------
Temporarily? remove the multitexture stuff that seems to be breaking things. It does appear as though multitextures works without this.
Modified Paths:
--------------
Mercury2/src/Texture.cpp
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2010-02-24 05:40:25 UTC (rev 680)
+++ Mercury2/src/Texture.cpp 2010-03-02 02:00:15 UTC (rev 681)
@@ -203,7 +203,7 @@
void Texture::Activate(uint32_t textureResource)
{
GLCALL( glActiveTexture( textureResource ) );
- GLCALL( glClientActiveTextureARB(textureResource) ); //XXX: Note to self, this seems to be causing a crash, look into it.
+// GLCALL( glClientActiveTextureARB(textureResource) ); //XXX: Note to self, this seems to be causing a crash, look into it.
GLCALL( glEnableClientState(GL_TEXTURE_COORD_ARRAY) );
GLCALL( glEnable( GL_TEXTURE_2D ) );
}
@@ -211,7 +211,7 @@
void Texture::Deactivate(uint32_t textureResource)
{
GLCALL( glActiveTexture( textureResource ) );
- GLCALL( glClientActiveTextureARB(textureResource) );
+// GLCALL( glClientActiveTextureARB(textureResource) );
GLCALL( glDisableClientState(GL_TEXTURE_COORD_ARRAY) );
GLCALL( glDisable( GL_TEXTURE_2D ) );
GLERRORCHECK;
@@ -222,7 +222,7 @@
for (uint8_t i = 0; i < m_numActiveTextures; ++i)
{
GLCALL( glActiveTexture( GL_TEXTURE0+i ) );
- GLCALL( glClientActiveTextureARB(GL_TEXTURE0+i) ); //XXX: Note to self, this seems to be causing a crash, look into it.
+// GLCALL( glClientActiveTextureARB(GL_TEXTURE0+i) ); //XXX: Note to self, this seems to be causing a crash, look into it.
GLCALL( glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(uvByteOffset)) );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-24 05:40:31
|
Revision: 680
http://hgengine.svn.sourceforge.net/hgengine/?rev=680&view=rev
Author: cnlohr
Date: 2010-02-24 05:40:25 +0000 (Wed, 24 Feb 2010)
Log Message:
-----------
forgot to add some stuff :(
Added Paths:
-----------
Mercury2/modules/Skybox.cpp
Mercury2/modules/Skybox.h
Added: Mercury2/modules/Skybox.cpp
===================================================================
--- Mercury2/modules/Skybox.cpp (rev 0)
+++ Mercury2/modules/Skybox.cpp 2010-02-24 05:40:25 UTC (rev 680)
@@ -0,0 +1,72 @@
+#include "Skybox.h"
+#include <Camera.h>
+#include <MercuryMessageManager.h>
+
+REGISTER_NODE_TYPE(Skybox);
+
+Skybox::Skybox()
+ :TransformNode(), m_bFirst(true)
+{
+ REGISTER_MESSAGE_WITH_DELEGATE( "SetCameraPosition", &Skybox::SetCameraPosition );
+}
+
+Skybox::~Skybox()
+{
+ UNREGISTER_FOR_MESSAGE( "SetCameraPosition" );
+}
+
+
+void Skybox::SetCameraPosition(const MessageData& data)
+{
+ const VertexDataMessage& m( dynamic_cast<const VertexDataMessage&>( data ) );
+
+ if( !m_bFirst )
+ SetPosition(m.Vertex);
+}
+
+void Skybox::RecursivePreRender()
+{
+/* CameraNode * cn = CameraNode::GetLastPreRenderedCamera();
+ if( cn )
+ {
+ const MercuryVertex& cp = cn->GetPosition();
+ cn->ComputeMatrix();
+ SetPosition( cp );
+ ComputeMatrix();
+ }
+*/
+ TransformNode::RecursivePreRender( );
+ m_bFirst = false;
+}
+
+/****************************************************************************
+ * Copyright (C) 2010 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/modules/Skybox.h
===================================================================
--- Mercury2/modules/Skybox.h (rev 0)
+++ Mercury2/modules/Skybox.h 2010-02-24 05:40:25 UTC (rev 680)
@@ -0,0 +1,54 @@
+#ifndef Skybox_H
+#define Skybox_H
+
+#include <TransformNode.h>
+
+class Skybox : public TransformNode
+{
+public:
+ Skybox();
+ ~Skybox();
+ virtual void RecursivePreRender();
+
+ void SetCameraPosition(const MessageData& data);
+
+ GENRTTI(Skybox);
+private:
+ bool m_bFirst;
+};
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2010 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...> - 2010-02-23 22:04:19
|
Revision: 679
http://hgengine.svn.sourceforge.net/hgengine/?rev=679&view=rev
Author: cnlohr
Date: 2010-02-23 22:04:13 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
tweak - avoid some memory leak junks
Modified Paths:
--------------
Mercury2/src/MercurySound.cpp
Mercury2/src/MercurySound.h
Mercury2/src/MercurySoundDriverALSA.cpp
Modified: Mercury2/src/MercurySound.cpp
===================================================================
--- Mercury2/src/MercurySound.cpp 2010-02-23 20:46:06 UTC (rev 678)
+++ Mercury2/src/MercurySound.cpp 2010-02-23 22:04:13 UTC (rev 679)
@@ -24,6 +24,16 @@
return tm;
}
+MercurySoundManager::~MercurySoundManager()
+{
+ if( m_SoundDriver )
+ {
+ m_SoundDriver->Close();
+ SAFE_DELETE( m_SoundDriver );
+ }
+}
+
+
void MercurySoundManager::Init( const MString & sParameters )
{
MercurySoundDriverConstructionPair * dBest = 0;
@@ -54,7 +64,7 @@
//Otherwise something went wrong.
m_SoundDriver->Close();
- delete m_SoundDriver;
+ SAFE_DELETE( m_SoundDriver );
scBlacklist.insert( dBest );
} while( true );
Modified: Mercury2/src/MercurySound.h
===================================================================
--- Mercury2/src/MercurySound.h 2010-02-23 20:46:06 UTC (rev 678)
+++ Mercury2/src/MercurySound.h 2010-02-23 22:04:13 UTC (rev 679)
@@ -60,6 +60,7 @@
{
public:
MercurySoundManager() { }
+ ~MercurySoundManager();
static MercurySoundManager * Instance();
Modified: Mercury2/src/MercurySoundDriverALSA.cpp
===================================================================
--- Mercury2/src/MercurySoundDriverALSA.cpp 2010-02-23 20:46:06 UTC (rev 678)
+++ Mercury2/src/MercurySoundDriverALSA.cpp 2010-02-23 22:04:13 UTC (rev 679)
@@ -138,7 +138,9 @@
{
tPlayback.Halt( true );
if( playback_handle )
+ {
snd_pcm_close (playback_handle);
+ }
}
void * MercurySoundDriverALSA::playback_thread( void * )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 20:46:12
|
Revision: 678
http://hgengine.svn.sourceforge.net/hgengine/?rev=678&view=rev
Author: cnlohr
Date: 2010-02-23 20:46:06 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
crepsular
Modified Paths:
--------------
Mercury2/Themes/default/File/ssvgr.xml
Mercury2/Themes/default/Graphic/Crepuscular.frag
Mercury2/Themes/default/Graphic/Crepuscular.vert
Modified: Mercury2/Themes/default/File/ssvgr.xml
===================================================================
--- Mercury2/Themes/default/File/ssvgr.xml 2010-02-23 08:44:43 UTC (rev 677)
+++ Mercury2/Themes/default/File/ssvgr.xml 2010-02-23 20:46:06 UTC (rev 678)
@@ -27,20 +27,22 @@
<node type="orthographic" left="-.5" right=".5" top=".5" bottom="-.5" near="1" far="-1" name="Ortho" setPasses="7" >
- <asset type="StateChanger" file="LightingSwitch:0"/>
- <asset type="StateChanger" file="DepthTest:0"/>
- <asset type="shader" file="GRAPHIC:Crepuscular"/>
- <node type="transformnode" >
- <asset type="texture" file="FBOB_0" dynamic="true"/>
- <asset type="texture" file="FBOA_0" dynamic="true"/>
- <asset type="quad" />
+ <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera" >
+ <asset type="StateChanger" file="LightingSwitch:0"/>
+ <asset type="StateChanger" file="DepthTest:0"/>
+ <asset type="shader" file="GRAPHIC:Crepuscular"/>
+ <node type="transformnode" >
+ <asset type="texture" file="FBOB_0" dynamic="true"/>
+ <asset type="texture" file="FBOA_0" dynamic="true"/>
+ <asset type="quad" />
+ </node>
</node>
</node>
<!-- Below here is just a library for some junk we can throw in -->
<node type="mercurynode" name="lampForest" setPasses="0" >
- <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
+ <node type="transformnode" movz="-5" movx="0" movy="2" name="lamprow" >
<node type="mercurynode" name="lamp" >
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
Modified: Mercury2/Themes/default/Graphic/Crepuscular.frag
===================================================================
--- Mercury2/Themes/default/Graphic/Crepuscular.frag 2010-02-23 08:44:43 UTC (rev 677)
+++ Mercury2/Themes/default/Graphic/Crepuscular.frag 2010-02-23 20:46:06 UTC (rev 678)
@@ -4,16 +4,18 @@
varying vec3 normal;
varying vec3 pos;
-varying float dist;
+varying vec3 posn;
+varying vec3 tlipos;
void main()
{
- float fbrgt = 0.1;
+ vec3 rLpos = normalize(tlipos - posn);
+ float fbrgt = .7;
vec2 sspos = gl_TexCoord[0].xy;
- for( int i = 0; i < 100; i++ )
+ for( int i = 0; i < 50; i++ )
{
vec4 SW = texture2D( HG_Texture1, sspos );
- sspos += 0.001;
+ sspos += rLpos.xy * 0.005;
sspos = clamp( sspos, vec2( 0. ), vec2( .99 ) );
if( SW.a < 0.5 ) fbrgt += 0.01;
}
Modified: Mercury2/Themes/default/Graphic/Crepuscular.vert
===================================================================
--- Mercury2/Themes/default/Graphic/Crepuscular.vert 2010-02-23 08:44:43 UTC (rev 677)
+++ Mercury2/Themes/default/Graphic/Crepuscular.vert 2010-02-23 20:46:06 UTC (rev 678)
@@ -1,21 +1,25 @@
uniform vec4 HG_EyePos;
uniform mat4 HG_ModelMatrix;
uniform vec4 HG_DepthRange;
+
+
varying vec3 normal;
varying vec3 pos;
-varying float dist;
+varying vec3 posn;
+varying vec3 tlipos;
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = ftransform();
+ gl_Position = gl_Vertex * vec4( 2., 2., 1., 1. );
- vec4 n = vec4(gl_Normal, 0);
+ vec4 n = vec4(gl_Normal, 0.);
//viewspace normal
normal = (gl_ModelViewMatrix * n).xyz;
//clip space depth
pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- dist = pos.z;
+ posn = (gl_ModelViewMatrix * vec4( gl_Vertex.xy*2., 2.2, 0.0 ) ).xyz;
+ tlipos = (gl_ModelViewMatrix * normalize(vec4( .8, .4, .7, 0.0 )) ).xyz;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 08:44:49
|
Revision: 677
http://hgengine.svn.sourceforge.net/hgengine/?rev=677&view=rev
Author: cnlohr
Date: 2010-02-23 08:44:43 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
whoops forgot the shader
Added Paths:
-----------
Mercury2/Themes/default/Graphic/Crepuscular.frag
Mercury2/Themes/default/Graphic/Crepuscular.vert
Added: Mercury2/Themes/default/Graphic/Crepuscular.frag
===================================================================
--- Mercury2/Themes/default/Graphic/Crepuscular.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/Crepuscular.frag 2010-02-23 08:44:43 UTC (rev 677)
@@ -0,0 +1,24 @@
+uniform vec4 HG_DepthRange;
+uniform sampler2D HG_Texture0;
+uniform sampler2D HG_Texture1;
+
+varying vec3 normal;
+varying vec3 pos;
+varying float dist;
+
+void main()
+{
+ float fbrgt = 0.1;
+ vec2 sspos = gl_TexCoord[0].xy;
+ for( int i = 0; i < 100; i++ )
+ {
+ vec4 SW = texture2D( HG_Texture1, sspos );
+ sspos += 0.001;
+ sspos = clamp( sspos, vec2( 0. ), vec2( .99 ) );
+ if( SW.a < 0.5 ) fbrgt += 0.01;
+ }
+
+ vec4 IM = texture2D( HG_Texture0, gl_TexCoord[0].xy );
+ gl_FragColor = IM * fbrgt;
+}
+
Added: Mercury2/Themes/default/Graphic/Crepuscular.vert
===================================================================
--- Mercury2/Themes/default/Graphic/Crepuscular.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/Crepuscular.vert 2010-02-23 08:44:43 UTC (rev 677)
@@ -0,0 +1,21 @@
+uniform vec4 HG_EyePos;
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange;
+varying vec3 normal;
+varying vec3 pos;
+varying float dist;
+
+void main()
+{
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+
+ vec4 n = vec4(gl_Normal, 0);
+
+ //viewspace normal
+ normal = (gl_ModelViewMatrix * n).xyz;
+
+ //clip space depth
+ pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
+ dist = pos.z;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 08:44:30
|
Revision: 676
http://hgengine.svn.sourceforge.net/hgengine/?rev=676&view=rev
Author: cnlohr
Date: 2010-02-23 08:44:24 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
Wooh! Fix up cleaning up after messages, get some of the C-rays working.
Modified Paths:
--------------
Mercury2/Themes/default/File/ssvgr.xml
Mercury2/modules/Makefile
Mercury2/modules.xml
Mercury2/src/Camera.cpp
Mercury2/src/Camera.h
Mercury2/src/MercuryMessageManager.h
Mercury2/src/Texture.cpp
Modified: Mercury2/Themes/default/File/ssvgr.xml
===================================================================
--- Mercury2/Themes/default/File/ssvgr.xml 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/Themes/default/File/ssvgr.xml 2010-02-23 08:44:24 UTC (rev 676)
@@ -1,34 +1,42 @@
-<SceneGraph name="root" setPasses="6+7" >
+<SceneGraph name="root" setPasses="5+6+7" >
<!--We have to put all states that are the generic state up here. This way, the states will fall back to these -->
<asset type="StateChanger" file="ColorChange:1,1,1,1"/>
- <asset type="StateChanger" file="DepthTest:1"/>
+ <asset type="StateChanger" file="DepthTest:1" setPasses="5+6+7" />
<asset type="StateChanger" file="LightingSwitch:0" enduring="1" />
- <asset type="StateChanger" file="DepthWrite:1"/>
+ <asset type="StateChanger" file="DepthWrite:1" setPasses="5+6+7" />
<asset type="StateChanger" file="FaceCulling:none"/>
<asset type="StateChanger" file="BlendFunc:SRC_ALPHA,ONE_MINUS_SRC_ALPHA" />
<asset type="StateChanger" file="AlphaFunc:GREATER,0.5" /> <!-- makes alpha ordering not matter, since it's all or nothing -->
- <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp" >
+ <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp" setPasses="5+6+7" >
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera" >
- <node fallback="root.ground" setPasses="7" />
- <node type="transformnode" movy="2" >
- <node fallback="root.lampForest" setPasses="6" />
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="FBOA" colorbyte0="RGBA" usescreensize="true" setPasses="5" >
+ <node fallback="root.lampForest" setPasses="5" />
</node>
- <node type="transformnode" movy="0" >
- <node fallback="root.lampForest" setPasses="7" />
- </node>
- <node type="transformnode" movz="-5" >
- <asset type="texture" file="GRAPHIC:2by.png" filter="none" />
- <asset type="quad" />
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="FBOB" colorbyte0="RGBA" usescreensize="true" setPasses="6" >
+ <node fallback="root.skybox" setPasses="6" />
+ <node fallback="root.ground" setPasses="6" />
+ <node fallback="root.lampForest" setPasses="6" />
</node>
+ </node>
+ </node>
+
+
+ <node type="orthographic" left="-.5" right=".5" top=".5" bottom="-.5" near="1" far="-1" name="Ortho" setPasses="7" >
+ <asset type="StateChanger" file="LightingSwitch:0"/>
+ <asset type="StateChanger" file="DepthTest:0"/>
+ <asset type="shader" file="GRAPHIC:Crepuscular"/>
+ <node type="transformnode" >
+ <asset type="texture" file="FBOB_0" dynamic="true"/>
+ <asset type="texture" file="FBOA_0" dynamic="true"/>
+ <asset type="quad" />
</node>
</node>
-
<!-- Below here is just a library for some junk we can throw in -->
<node type="mercurynode" name="lampForest" setPasses="0" >
@@ -58,4 +66,35 @@
<asset type="terrain" file="MODEL:map.hgmdl" />
</node>
+ <node type="Skybox" name="skybox" setPasses="0" >
+ <asset type="StateChanger" file="DepthTest:0"/>
+ <asset type="StateChanger" file="LightingSwitch:0" />
+ <asset type="StateChanger" file="DepthWrite:0"/>
+
+ <node type="transformnode" movx=".5" rotx="-180" roty="-270" >
+ <asset type="texture" file="MODEL:Skybox/neg_x.png" />
+ <asset type="quad" />
+ </node>
+ <node type="transformnode" movy="-.5" rotx="-90" rotz="270" scaley="-1" >
+ <asset type="texture" file="MODEL:Skybox/neg_y.png" />
+ <asset type="quad" />
+ </node>
+ <node type="transformnode" movz="-.5" rotx="-180" >
+ <asset type="texture" file="MODEL:Skybox/neg_z.png" />
+ <asset type="quad" />
+ </node>
+ <node type="transformnode" movx="-.5" rotx="-180" roty="-270" scalex="-1" >
+ <asset type="texture" file="MODEL:Skybox/pos_x.png" />
+ <asset type="quad" />
+ </node>
+ <node type="transformnode" movy=".5" rotx="-90" rotz="270" >
+ <asset type="texture" file="MODEL:Skybox/pos_y.png" />
+ <asset type="quad" />
+ </node>
+ <node type="transformnode" movz=".5" rotx="-180" scalex="-1" >
+ <asset type="texture" file="MODEL:Skybox/pos_z.png" />
+ <asset type="quad" />
+ </node>
+ </node>
+
</SceneGraph>
Modified: Mercury2/modules/Makefile
===================================================================
--- Mercury2/modules/Makefile 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/modules/Makefile 2010-02-23 08:44:24 UTC (rev 676)
@@ -2,7 +2,7 @@
CXXFLAGS=${CFLAGS}
LDFLAGS=-shared
-all : BillboardNode.so TextNode.so Terrain.so TextPlate.so ParticleEmitter.so Cu2.so
+all : BillboardNode.so TextNode.so Terrain.so TextPlate.so ParticleEmitter.so Cu2.so Skybox.so
clean :
rm -rf *~ *.o *.so
Modified: Mercury2/modules.xml
===================================================================
--- Mercury2/modules.xml 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/modules.xml 2010-02-23 08:44:24 UTC (rev 676)
@@ -5,4 +5,5 @@
<Module src="modules/TextPlate.cpp" obj="modules/TextPlate" func="InstallTextPlate" class="TextPlate"/>
<Module src="modules/ParticleEmitter.cpp" obj="modules/ParticleEmitter" func="InstallParticleEmitter" class="ParticleEmitter"/>
<Module src="modules/Cu2.cpp" obj="modules/Cu2" func="InstallCu2Element" class="Cu2Element"/>
+ <Module src="modules/Skybox.cpp" obj="modules/Skybox" func="InstallSkybox" class="Skybox"/>
</Modules>
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/src/Camera.cpp 2010-02-23 08:44:24 UTC (rev 676)
@@ -17,6 +17,12 @@
REGISTER_MESSAGE_WITH_DELEGATE( "SetCameraPosition", &CameraNode::SetCameraPosition );
}
+CameraNode::~CameraNode()
+{
+ UNREGISTER_FOR_MESSAGE( INPUTEVENT_MOUSE );
+ UNREGISTER_FOR_MESSAGE( "SetCameraPosition" );
+}
+
void CameraNode::PreRender(const MercuryMatrix& matrix)
{
VIEWMATRIX = m_viewMatrix;
Modified: Mercury2/src/Camera.h
===================================================================
--- Mercury2/src/Camera.h 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/src/Camera.h 2010-02-23 08:44:24 UTC (rev 676)
@@ -9,6 +9,7 @@
{
public:
CameraNode();
+ ~CameraNode();
virtual void ComputeMatrix();
virtual void HandleMouseInput(const MessageData& data);
virtual void Update(float dTime);
Modified: Mercury2/src/MercuryMessageManager.h
===================================================================
--- Mercury2/src/MercuryMessageManager.h 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/src/MercuryMessageManager.h 2010-02-23 08:44:24 UTC (rev 676)
@@ -34,7 +34,7 @@
class MercuryMessageManager
{
public:
- MercuryMessageManager() : m_messageQueue( MessageHolder::Compare ) { }
+ MercuryMessageManager() : m_messageQueue( MessageHolder::Compare ), m_currTime(0) { }
///Dispatch message whenever the message manager gets control again; delay after now.
void PostMessage(const MString& message, MessageData* data, float delay);
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2010-02-23 07:39:14 UTC (rev 675)
+++ Mercury2/src/Texture.cpp 2010-02-23 08:44:24 UTC (rev 676)
@@ -203,7 +203,7 @@
void Texture::Activate(uint32_t textureResource)
{
GLCALL( glActiveTexture( textureResource ) );
- GLCALL( glClientActiveTextureARB(textureResource) );
+ GLCALL( glClientActiveTextureARB(textureResource) ); //XXX: Note to self, this seems to be causing a crash, look into it.
GLCALL( glEnableClientState(GL_TEXTURE_COORD_ARRAY) );
GLCALL( glEnable( GL_TEXTURE_2D ) );
}
@@ -222,7 +222,7 @@
for (uint8_t i = 0; i < m_numActiveTextures; ++i)
{
GLCALL( glActiveTexture( GL_TEXTURE0+i ) );
- GLCALL( glClientActiveTextureARB(GL_TEXTURE0+i) );
+ GLCALL( glClientActiveTextureARB(GL_TEXTURE0+i) ); //XXX: Note to self, this seems to be causing a crash, look into it.
GLCALL( glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(uvByteOffset)) );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 07:39:20
|
Revision: 675
http://hgengine.svn.sourceforge.net/hgengine/?rev=675&view=rev
Author: cnlohr
Date: 2010-02-23 07:39:14 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
whoops! Forgot to initialize values
Modified Paths:
--------------
Mercury2/src/StateChanger.cpp
Modified: Mercury2/src/StateChanger.cpp
===================================================================
--- Mercury2/src/StateChanger.cpp 2010-02-23 05:53:27 UTC (rev 674)
+++ Mercury2/src/StateChanger.cpp 2010-02-23 07:39:14 UTC (rev 675)
@@ -375,7 +375,7 @@
REGISTER_ASSET_TYPE(StateChanger);
StateChanger::StateChanger( const MString & key, bool bInstanced )
- :MercuryAsset( key, bInstanced )
+ :MercuryAsset( key, bInstanced ), m_isEnduring(0)
{
//Make sure our state stack is correctly sized
if( m_StateSet.size() < (unsigned)StateChangeRegister::Instance().GetStateCount() )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 05:53:33
|
Revision: 674
http://hgengine.svn.sourceforge.net/hgengine/?rev=674&view=rev
Author: cnlohr
Date: 2010-02-23 05:53:27 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
add some stuff for ssvgr
Modified Paths:
--------------
Mercury2/src/StateChanger.cpp
Added Paths:
-----------
Mercury2/Themes/default/File/ssvgr.xml
Mercury2/Themes/default/Graphic/2by.png
Added: Mercury2/Themes/default/File/ssvgr.xml
===================================================================
--- Mercury2/Themes/default/File/ssvgr.xml (rev 0)
+++ Mercury2/Themes/default/File/ssvgr.xml 2010-02-23 05:53:27 UTC (rev 674)
@@ -0,0 +1,61 @@
+<SceneGraph name="root" setPasses="6+7" >
+ <!--We have to put all states that are the generic state up here. This way, the states will fall back to these -->
+ <asset type="StateChanger" file="ColorChange:1,1,1,1"/>
+ <asset type="StateChanger" file="DepthTest:1"/>
+ <asset type="StateChanger" file="LightingSwitch:0" enduring="1" />
+ <asset type="StateChanger" file="DepthWrite:1"/>
+ <asset type="StateChanger" file="FaceCulling:none"/>
+ <asset type="StateChanger" file="BlendFunc:SRC_ALPHA,ONE_MINUS_SRC_ALPHA" />
+ <asset type="StateChanger" file="AlphaFunc:GREATER,0.5" /> <!-- makes alpha ordering not matter, since it's all or nothing -->
+
+ <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 fallback="root.ground" setPasses="7" />
+
+ <node type="transformnode" movy="2" >
+ <node fallback="root.lampForest" setPasses="6" />
+ </node>
+ <node type="transformnode" movy="0" >
+ <node fallback="root.lampForest" setPasses="7" />
+ </node>
+
+ <node type="transformnode" movz="-5" >
+ <asset type="texture" file="GRAPHIC:2by.png" filter="none" />
+ <asset type="quad" />
+ </node>
+
+ </node>
+ </node>
+
+
+ <!-- Below here is just a library for some junk we can throw in -->
+
+ <node type="mercurynode" name="lampForest" setPasses="0" >
+ <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>
+ <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 type="transformnode" rotx="-90" movz="-10" movx="0" movy="-0.99" setPasses="0" name="ground" >
+ <asset type="texture" file="MODEL:map.png" />
+ <asset type="terrain" file="MODEL:map.hgmdl" />
+ </node>
+
+</SceneGraph>
Added: Mercury2/Themes/default/Graphic/2by.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/Themes/default/Graphic/2by.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: Mercury2/src/StateChanger.cpp
===================================================================
--- Mercury2/src/StateChanger.cpp 2010-02-23 02:19:18 UTC (rev 673)
+++ Mercury2/src/StateChanger.cpp 2010-02-23 05:53:27 UTC (rev 674)
@@ -150,6 +150,52 @@
REGISTER_STATECHANGE( DepthWrite );
+class FaceCulling : public StateChange
+{
+public:
+ FaceCulling( const MVector< MString > & sParameters ) : StateChange( sParameters )
+ {
+ if( sParameters.size() < 1 )
+ {
+ LOG.Write( ssprintf( "Error: DepthWrite state has invalid number of parameters(%d).", sParameters.size() ) );
+ return;
+ }
+ if( sParameters[0].compare( "front" ) == 0 )
+ iWhich = 1;
+ if( sParameters[0].compare( "back" ) == 0 )
+ iWhich = 2;
+ else
+ iWhich = 0;
+ }
+
+ void Stringify( MString & sOut )
+ {
+ sOut = (iWhich)?((iWhich==1)?"front":"back"):"";
+ }
+
+ void Activate()
+ {
+ if( iWhich )
+ {
+ GLCALL( glEnable(GL_CULL_FACE) );
+ if( iWhich == 1 )
+ {GLCALL( glCullFace(GL_FRONT) );}
+ else
+ {GLCALL( glCullFace(GL_BACK) );}
+ }
+ else
+ {
+ GLCALL( glDisable(GL_CULL_FACE) );
+ }
+ }
+
+ STATECHANGE_RTTI( FaceCulling );
+ int iWhich;
+};
+
+REGISTER_STATECHANGE( FaceCulling );
+
+
class BlendFunc : public StateChange
{
public:
@@ -225,6 +271,69 @@
REGISTER_STATECHANGE( BlendFunc );
+class AlphaFunc : public StateChange
+{
+public:
+ AlphaFunc( const MVector< MString > & sParameters ) : StateChange( sParameters )
+ {
+ if( sParameters.size() < 2 )
+ {
+ LOG.Write( ssprintf( "Error: AlphaFunc state has invalid number of parameters(%d).", sParameters.size() ) );
+ return;
+ }
+
+ m_func = StrToAlpha(sParameters[0] );
+ m_ref = StrToFloat(sParameters[1] );
+ }
+
+ void Stringify( MString & sOut )
+ {
+ sOut = AlphaToStr(m_func) + ssprintf( ",%f", m_ref );
+ }
+
+ #define STRTOGL(x,s) if (x==#s) return GL_##s;
+ int StrToAlpha(const MString& s)
+ {
+ STRTOGL(s, NEVER);
+ STRTOGL(s, LESS);
+ STRTOGL(s, EQUAL);
+ STRTOGL(s, LEQUAL);
+ STRTOGL(s, GREATER);
+ STRTOGL(s, NOTEQUAL);
+ STRTOGL(s, GEQUAL);
+ STRTOGL(s, ALWAYS);
+ return -1;
+ }
+
+ #define GLTOSTR(x,s) case GL_##s: return #s;
+ MString AlphaToStr(int blend)
+ {
+ switch (blend)
+ {
+ GLTOSTR(blend, NEVER);
+ GLTOSTR(blend, LESS);
+ GLTOSTR(blend, EQUAL);
+ GLTOSTR(blend, LEQUAL);
+ GLTOSTR(blend, GREATER);
+ GLTOSTR(blend, NOTEQUAL);
+ GLTOSTR(blend, GEQUAL);
+ GLTOSTR(blend, ALWAYS);
+ };
+ }
+
+ void Activate()
+ {
+ GLCALL( glEnable( GL_ALPHA_TEST ) );
+ GLCALL( glAlphaFunc(m_func,m_ref) );
+ }
+
+ STATECHANGE_RTTI( AlphaFunc );
+ int m_func;
+ float m_ref;
+};
+
+REGISTER_STATECHANGE( AlphaFunc );
+
//////////////////////////////////////STATE CHANGE CHUNK//////////////////////////////////////
StateChangeRegister & StateChangeRegister::Instance()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2010-02-23 02:19:24
|
Revision: 673
http://hgengine.svn.sourceforge.net/hgengine/?rev=673&view=rev
Author: cnlohr
Date: 2010-02-23 02:19:18 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
tweak passes and add endurance mode to the assets, so that you can have things that just /stay/ on.
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/StateChanger.cpp
Mercury2/src/StateChanger.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/MercuryNode.cpp 2010-02-23 02:19:18 UTC (rev 673)
@@ -223,7 +223,7 @@
{
#ifdef WRITE_OUT_RENDERGARPH
static int depth;
- if ( IsHidden() || IsCulled() || (! (m_iPasses & (1<<g_iPass))) )
+ if ( IsHidden() || IsCulled() || ((! (m_iPasses & (1<<g_iPass))) && m_iForcePasses ) )
{
printf( "x%*c %p:%s (%d %d %d)\n", depth, 0, this, GetName().c_str(), IsHidden(), IsCulled(), (! (m_iPasses & (1<<g_iPass))) );
return;
@@ -231,7 +231,7 @@
printf( "1%*c %p:%s\n", depth, 0, this, GetName().c_str() );
depth++;
#else
- if ( IsHidden() || IsCulled() || (! (m_iPasses & (1<<g_iPass))) )
+ if ( IsHidden() || IsCulled() || ((! (m_iPasses & (1<<g_iPass))) && m_iForcePasses ) )
return;
#endif
Modified: Mercury2/src/StateChanger.cpp
===================================================================
--- Mercury2/src/StateChanger.cpp 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/StateChanger.cpp 2010-02-23 02:19:18 UTC (rev 673)
@@ -285,27 +285,29 @@
{
MAutoPtr< StateChange > & k = m_vStates[i];
k->Activate();
- m_StateSet[k->sID].push_back( k );
+ if( !m_isEnduring )
+ m_StateSet[k->sID].push_back( k );
}
}
void StateChanger::PostRender(const MercuryNode* node)
{
- for( unsigned i = 0; i < m_vStates.size(); i++ )
- {
- MAutoPtr< StateChange > & k = m_vStates[i];
- MVector< MAutoPtr< StateChange > > & l = m_StateSet[k->sID];
+ if( !m_isEnduring )
+ for( unsigned i = 0; i < m_vStates.size(); i++ )
+ {
+ MAutoPtr< StateChange > & k = m_vStates[i];
+ MVector< MAutoPtr< StateChange > > & l = m_StateSet[k->sID];
- unsigned ilpos = l.size() - 1;
+ unsigned ilpos = l.size() - 1;
- if( ilpos <= 0 )
- continue;
+ if( ilpos <= 0 )
+ continue;
- l.resize( ilpos-- );
+ l.resize( ilpos-- );
- if( ilpos >= 0 )
- l[ilpos]->Activate();
- }
+ if( ilpos >= 0 )
+ l[ilpos]->Activate();
+ }
}
bool StateChanger::ChangeKey( const MString & sFile )
@@ -353,6 +355,8 @@
MString sFile = node.Attribute("file");
ChangeKey( sFile );
}
+
+ LOAD_FROM_XML( "enduring", m_isEnduring, StrToBool );
}
void StateChanger::SaveToXMLTag( MString & sXMLStream )
@@ -364,6 +368,9 @@
sXMLStream += "file=\"" + sStr + "\" ";
}
+ if( m_isEnduring )
+ sXMLStream += "enduring=\"1\" ";
+
MercuryAsset::SaveToXMLTag( sXMLStream );
}
Modified: Mercury2/src/StateChanger.h
===================================================================
--- Mercury2/src/StateChanger.h 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/StateChanger.h 2010-02-23 02:19:18 UTC (rev 673)
@@ -69,6 +69,7 @@
virtual bool CheckForNewer() { return false; }
virtual void Reload() {};
private:
+ bool m_isEnduring; //If set, then, it does not get "undone" when going back up stack. 90% of all assets should set this to 0
MVector< MAutoPtr< StateChange > > m_vStates;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-02-23 01:08:48
|
Revision: 672
http://hgengine.svn.sourceforge.net/hgengine/?rev=672&view=rev
Author: axlecrusher
Date: 2010-02-23 01:08:42 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
terrain vertices need to load 3 vertices from the file and w needs to be 0.
not load 4 (xyzw) from the file, this will read outside the array
Modified Paths:
--------------
Mercury2/modules/Terrain.cpp
Modified: Mercury2/modules/Terrain.cpp
===================================================================
--- Mercury2/modules/Terrain.cpp 2010-01-18 13:26:25 UTC (rev 671)
+++ Mercury2/modules/Terrain.cpp 2010-02-23 01:08:42 UTC (rev 672)
@@ -15,8 +15,8 @@
void Terrain::LoadedCallback()
{
+ BuildHash();
base::LoadedCallback();
- BuildHash();
}
void Terrain::BuildHash()
@@ -60,9 +60,9 @@
for(uint16_t i = 0; i < length; i+=3)
{
- MercuryVertex v1(vertice+(indice[i]*HGMDLMesh::STRIDE));
- MercuryVertex v2(vertice+(indice[i+1]*HGMDLMesh::STRIDE));
- MercuryVertex v3(vertice+(indice[i+2]*HGMDLMesh::STRIDE));
+ MercuryVertex v1(vertice+(indice[i]*HGMDLMesh::STRIDE), 0);
+ MercuryVertex v2(vertice+(indice[i+1]*HGMDLMesh::STRIDE), 0);
+ MercuryVertex v3(vertice+(indice[i+2]*HGMDLMesh::STRIDE), 0);
MTriangle t( v1, v2, v3 );
m_hash.Insert( v1.GetX(), v1.GetY(), v1.GetZ(), t );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-01-18 13:26:39
|
Revision: 671
http://hgengine.svn.sourceforge.net/hgengine/?rev=671&view=rev
Author: axlecrusher
Date: 2010-01-18 13:26:25 +0000 (Mon, 18 Jan 2010)
Log Message:
-----------
fix windows mutex unlock
Modified Paths:
--------------
Mercury2/src/MercuryThreads.cpp
Modified: Mercury2/src/MercuryThreads.cpp
===================================================================
--- Mercury2/src/MercuryThreads.cpp 2010-01-17 02:36:11 UTC (rev 670)
+++ Mercury2/src/MercuryThreads.cpp 2010-01-18 13:26:25 UTC (rev 671)
@@ -6,13 +6,13 @@
#include <errno.h>
#include <time.h>
#include <sys/time.h>
+#include <stdint.h>
#endif
//XXX WARNING in windows mutex of the same name are shared!!!
//we can not give mutexes a default name
#include <stdio.h>
-#include <stdint.h>
MercuryThread::MercuryThread()
:m_haltOnDestroy(true), m_thread(0)
@@ -225,13 +225,18 @@
int r, error;
#if defined( WIN32 )
- r = ReleaseMutex( m_mutex );
- if (r!=0) error = GetLastError();
+ r = ReleaseMutex( m_mutex ); //nonzero on success
+ if (r==0)
+ {
+ error = GetLastError();
+ fprintf(stderr, "Failed to release mutex %s, error %d!!\n", m_name.c_str(), error);
+ }
+ return r!=0;
#else
- error = r = pthread_mutex_unlock( &m_mutex );
+ error = r = pthread_mutex_unlock( &m_mutex ); //0 on success
+ if (r!=0) fprintf(stderr, "Failed to release mutex %s, error %d!!\n", m_name.c_str(), error);
+ return r==0;
#endif
- if (r!=0) fprintf(stderr, "Failed to release mutex %s, error %d!!\n", m_name.c_str(), error);
- return r!=0;
}
int MercuryMutex::Open( )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-01-17 02:36:17
|
Revision: 670
http://hgengine.svn.sourceforge.net/hgengine/?rev=670&view=rev
Author: axlecrusher
Date: 2010-01-17 02:36:11 +0000 (Sun, 17 Jan 2010)
Log Message:
-----------
fix warning
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2010-01-17 02:34:24 UTC (rev 669)
+++ Mercury2/src/Shader.cpp 2010-01-17 02:36:11 UTC (rev 670)
@@ -95,7 +95,7 @@
fPriority = StrToFloat( node.Attribute("priority" ) );
ChangeKey( node.Attribute("file") );
- if (iProgramID == NULL)
+ if (iProgramID == 0)
LoadShader();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2010-01-17 02:34:39
|
Revision: 669
http://hgengine.svn.sourceforge.net/hgengine/?rev=669&view=rev
Author: axlecrusher
Date: 2010-01-17 02:34:24 +0000 (Sun, 17 Jan 2010)
Log Message:
-----------
build vertex from 3 and 4 float arrays
Modified Paths:
--------------
Mercury2/src/MercuryVertex.h
Modified: Mercury2/src/MercuryVertex.h
===================================================================
--- Mercury2/src/MercuryVertex.h 2010-01-17 02:32:13 UTC (rev 668)
+++ Mercury2/src/MercuryVertex.h 2010-01-17 02:34:24 UTC (rev 669)
@@ -18,7 +18,8 @@
public:
MercuryVertex();
MercuryVertex( float ix, float iy, float iz, float iw = 0 );
- MercuryVertex( const float * in );
+ MercuryVertex( const float* in3f, float f );
+ MercuryVertex( const float* in4f );
MercuryVertex( const MercuryVertex& v);
MercuryVertex( const MercuryVertex& v, float w);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|