[Contribution] CVS Ogre 1.5.0 support patch

Lexx

23-11-2007 02:59:48

Got PagingLandScape2 plugin worked with CVS Ogre 1.5.0
others (mapsplitter & demo) is worked without any changes

there's a patch for "PagingLandScape2 plugin":


Index: include/OgrePagingLandScapeMeshDecal.h
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapeMeshDecal.h,v
retrieving revision 1.1
diff -u -r1.1 OgrePagingLandScapeMeshDecal.h
--- include/OgrePagingLandScapeMeshDecal.h 21 Dec 2006 12:48:44 -0000 1.1
+++ include/OgrePagingLandScapeMeshDecal.h 22 Nov 2007 06:28:40 -0000
@@ -101,6 +101,11 @@
// Main public interface
void SetSize( const Vector2& size );

+#if (OGRE_VERSION_MINOR >= 5)
+ virtual void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables = false);
+#endif
+
+
private:
void CreateGeometry();
size_t GetNumVertices() const;
Index: include/OgrePagingLandScapePageRenderable.h
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapePageRenderable.h,v
retrieving revision 1.10
diff -u -r1.10 OgrePagingLandScapePageRenderable.h
--- include/OgrePagingLandScapePageRenderable.h 29 Nov 2006 17:13:51 -0000 1.10
+++ include/OgrePagingLandScapePageRenderable.h 22 Nov 2007 06:45:01 -0000
@@ -40,6 +40,10 @@

virtual ~PagingLandScapePageRenderable(void);

+#if (OGRE_VERSION_MINOR >= 5)
+ virtual void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables = false);
+#endif
+
void load(void);

void setMaterial(const MaterialPtr& mat);
Index: include/OgrePagingLandScapeRenderable.h
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapeRenderable.h,v
retrieving revision 1.31
diff -u -r1.31 OgrePagingLandScapeRenderable.h
--- include/OgrePagingLandScapeRenderable.h 7 Dec 2006 17:19:08 -0000 1.31
+++ include/OgrePagingLandScapeRenderable.h 22 Nov 2007 06:51:27 -0000
@@ -34,6 +34,10 @@
{
public:

+#if (OGRE_VERSION_MINOR >= 5)
+ virtual void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables = false);
+#endif
+
/** Sets the appropriate neighbor for this TerrainRenderable. Neighbors are necessary
to know when to bridge between LODs.
*/
Index: src/OgrePagingLandScapeMeshDecal.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapeMeshDecal.cpp,v
retrieving revision 1.1
diff -u -r1.1 OgrePagingLandScapeMeshDecal.cpp
--- src/OgrePagingLandScapeMeshDecal.cpp 21 Dec 2006 12:48:45 -0000 1.1
+++ src/OgrePagingLandScapeMeshDecal.cpp 23 Nov 2007 02:25:46 -0000
@@ -112,6 +112,13 @@
delete renderOp_.indexData;
}

