Hydrax v0.4 - New version released + Editor!

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Locked
Infuse
Gnoblar
Posts: 18
Joined: Thu Mar 20, 2008 1:32 am

Post by Infuse »

Xavyiy

Code: Select all


PostPosted: Thu Apr 10, 2008 8:08 am    Post subject:
@Infuse
What Ogre version are you using?

I'm using Eihtort 1.4.6.

I've done everysingle thing possible
Infuse
Gnoblar
Posts: 18
Joined: Thu Mar 20, 2008 1:32 am

Post by Infuse »

Xavyiy
@Infuse
What Ogre version are you using?
I'm using Eihort 1.4.6
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

@Infuse
I'm going to looking into this night, if I won't finda solution I'm going to open a thead in help forum with the error:

Code: Select all

Win32PBuffer::Creating PBuffer of format bits=8 float=false
19:08:43:  Win32PBuffer::PBuffer -- Chosen pixel format rgba=8,8,8,8 depth=24 stencil=8
19:08:43: OGRE EXCEPTION(3:RenderingAPIException): wglShareLists() failed in  Win32PBuffer::createPBuffer at ..\src\OgreWin32RenderTexture.cpp (line 204) 
I haven't seen this problem before!
Infuse
Gnoblar
Posts: 18
Joined: Thu Mar 20, 2008 1:32 am

Post by Infuse »

Thank You soo much
GordonS
Gnoblar
Posts: 2
Joined: Wed Apr 09, 2008 10:03 pm

Re: Exception in demo

Post by GordonS »

Hi xavier,
Xavyiy wrote:@GordonS

Are you using Hydrax::MaterialManager::SM_GLSL ? or SM_CG with a before version than CG 2.0 ? Try with SM_HLSL.

Xavi
I was using the pre-compiled demo, so I don't know the setup.
I tried compiling locally, but there was much missing or mis-located on my setup.

I'll fix that and try again and/or try compiling locally again.

Thanks,
Gordon.
Cobra8472
Halfling
Posts: 83
Joined: Thu Jun 02, 2005 4:44 pm

Post by Cobra8472 »

Running into a crash here, cant figure it out :(

env_water.h:

Code: Select all

class WaterFrameListener : public ExampleFrameListener
{
public:
	WaterFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr): ExampleFrameListener(win, cam, false, false)
	{

	}
	bool frameStarted(const FrameEvent &evt, Hydrax::Hydrax *mWater = 0)
	{
	mWater->update(evt.timeSinceLastFrame);
    return WaterFrameListener::frameStarted(evt);
	};

protected:
    
};

class WaterSystem : public ExampleApplication
{
public:
	void createWater();
	void createScene();
};
env_water.cpp:

Code: Select all

void WaterSystem::createWater()
{
		Hydrax::Hydrax *mWater = 0;
		mWater = new Hydrax::Hydrax(mSceneMgr, mCamera);
		mWater->setMeshOptions(static_cast<Hydrax::Mesh::Options*>(new Hydrax::Mesh::ProjectedGridOptions(256)));

		Hydrax::Module::PerlinPG *mModule = new Hydrax::Module::PerlinPG(mWater,Ogre::Plane(Ogre::Vector3(0,1,0),Ogre::Vector3(0,0,0)),
										  Hydrax::Module::PerlinPG::Options(256));

        mWater->setRttOptions(Hydrax::RttOptions(Hydrax::TEX_QUA_1024,Hydrax::TEX_QUA_1024,Hydrax::TEX_QUA_1024));

		// Set components
		mWater->setComponents(static_cast<Hydrax::HydraxComponent>(Hydrax::HYDRAX_COMPONENT_SUN    |
                                                 Hydrax::HYDRAX_COMPONENT_FOAM   |
                                                 Hydrax::HYDRAX_COMPONENT_DEPTH  |
                                                 Hydrax::HYDRAX_COMPONENT_SMOOTH ));

		mWater->setModule(static_cast<Hydrax::Module::Module*>(mModule));
		mWater->setShaderMode(Hydrax::MaterialManager::SM_HLSL);
        mWater->create();
        
		caelum::Sun *mSun = mCaelumSystem->getSun();
		Vector3 mSunDir = mSun->getSunDirection();
		Vector3 mCamPos = mCamera->getRealPosition();
		Vector3 mSunPosition = mCamPos-(mSunDir.normalisedCopy())*1000000;
	
        mWater->setPosition(Ogre::Vector3(0,0,0));
        mWater->setPlanesError(37.5);
        mWater->setDepthLimit(110);
        mWater->setSunColor(Vector3(1,0.6,0.4)); 
        mWater->setNormalDistortion(0.025);
        mWater->setDepthColor(Ogre::Vector3(0.04,0.135,0.185));
        mWater->setSmoothPower(45);
		mWater->setCausticsScale(12);
        mWater->setGlobalTransparency(0.1);
        mWater->setFullReflectionDistance(99999997952.0);
		mWater->setGlobalTransparency(0);
        mWater->setPolygonMode(0);
		mWater->setSunPosition(mSunPosition);

		mRoot->addFrameListener(new WaterFrameListener(mWindow, mCamera, mSceneMgr));

}

