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:
My config file for the terrain:
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