rebeccap
02-11-2010 21:21:38
Hi,
For some reason I can't get the water surface to render. I am getting a "wavy" underwater effect and I can see the sun, but no water surface.
I have compiled Hydrax under ogre 1.7.1 and am using Visual Studio 2010.
Here's my createScene function:
I've been struggling with this for days, but can't find any solution. Any thoughts would be really appreciated!
For some reason I can't get the water surface to render. I am getting a "wavy" underwater effect and I can see the sun, but no water surface.
I have compiled Hydrax under ogre 1.7.1 and am using Visual Studio 2010.
Here's my createScene function:
// Set default ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
// Scene shadows
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
// Light
Ogre::Light *mLight = mSceneMgr->createLight("Light0");
mLight->setPosition(Ogre::Vector3(0,10000,0));
mLight->setDiffuseColour(1, 1, 1);
mLight->setSpecularColour(1, 0.9, 0.6);
//Sky
mSceneMgr->setSkyBox(true, "Sky/ClubTropicana", 5000, false);
// Create Hydrax object
mHydrax = new Hydrax::Hydrax(mSceneMgr, mCamera, mWindow->getViewport(0));
// Create our projected grid module
Hydrax::Module::ProjectedGrid *mModule = new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*264 /*Generic one*/));
// Set our module
mHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));
// Load all parameters from config file
// Remarks: The config file must be in Hydrax resource group.
// All parameters can be set/updated directly by code(Like previous versions),
// but due to the high number of customizable parameters, since 0.4 version, Hydrax allows save/load config files.
mHydrax->loadCfg("HydraxDemo.hdx");
// Create water
mHydrax->create();
// Set Hydrax sun position and colour
mHydrax->setSunPosition(Ogre::Vector3(0,10000,0));
mHydrax->setSunColor(Ogre::Vector3(1, 0.9, 0.6));
//Boat (or Ninja)
Ogre::Entity* boatEntity = mSceneMgr->createEntity("Ninja", "ninja.mesh");
Ogre::SceneNode* boatNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("BoatNode");
boatNode->attachObject(boatEntity);
boatNode->setPosition(Ogre::Vector3(0, 30, 0));
I've been struggling with this for days, but can't find any solution. Any thoughts would be really appreciated!