void WaterSystem::createScene()
{

}

Debugger shows that it crashes at this line:

mSceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode();

in hydrax.cpp just after HydraxLOG("Creating water mesh.");


in main .cpp;

WaterSystem *myWater = new WaterSystem;
myWater->createWater();


I'm still really new to C++, so excuse me if it's some rudimentary silly mistake :oops:
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

@Cobra8472

I've to see more code, posting a zip with the code will be sufficient, so I think that mSceneManager is null when you call Hydrax::create().

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

I'm working in a Decal manager for hydrax just now, for place ship trails, oil, water vegetables, etc over the water!

Edit: it's finished!
Here's a shot:(Sorry for my ugly phosothop design :P!)
Image

and usage:

Code: Select all

mHydrax->getDecalsManager()->add("WaterVegetable.png");
(It returns a Hydrax::Decal wich can be used as a Ogre::SceneNode: Hydrax::Decal::getSceneNode()->setPosition, setScale... etc!)

Enjoy!

Xavi
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Post by nullsquared »

Cobra8472 wrote:...
Put "createWater();" in createScene(), and don't call it manually. Instead, just call "myWater->go();", or whatever ExampleApplication's "start" method was. I don't use the example framework, but, IIRC, the scene manager isn't create on ExampleApplication's constructor, which is all you're calling before createWater().
User avatar
IFASS
Gnome
Posts: 387
Joined: Tue Jan 04, 2005 12:07 pm
Location: Netherlands

Post by IFASS »

Xavyiy wrote:I'm working in a Decal manager for hydrax just now, for place ship trails, oil, water vegetables, etc over the water!

Edit: it's finished!
Here's a shot:(Sorry for my ugly phosothop design :P!)
Image

and usage:

Code: Select all

mHydrax->getDecalsManager()->add("WaterVegetable.png");
(It returns a Hydrax::Decal wich can be used as a Ogre::SceneNode: Hydrax::Decal::getSceneNode()->setPosition, setScale... etc!)

Enjoy!

Xavi
Looking very good Xavi! :)
I was wondering, will the editor ship too with the 0.3 release?
Image
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

@IFASS

I think that I'm going to release Hydrax 0.3 and after the Editor, but before 0.4 version. Only release the 0.3v for developers, and just when I release it start working with the editor(There're a lot of thinks that I've to change!)

Sorry for my little Enlgish and here's another screenshot of decals support:
Image

Xavi
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Post by spacegaier »

Overwhelming, really overwhelming!!!
User avatar
mehdix
Halfling
Posts: 78
Joined: Fri Jun 22, 2007 3:59 pm

Post by mehdix »

Xavyiy wrote: I think that I'm going to release Hydrax 0.3 and after the Editor, but before 0.4 version. Only release the 0.3v for developers, and just when I release it start working with the editor(There're a lot of thinks that I've to change!)

Image
Xavi
Great! :P

Two feature requests:
* Is it possible that a detailed noise module like PerlinPG is created/used for bounded water plans, like Perlin? SimpleGrid+Perlin is boring!
* When do you plan to add custom shaped water areas (eg rivers)?

Thanks.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

mehdix wrote:Great! :P

Two feature requests:
* Is it possible that a detailed noise module like PerlinPG is created/used for bounded water plans, like Perlin? SimpleGrid+Perlin is boring!
* When do you plan to add custom shaped water areas (eg rivers)?