+#if (OGRE_VERSION_MINOR >= 5)
+void PagingLandScapeMeshDecal::visitRenderables(Renderable::Visitor* visitor, bool debugRenderables)
+{
+
+}
+#endif
+
void PagingLandScapeMeshDecal::CreateGeometry()
{
Matrix4 xlate;
@@ -462,7 +469,12 @@
void PagingLandScapeMeshDecal::getRenderOperation( Ogre::RenderOperation& op )
{
// Update our RenderOperation if necessary.
+#if (OGRE_VERSION_MINOR >= 5)
+ const Vector3& position = mParentNode->_getDerivedPosition();
+#else
const Vector3& position = mParentNode->getWorldPosition();
+#endif
+
const Quaternion& orientation = mParentNode->getOrientation();
if( position != position_ ||
orientation != orientation_ )
@@ -486,7 +498,11 @@

const Vector3& PagingLandScapeMeshDecal::getWorldPosition() const
{
+#if (OGRE_VERSION_MINOR >= 5)
+ return mParentNode->_getDerivedPosition();
+#else
return mParentNode->getWorldPosition();
+#endif
}

Real PagingLandScapeMeshDecal::getSquaredViewDepth( const Camera* cam ) const
Index: src/OgrePagingLandScapeOcclusion.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapeOcclusion.cpp,v
retrieving revision 1.16
diff -u -r1.16 OgrePagingLandScapeOcclusion.cpp
--- src/OgrePagingLandScapeOcclusion.cpp 27 Mar 2007 16:31:15 -0000 1.16
+++ src/OgrePagingLandScapeOcclusion.cpp 22 Nov 2007 06:38:55 -0000
@@ -49,7 +49,13 @@
{
mCurrentCam = cam;
}
- if (mCurrentCam->nextFrame(Root::getSingleton().getCurrentFrameNumber ()))
+
+#if (OGRE_VERSION_MINOR >= 5)
+ if (mCurrentCam->nextFrame(Root::getSingleton().getNextFrameNumber() - 1))
+#else
+ if (mCurrentCam->nextFrame(Root::getSingleton().getCurrentFrameNumber ()))
+#endif
+
{
// change frame Id counter
//that identify current frame.
Index: src/OgrePagingLandScapeOptions.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapeOptions.cpp,v
retrieving revision 1.134
diff -u -r1.134 OgrePagingLandScapeOptions.cpp
--- src/OgrePagingLandScapeOptions.cpp 18 Sep 2007 12:05:25 -0000 1.134
+++ src/OgrePagingLandScapeOptions.cpp 22 Nov 2007 07:34:06 -0000
@@ -216,15 +216,25 @@
const RenderSystem *renderer = Root::getSingleton().getRenderSystem();
if (renderer)
{
- const RenderSystemCapabilities* caps = renderer->getCapabilities();
+ const RenderSystemCapabilities* caps = renderer->getCapabilities();
+
+#if (OGRE_VERSION_MINOR >= 5)
+ bool bIsVSsupported = caps->isShaderProfileSupported("vs_1_1");
+ hasVertexShader = caps->hasCapability(RSC_VERTEX_PROGRAM) && bIsVSsupported;
+ hasVertexShader = caps->hasCapability(RSC_BLENDING) && bIsVSsupported;
+ hasFragmentShader = caps->hasCapability(RSC_FRAGMENT_PROGRAM);
+ hasFragmentShader2 = hasFragmentShader && caps->isShaderProfileSupported("vs_2_0");
+#else
hasVertexShader = caps->hasCapability(RSC_VERTEX_PROGRAM) && !(StringUtil::startsWith(caps->getMaxFragmentProgramVersion (), "vs_1_0", true));
hasVertexShader = caps->hasCapability(RSC_BLENDING) && !(StringUtil::startsWith(caps->getMaxFragmentProgramVersion (), "vs_1_0", true));
- hasFragmentShader = caps->hasCapability(RSC_FRAGMENT_PROGRAM);
- const String &maxShaderVersion = caps->getMaxFragmentProgramVersion ();
- hasFragmentShader2 = hasFragmentShader && !(maxShaderVersion == "ps_1_1" || maxShaderVersion == "ps_1_0");
- numTextureUnits = caps->getNumTextureUnits ();
- isRenderGL = StringUtil::startsWith(renderer->getName(), "OpenGL", false);
- isInit = true;
+ hasFragmentShader = caps->hasCapability(RSC_FRAGMENT_PROGRAM);
+ const String &maxShaderVersion = caps->getMaxFragmentProgramVersion ();
+ hasFragmentShader2 = hasFragmentShader && !(maxShaderVersion == "ps_1_1" || maxShaderVersion == "ps_1_0");
+#endif
+
+ numTextureUnits = caps->getNumTextureUnits ();
+ isRenderGL = StringUtil::startsWith(renderer->getName(), "OpenGL", false);
+ isInit = true;
}
}
}
Index: src/OgrePagingLandScapePageRenderable.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapePageRenderable.cpp,v
retrieving revision 1.14
diff -u -r1.14 OgrePagingLandScapePageRenderable.cpp
--- src/OgrePagingLandScapePageRenderable.cpp 21 Feb 2007 13:20:49 -0000 1.14
+++ src/OgrePagingLandScapePageRenderable.cpp 23 Nov 2007 02:25:46 -0000
@@ -123,7 +123,13 @@

mMaterial.setNull();
}
+ //-----------------------------------------------------------------------
+#if (OGRE_VERSION_MINOR >= 5)
+ void PagingLandScapePageRenderable::visitRenderables(Renderable::Visitor* visitor, bool debugRenderables)
+ {

+ }
+#endif
//-----------------------------------------------------------------------
void PagingLandScapePageRenderable::load()
{
@@ -225,7 +231,13 @@
0.0f + Numtiles * scale_z);

