[HELP] Hydrax + Caelum = strange image !!!

compvis

04-07-2009 09:36:00

Hi,

i intergrate Hydrax 0.5 and Caelum 0.4, as a result, i have a screenshot:



In such image, only Caelum appears, not Hydrax. But if i remove Caelum then Hydrax runs normally.
Pls read my code inits below:

Init for Hydrax: where mSea is pointer Hydrax::Hydrax*


E_CODES Core::klinkInitOcean()
{
mScene->setAmbientLight(ColourValue(1,1,1));

// mScene->setSkyBox(true,"Sky/EarlyMorning",99999*3,true);

mCam->setFarClipDistance(99999*6);

mCam->setPosition(1212.90,450,1924.02);
mCam->lookAt(K_VECTOR(-400,250,-10000));

mLight->setPosition(mSunPos[0]);
mLight->setDiffuseColour(1, 1, 1);
mLight->setSpecularColour(mSunColors[0].x,
mSunColors[0].y,
mSunColors[0].z);

mSea = new Hydrax::Hydrax(mScene,mCam,mRender->getViewport(0));

if (!mSea)
{
return E_OCEAN;
}
Hydrax::Module::ProjectedGrid* module = new Hydrax::Module::ProjectedGrid(
mSea,
new Hydrax::Noise::Perlin,
K_Plane(K_VECTOR(0,1,0),K_VECTOR(0,0,0)),
Hydrax::MaterialManager::NM_VERTEX,
Hydrax::Module::ProjectedGrid::Options()
);
mSea->setModule(static_cast<Hydrax::Module::Module*>(module));
mSea->loadCfg("HydraxDemo.hdx");
mSea->create();
mScene->setWorldGeometry("Island.cfg");


mSea->getMaterialManager()->addDepthTechnique(
static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName("Island"))
->createTechnique());
return SUCCESS;
}


Updating Ocean in frameStared(...):

K_VOID Core::klinkUpdateOcean(K_FLOAT last)
{

K_RaySceneQuery *raySceneQuery = mScene->createRayQuery(K_Ray(mCam->getPosition() + K_VECTOR(0,1000000,0), K_VECTOR::NEGATIVE_UNIT_Y));
K_RaySceneQueryResult& qryResult = raySceneQuery->execute();
K_RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
{
if (mCam->getPosition().y < i->worldFragment->singleIntersection.y + 30)
{
mCam->setPosition(mCam->getPosition().x, i->worldFragment->singleIntersection.y + 30, mCam->getPosition().z);
}
}

delete raySceneQuery;

mSea->update(last);
}


Init for Caelum:

E_CODES Core::klinkInitSky()
{
mPaused = false;

Caelum::CaelumSystem::CaelumComponent componentMask;
componentMask = static_cast<Caelum::CaelumSystem::CaelumComponent> (
Caelum::CaelumSystem::CAELUM_COMPONENT_SUN |
Caelum::CaelumSystem::CAELUM_COMPONENT_MOON |
Caelum::CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
//Caelum::CaelumSystem::CAELUM_COMPONENT_IMAGE_STARFIELD |
Caelum::CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD |
Caelum::CaelumSystem::CAELUM_COMPONENT_CLOUDS |
0);
componentMask = Caelum::CaelumSystem::CAELUM_COMPONENTS_DEFAULT;

mSkySystem = new Caelum::CaelumSystem (Root::getSingletonPtr(), mScene, componentMask);

if (!mSkySystem)
{
return E_SKY;
}

mSkySystem->getUniversalClock ()->setTimeScale (512);

//Caelum t listener
mRender->addListener (mSkySystem);
Root::getSingletonPtr()->addFrameListener (mSkySystem);

klinkUpdateSpeedFactor(mSkySystem->getUniversalClock ()->getTimeScale ());

mTimeTillNextUpdate = 0;

return SUCCESS;
}



K_VOID Core::klinkUpdateSpeedFactor(double factor)
{
mSpeedFactor = factor;
mSkySystem->getUniversalClock ()->setTimeScale (mPaused ? 0 : mSpeedFactor);
}


so what i was wrong ? Pls help...

Xavyiy

04-07-2009 12:07:22

Disable caelum's fog.

Fish

04-07-2009 12:38:43

Or try this:

viewtopic.php?p=60686#p60686

-Fish