Thanks.
I've rewritten all modules, and interfaze system.
Simple grid now looks good with high complexity[256+](Now it uses the same noise module than projected grid)
For next releases(0.4+) I'm going to code the radial and bounded plane mesh with LOD system.

About custom shapes support... it's not planned yet. Sorry.

Edit:
New module interfaze system example:

Code: Select all

		// Create our projected grid module  
		Hydrax::Module::ProjectedGrid *mModule 
			= new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
			                                    mHydrax,
												// Noise module
			                                    new Hydrax::Noise::Perlin(/* Default options */),
												// Base plane
			                                    Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
												// Projected grid options (Can be updated each frame -> setOptions(...))
										        Hydrax::Module::ProjectedGrid::Options(256 /* See more constructors */));

.....OR.....

		Hydrax::Module::SimpleGrid *mModule 
			= new Hydrax::Module::SimpleGrid(// Hydrax parent pointer
			                                 mHydrax,
									     	 // Noise module
			                                 new Hydrax::Noise::Perlin(/* Default options */),
											 // Simple grid options (Can be updated each frame -> setOptions(...))
										 Hydrax::Module::SimpleGrid::Options(256, Hydrax::Size(10000,10000) /* See more constructors */));

// Set our module
mHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Here is a little video that shows the new water decals feature:
http://rapidshare.com/files/106757856/Decals.wmv.html

Hope you like it! (It can be used for ship trails, etc)
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Post by Assaf Raman »

I like the video very much. Good work! :D
btw: why don't you use google pages to upload files?
Last edited by Assaf Raman on Sat Apr 12, 2008 12:34 am, edited 1 time in total.
Watch out for my OGRE related tweets here.
User avatar
triton
Greenskin
Posts: 138
Joined: Thu Mar 13, 2008 10:25 pm
Location: Portugal

Post by triton »

Wow, that looks amazing! :D
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

@Assaf Raman
To be honest I've never used google pages before, but I'm going to try this google service!

Thanks for opinions!
Cobra8472
Halfling
Posts: 83
Joined: Thu Jun 02, 2005 4:44 pm

Post by Cobra8472 »

Sorry I didnt get back you! Went on hiatus for a few days.

I decided to rewrite it a little though, and ran into another problem.

watersystem.h;

Code: Select all

//--------------------------------------------- WaterSystem Class ---------------------------------------------------------------//
class WaterSystem
{
protected:
public:
	void createWater();
};
//---------------------------------- Water framelistener. Updates Hydrax -------------------------------------------------------//
class WaterFrameListener : public ExampleFrameListener
{

protected:
	Hydrax::Hydrax *mWater;
public:
	WaterFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr): ExampleFrameListener(win, cam, false, false)
	{

	}
	bool frameStarted(const FrameEvent &evt)
	{
	mWater->update(evt.timeSinceLastFrame);
    return ExampleFrameListener::frameStarted(evt);
	};
    
};
Watersystem.cpp

Code: Select all

void WaterSystem::createWater()
{
	    Ogre::Root *mRoot = Ogre::Root::getSingletonPtr();
	    SceneManager *mSceneMgr = mRoot->getSceneManager("SceneManager1");
		Camera *mCamera = mSceneMgr->getCamera("PlayerCam");
		RenderWindow *mWindow = mRoot->getAutoCreatedWindow();

		Hydrax::Hydrax *mWater = 0;
		mWater = new Hydrax::Hydrax(mSceneMgr, mCamera);
		mWater->setMeshOptions(static_cast<Hydrax::Mesh::Options*>(new Hydrax::Mesh::ProjectedGridOptions(256)));

		Hydrax::Module::PerlinPG *mModule = new Hydrax::Module::PerlinPG(mWater,Ogre::Plane(Ogre::Vector3(0,1,0),Ogre::Vector3(0,0,0)),
										  Hydrax::Module::PerlinPG::Options(256));

        mWater->setRttOptions(Hydrax::RttOptions(Hydrax::TEX_QUA_1024,Hydrax::TEX_QUA_1024,Hydrax::TEX_QUA_1024));

		// Set components
		mWater->setComponents(static_cast<Hydrax::HydraxComponent>(Hydrax::HYDRAX_COMPONENT_SUN    |
                                                 Hydrax::HYDRAX_COMPONENT_FOAM   |
                                                 Hydrax::HYDRAX_COMPONENT_DEPTH  |
                                                 Hydrax::HYDRAX_COMPONENT_SMOOTH ));

		mWater->setModule(static_cast<Hydrax::Module::Module*>(mModule));
		mWater->setShaderMode(Hydrax::MaterialManager::SM_HLSL);
        mWater->create();

        mWater->setPosition(Ogre::Vector3(0,0,0));
        mWater->setPlanesError(37.5);
        mWater->setDepthLimit(110);
        mWater->setSunColor(Vector3(1,0.6,0.4)); 
        mWater->setNormalDistortion(0.025);
        mWater->setDepthColor(Ogre::Vector3(0.04,0.135,0.185));
        mWater->setSmoothPower(45);
		mWater->setCausticsScale(12);
        mWater->setGlobalTransparency(0.1);
        mWater->setFullReflectionDistance(99999997952.0);
		mWater->setGlobalTransparency(0);
        mWater->setPolygonMode(0);
		

		mRoot->addFrameListener(new WaterFrameListener(mWindow, mCamera, mSceneMgr));

}
crashes in the following function;

