rt15
23-11-2006 15:02:32
Hello,
First of all, congratulation for PLSM2, which is very useful for me.
And sorry for my horrible english...
I am working on tools which would able to deform a Landscape.
Unfornately, I don't achieve to change any height.
I found two ways :
One with DeformationCenter which may work relatively to current height.
An other with setHeightCenter which may work with asolute coordinates.
I use BrushScale, BrushArrayWidth, BrushArrayHeight and BrushArray options to set up the brush.
I also use fillBrushArray when I try to use setHeightCenter.
Here are two of my tests (They would raise a part of the land of 100) :
Cursor::getInstance()->getSize() return a number between 10 and 510.
Diveded by 512, it's between 0 and 1.
Cursor::getInstance()->getCenter(Center) put in Center a valid point on the land.
The first code do nothing.
The second one failed on an assertion of mNumTexture > 0.
And finally, the cfg file we are using, which could help you to help me :
Does anybody can help me please ?
First of all, congratulation for PLSM2, which is very useful for me.
And sorry for my horrible english...
I am working on tools which would able to deform a Landscape.
Unfornately, I don't achieve to change any height.
I found two ways :
One with DeformationCenter which may work relatively to current height.
An other with setHeightCenter which may work with asolute coordinates.
I use BrushScale, BrushArrayWidth, BrushArrayHeight and BrushArray options to set up the brush.
I also use fillBrushArray when I try to use setHeightCenter.
Here are two of my tests (They would raise a part of the land of 100) :
Ogre::Vector3 Center;
if (Cursor::getInstance()->getCenter(Center))
{
Ogre::uint i;
// Select scale
Ogre::Real brushScale(Cursor::getInstance()->getSize() / 512);
mSceneMgr->setOption("BrushScale", &brushScale);
// Select size
i = 512;
mSceneMgr->setOption("BrushArrayWidth", &i);
mSceneMgr->setOption("BrushArrayHeight", &i);
// Put the array
Ogre::Real * deltaArray = new Ogre::Real[512 * 512];
mSceneMgr->setOption("BrushArray", deltaArray);
// Put value in the array
for (i = 0 ; i < 512 * 512 ; i++)
deltaArray[i] = 100;
// Deform
mSceneMgr->setOption("DeformationCenter", &Center);
}
Ogre::Vector3 Center;
if (Cursor::getInstance()->getCenter(Center))
{
Ogre::uint i;
// Select scale
Ogre::Real brushScale(Cursor::getInstance()->getSize() / 512);
mSceneMgr->setOption("BrushScale", &brushScale);
// Select size
i = 512;
mSceneMgr->setOption("BrushArrayWidth", &i);
mSceneMgr->setOption("BrushArrayHeight", &i);
// Put the array
Ogre::Real * deltaArray = new Ogre::Real[512 * 512];
mSceneMgr->setOption("BrushArray", deltaArray);
// Get current values
mSceneMgr->setOption("fillBrushArray", &Center);
// Update values
for (i = 0 ; i < 512 * 512 ; i++)
deltaArray[i] = deltaArray[i] + 100;
// Affect values
mSceneMgr->setOption("setHeightCenter", &Center);
}
Cursor::getInstance()->getSize() return a number between 10 and 510.
Diveded by 512, it's between 0 and 1.
Cursor::getInstance()->getCenter(Center) put in Center a valid point on the land.
The first code do nothing.
The second one failed on an assertion of mNumTexture > 0.
And finally, the cfg file we are using, which could help you to help me :
GroupName=Terrain
LandScapeFileName=sol_8Map3
FileSystem=MapErgonia
Width=3
Height=3
ScaleX=512
ScaleY=1000
ScaleZ=512
Deformable=yes
VertexCompression=no
VertexProgramMorph=yes
MaxPixelError=8
textureModifiable=yes
TextureStretchFactor=1
NumTextureFormatSupported=1
MaterialPerPage=yes
TextureFormatSupported0=ImagePaging
TextureFormat=ImagePaging
ImageFilename=ergonia_solMapAlpha3
VisibleRenderables=2048
NumRenderablesLoading=100
RenderableLoadInterval=20
MaxAdjacentPages=6
MaxPreloadedPages=4
PageLoadInterval=10
MaxNumRenderables=512
IncrementRenderables=512
MaxNumTiles=512
IncrementTiles=512
HorizonVisibilityComputing=no
# where to put camera on load.
BaseCameraViewpoint.x=0.0f
BaseCameraViewpoint.y=60.0f
BaseCameraViewpoint.z=0.0f
Baselookat.x=0.0f
Baselookat.y=60.0f
Baselookat.z=0.0f
Does anybody can help me please ?