assert (mParentNode);
- mCenter = mBounds.getCenter() + mParentNode->getWorldPosition();
+
+#if (OGRE_VERSION_MINOR >= 5)
+ mCenter = mBounds.getCenter() + mParentNode->_getDerivedPosition();
+#else
+ mCenter = mBounds.getCenter() + mParentNode->getWorldPosition();
+#endif
+
mWorldBoundingSphere.setCenter(mCenter);
mWorldBoundingSphere.setRadius(mBounds.getMaximum().length());

Index: src/OgrePagingLandScapeRenderable.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapeRenderable.cpp,v
retrieving revision 1.72
diff -u -r1.72 OgrePagingLandScapeRenderable.cpp
--- src/OgrePagingLandScapeRenderable.cpp 31 Oct 2007 10:37:49 -0000 1.72
+++ src/OgrePagingLandScapeRenderable.cpp 23 Nov 2007 02:25:46 -0000
@@ -186,7 +186,13 @@
delete mCurrVertexes;
delete [] mDeltaBuffers;
}
+ //------------------------------------------------------------------------
+#if (OGRE_VERSION_MINOR >= 5)
+ void PagingLandScapeRenderable::visitRenderables(Renderable::Visitor* visitor, bool debugRenderables)
+ {

+ }
+#endif
//------------------------------------------------------------------------
void PagingLandScapeRenderable::uninit()
{
@@ -1180,7 +1186,13 @@
if (parent)
{
assert (mIsLoaded);
+
+#if (OGRE_VERSION_MINOR >= 5)
+ mCenter = mBounds.getCenter() + mParentNode->_getDerivedPosition();
+#else
mCenter = mBounds.getCenter() + mParentNode->getWorldPosition();
+#endif
+
mWorldBoundingSphere.setCenter(mCenter);
mWorldBoundingSphere.setRadius((mBounds.getMaximum() - mBounds.getMinimum()).length() / 2);
mParentNode->needUpdate();
Index: src/OgrePagingLandScapeTile.cpp
===================================================================
RCS file: /cvsroot/ogre/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/src/OgrePagingLandScapeTile.cpp,v
retrieving revision 1.60
diff -u -r1.60 OgrePagingLandScapeTile.cpp
--- src/OgrePagingLandScapeTile.cpp 27 Mar 2007 16:31:18 -0000 1.60
+++ src/OgrePagingLandScapeTile.cpp 23 Nov 2007 02:25:46 -0000
@@ -139,7 +139,12 @@
StringConverter::toString(tileZ);
mTileSceneNode = mParent->getSceneManager()->createSceneNode (NodeName + ".Node");

+#if (OGRE_VERSION_MINOR >= 5)
+ const Vector3 ParentPos = ParentSceneNode->_getDerivedPosition();
+#else
const Vector3 ParentPos = ParentSceneNode->getWorldPosition();
+#endif
+
const Real MaxHeight = mParent->getSceneManager()->getData2DManager()->getMaxHeight(mInfo->mPageX, mInfo->mPageZ);
assert (MaxHeight >= (Real)0.0f);
//Change Zone of this page

michaelg1987

10-01-2008 05:41:26

Two things:

I'm new to CVS (I'm more familiar with Subversion, but I'm still a noob) and I was wondering if windows has a "patch" solution similar to what can be found for linux, and

Will this be committed to CVS anytime soon? Just curious. I mean, I can figure out what needs to be replaced myself, it would just save my lazy rear end some effort.

tuan kuranes

10-01-2008 11:21:28

applied to CVS. thanks to pointing that one.

michaelg1987

10-01-2008 19:33:04

Awesome, I didn't think that'd happen so fast :)

hellcatv

31-01-2008 16:40:18

Your check for vs_1_1 and vs_2_0 (already buggy cus the comment claims it is looking for instead of ps_2_0) ALWAYS FAIL under openGL.
we need a cross platform solution here