Code: Select all

    void Hydrax::update(const Ogre::Real &timeSinceLastFrame)
    {
		if (mModule)
		{
            mModule->update(timeSinceLastFrame);
		}
    }
on the line if(mModule)



Again, sorry for my beginner mistakes! :oops:
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Post by Rambus »

Xavyiy - This is a really great project. I would love to see some video samples of the plane defined mode. The water decals look excellent.

If you want some unrestricted webspace to host Hydrax check out my signature.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

@Cobra8472
Delete this line:
Hydrax::Hydrax *mWater = 0;
in createWater() funtion and try again, I think that this is the problem.

@Rambus
I'm going to try record a video of the new SimpleGrid module and post it tomorrow(I've a lot of exams for some weeks).
Thanks for the webspace offer, if I need unrestricted webspace for Hydrax I will contact you!

Sorry for my English.
User avatar
Bill_BsB
Halfling
Posts: 47
Joined: Wed Jun 15, 2005 3:41 pm
Location: Brasília-DF

Post by Bill_BsB »

Good work man! Won´t take long until Ogre have water simulation similar to Crytek´s!

=D
Cobra8472
Halfling
Posts: 83
Joined: Thu Jun 02, 2005 4:44 pm

Post by Cobra8472 »

Xavyiy wrote:@Cobra8472
Delete this line:
Hydrax::Hydrax *mWater = 0;
in createWater() funtion and try again, I think that this is the problem.

@Rambus
I'm going to try record a video of the new SimpleGrid module and post it tomorrow(I've a lot of exams for some weeks).
Thanks for the webspace offer, if I need unrestricted webspace for Hydrax I will contact you!

Sorry for my English.
Crashes on the same line I'm afraid.

It's ok if you can't solve, it, really don't want to take your precious dev time away!! :)
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Cobra8472 wrote:
Xavyiy wrote:@Cobra8472
Delete this line:
Hydrax::Hydrax *mWater = 0;
in createWater() funtion and try again, I think that this is the problem.

@Rambus
I'm going to try record a video of the new SimpleGrid module and post it tomorrow(I've a lot of exams for some weeks).
Thanks for the webspace offer, if I need unrestricted webspace for Hydrax I will contact you!

Sorry for my English.
Crashes on the same line I'm afraid.

It's ok if you can't solve, it, really don't want to take your precious dev time away!! :)
Can you post the stack? I think something is wrong initialized, like mCamera or mSceneManager is null.
If you can post all sources(main.cpp, water.cpp, etc) it would be easy to catch the bug!
Cobra8472
Halfling
Posts: 83
Joined: Thu Jun 02, 2005 4:44 pm

Post by Cobra8472 »

Sure thing;

ExampleApplication.h:

Code: Select all

#ifndef __ExampleApplication_H__
#define __ExampleApplication_H__

#include "Ogre.h"
#include "OgreConfigFile.h"
#include "ExampleFrameListener.h"
#include "Caelum.h"
#include "Hydrax.h"
#include "Modules/Perlin/Perlin.h"
#include "Modules/PerlinPG/PerlinPG.h"

