[solved] setOption( "PaintCenter", ...) has no eff

Maxi

05-11-2007 21:26:44

Hi

I trie to paint parts of the terrain, but I can't see any effect.

The coords for the paintCenter should be ok; they work well in my deformation function.
I have no idea what the values in the channel array exactly mean, for example which is the alpha value, so I tried it with different settings but none worked.
After searching the board I wonder why I have not seen anyone setting brushScale in posts about painting; with scales >= 1 I get asserts from std::vector so I used the scale that I use for deformation, but I have no idea why painting is influenced by scaling after all.

I hope someone can tell me what I do wrong and how to do it right.

My code for painting the terrain looks like this at the moment:

void paint(float x, float y)
{
Ogre::Real scale = 1;
scale = scale / 9000;
Ogre::Real barray[65536];


for(int i=0; i < this->m_BrushSize * this->m_BrushSize; i++)
{
barray[i] = 1.0f;
};

float channel[4];
channel[0] = 1.0f;
channel[1] = 0.0f;
channel[2] = 0.0f;
channel[3] = 0.0f;

this->m_OgreSceneManager->setOption( "BrushScale", &scale );
this->m_OgreSceneManager->setOption( "BrushArrayWidth", &this->m_BrushSize );
this->m_OgreSceneManager->setOption( "BrushArrayHeight", &this->m_BrushSize );
this->m_OgreSceneManager->setOption( "setPaintChannelValues", &channel );
this->m_OgreSceneManager->setOption( "BrushArray", barray );
this->m_OgreSceneManager->setOption( "PaintCenter", &(it->worldFragment->singleIntersection) );
}


My config file for the terrain:

GroupName=PLSM2

LandScapeFileName=test
FileSystem=LandScapeFileName

Width=1
Height=1


Data2DFormat=HeightField

ScaleX=9000
ScaleY=9000
ScaleZ=9000


NumTextureFormatSupported=17

TextureFormatSupported0=Base
TextureFormatSupported1=Base2
TextureFormatSupported2=InstantBase
TextureFormatSupported3=Splatting
TextureFormatSupported4=Splatting2
TextureFormatSupported5=Splatting4
TextureFormatSupported6=Splatting6
TextureFormatSupported7=Splatting7
TextureFormatSupported8=Base
TextureFormatSupported9=Base2
TextureFormatSupported10=InstantBase
TextureFormatSupported11=Splatting3
TextureFormatSupported12=Splatting5
TextureFormatSupported13=SplattingShader

TextureFormat=InstantBase
TextureStretchFactor=2
VertexNormals=no
Deformable=yes
TextureModifiable=yes


NumMatHeightSplat=4

MaterialHeight1=15
MaterialHeight2=50

SplatFilename0=splatting_sand.png
SplatFilename1=splatting_grass.png
SplatFilename2=splatting_rock.png
SplatFilename3=splatting_snow.png

VisibleRenderables=256
MaxRenderLevel=5

Maxi

08-11-2007 10:42:56

Perhapse answering my questions will be easyer for you if I phrase them explicitly :D :

:?: What paramters do I set by using setOption( "setPaintChannelValues", &channel );?


:?: How does setOption("setScale" &scale) influence painting?


:?: Why does the code in my first post not paint the terrain?

Maxi

08-11-2007 20:09:56

I figured out the following:

My code won't change the terrain because of the scale value; using a value of 1 gives me an assertion in "PagingLandScapeTexture::paintPoint()".
So my problem seems to be the bug reported here: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=5270

Has anyone found a clean solution for it?

Maxi

09-11-2007 23:28:40

Shame on me :D

setOption( "setPaintChannelValues", ...
only takes a std::vector as parameter