#include <OIS\OIS.h>
#include <windows.h>



#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>

// This function will locate the path to our application on OS X,
// unlike windows you can not rely on the curent working directory
// for locating your configuration files and resources.
std::string macBundlePath()
{
    char path[1024];
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    assert(mainBundle);

    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
    assert(mainBundleURL);

    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
    assert(cfStringRef);

    CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);

    CFRelease(mainBundleURL);
    CFRelease(cfStringRef);

    return std::string(path);
}
#endif

using namespace Ogre;

/** Base class which manages the standard startup of an Ogre application.
    Designed to be subclassed for specific examples if required.
*/
//-------------------------------------------------------------------------------------------------------------------
class ExampleApplication
{
public:
    //-------------------------------------------------------------------------------------------------------------------
    ExampleApplication()     //constructor
    {
        mFrameListener = 0;
        mRoot = 0;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
		mResourcePath = macBundlePath() + "/Contents/Resources/";
#else
		mResourcePath = "";
#endif
    }
	//-------------------------------------------------------------------------------------------------------------------
    virtual ~ExampleApplication() //destructor
    {
        if (mFrameListener)
		{
            delete mFrameListener;
		}
        if (mRoot)
		{
            delete mRoot;
		}
    }
	//-------------------------------------------------------------------------------------------------------------------
    virtual void go(void)  //start
    {
        if (!setup())
		{
            return;
		}

        mRoot->startRendering();
        destroyScene(); //cleanup
    }
//-------------------------------------------------------------------------------------------------------------------
protected:
    Root *mRoot;
    Camera* mCamera;
    ExampleFrameListener* mFrameListener;
    RenderWindow* mWindow;
	Ogre::String mResourcePath;
	caelum::CaelumSystem* mCaelumSystem;
	SceneManager *mSceneMgr;

    // These internal methods package up the stages in the startup process
    // Sets up the application - returns false if the user chooses to abandon configuration.
    virtual bool setup(void)
    {

		String pluginsPath;
#ifndef OGRE_STATIC_LIB
		pluginsPath = mResourcePath + "plugins.cfg";
#endif	
        mRoot = new Root(pluginsPath, 
            mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");

        setupResources();

        bool carryOn = configure();
        if (!carryOn) return false;

        chooseSceneManager();
        createCamera();
        createViewports();
        TextureManager::getSingleton().setDefaultNumMipmaps(5);
		createResourceListener(); //for loading screens
		loadResources();	
        createScene();
		createSky(); //Caelum
        createFrameListener(); 
        return true;

    }
   //-------------------------------------------------------------------------------------------------------------------
    virtual bool configure(void)
    {
        if(mRoot->showConfigDialog())
        {
            mWindow = mRoot->initialise(true);
            return true;
        }
        else
        {
            return false;
        }
    }
//-------------------------------------------------------------------------------------------------------------------
	public:

    virtual void chooseSceneManager(void)
    {
        mSceneMgr = mRoot->createSceneManager(ST_EXTERIOR_CLOSE, "SceneManager1");
    }
	//-------------------------------------------------------------------------------------------------------------------

	protected:

    virtual void createCamera(void)
    {
        mCamera = mSceneMgr->createCamera("PlayerCam");
        mCamera->setPosition(Vector3(0,0,500));
        mCamera->lookAt(Vector3(0,0,-300));
        mCamera->setNearClipDistance(5);

    }
	//-------------------------------------------------------------------------------------------------------------------
    virtual void createFrameListener(void)
    {
        mFrameListener= new ExampleFrameListener(mWindow, mCamera);
        mFrameListener->showDebugOverlay(true);
        mRoot->addFrameListener(mFrameListener);
		//mRoot->addFrameListener(new WaterFrameListener(mWindow, mCamera, mSceneMgr));
		//mRoot->addFrameListener(new SkyFrameListener(mWindow, mCamera, mSceneMgr, mCaelumSystem));
		
    }
	//-------------------------------------------------------------------------------------------------------------------

    virtual void createScene(void) = 0;    // pure virtual - this has to be overridden
    virtual void destroyScene(void){}    // Optional to override this
    virtual void createViewports(void)
    {
        Viewport* vp = mWindow->addViewport(mCamera);
        vp->setBackgroundColour(ColourValue(0.3,0.3,0.3));
        mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
    }
	//-------------------------------------------------------------------------------------------------------------------
    void createSky()
	{


       bool mPaused = false;
       bool mPostFiltering = false;
       float mTimeTillNextUpdate;

	   mCaelumSystem = new caelum::CaelumSystem (mRoot, mSceneMgr);
	   mCaelumSystem->setManageSceneFog(true);
       mCaelumSystem->setSceneFogDensityMultiplier(0.0000000001);
	        
        if (mCaelumSystem->getSun ()) 
		{
            mCaelumSystem->getSun ()->setAmbientMultiplier (Ogre::ColourValue(0.5, 0.5, 0.5));
            mCaelumSystem->getSun ()->setDiffuseMultiplier (Ogre::ColourValue(3, 3, 2.7));
            mCaelumSystem->getSun ()->setSpecularMultiplier (Ogre::ColourValue(5, 5, 5));
            mCaelumSystem->getSun ()->setManageAmbientLight (true);
        }

        if (mCaelumSystem->getClouds ()) 
		{
            mCaelumSystem->getClouds ()->setCloudSpeed(Ogre::Vector2(0.000005, -0.000009));
            mCaelumSystem->getClouds ()->setCloudBlendTime(3600 * 24);
            mCaelumSystem->getClouds ()->setCloudCover(0.03);
        }

        if (mCaelumSystem->getStarfield ()) 
		{
            mCaelumSystem->getStarfield ()->setInclination (Degree (13));
        }
        mCaelumSystem->getUniversalClock ()->setTimeScale (1);
		

        // Winter dawn in the southern hemisphere, looking north
        mCaelumSystem->getUniversalClock ()->setGregorianDateTime (2008, 5, 29, 2, 0, 0);
        mCaelumSystem->getSolarSystemModel ()->setObserverLongitude (Ogre::Degree(151 + 12.0 / 60));
		
		//caelum::GroundFog *mFog = mCaelumSystem->getGroundFog();
		//mFog->setColour(ColourValue(1,1,1));

        mCaelumSystem->getSolarSystemModel ()->setObserverLatitude (Ogre::Degree(-33 + 52.0 / 60));
        mWindow->addListener (mCaelumSystem);
        mTimeTillNextUpdate = 0;

		
	}

//-------------------------------------------------------------------------------------------------------------------

	//-------------------------------------------------------------------------------------------------------------------
    virtual void setupResources(void)
    {
        
        ConfigFile cf;
        cf.load(mResourcePath + "resources.cfg");
        ConfigFile::SectionIterator seci = cf.getSectionIterator();
        String secName, typeName, archName;
        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            ConfigFile::SettingsMultiMap *settings = seci.getNext();
            ConfigFile::SettingsMultiMap::iterator i;
            for (i = settings->begin(); i != settings->end(); ++i)
            {
                typeName = i->first;
                archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
                // OS X does not set the working directory relative to the app,
                // In order to make things portable on OS X we need to provide
                // the loading with it's own bundle path location
                ResourceGroupManager::getSingleton().addResourceLocation(
                    String(macBundlePath() + "/" + archName), typeName, secName);
#else
                ResourceGroupManager::getSingleton().addResourceLocation(
                    archName, typeName, secName);
#endif
            }
        }
    }

	virtual void createResourceListener(void)
	{

	}

	virtual void loadResources(void)
	{
		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	}

};


#endif

and main.cpp;

Code: Select all

#include "ExampleApplication.h"
#include "Caelum.h"
#include "Hydrax.h"
#include "Modules/Perlin/Perlin.h"
#include "Modules/PerlinPG/PerlinPG.h"
#include "env_water.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
    TutorialApplication()
    {
    }

    ~TutorialApplication() 
    {
    }
protected:
    void createScene(void)
    {
		mCamera->setFarClipDistance(99999*6);
		WaterSystem *myWater = new WaterSystem();
		myWater->createWater();
		//mSceneMgr->setWorldGeometry("terrain.cfg");

	}
};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif

{
    // Create application object
    TutorialApplication app;

    try {
        app.go();
	} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
        MessageBoxA( NULL, e.what(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        fprintf(stderr, "An exception has occurred: %s\n",
                e.what());
#endif
    }

    return 0;
}

That's all the files.
Locked