grelot
02-07-2008 20:20:33
before : great work keep it going...
now :
ok my problem is, i wanna save my deformation.. i checked a lot the forum and almost all the topic about save.. and tried the setOption saveDeformation but no luck.. i know the deformation is saved at page unload, like when you close the soft.. but no luck there... i know too that SaveDeformation must = yes in the cfg file... there's too =yes but again no deformation saved... i read somewhere that the deformation file is suppose to be saved where the heightmap file is.. but nada.. no modification saved... so the question is basically : is there any way to call a save method with some kind of path or anything else that will make the deformation save...
info if needed goes like this :
my cfg:
my code to deform :
this deform the heightmap in my heightmap editor... but no luck saving the deformation...
thank you in advance...
Grelot
now :
ok my problem is, i wanna save my deformation.. i checked a lot the forum and almost all the topic about save.. and tried the setOption saveDeformation but no luck.. i know the deformation is saved at page unload, like when you close the soft.. but no luck there... i know too that SaveDeformation must = yes in the cfg file... there's too =yes but again no deformation saved... i read somewhere that the deformation file is suppose to be saved where the heightmap file is.. but nada.. no modification saved... so the question is basically : is there any way to call a save method with some kind of path or anything else that will make the deformation save...
info if needed goes like this :
my cfg:
GroupName=PLSM2
LandScapeFileName=ValtonValley.v16.100
FileSystem=LandScapeFileName
PageSize=2049
TileSize=33
Width=1
Height=1
ScaleX=2049
ScaleY=515
ScaleZ=2049
Deformable=yes
VertexCompression=yes
VertexProgramMorph=yes
MaxPixelError=4
VertexNormals=yes
NumTextureFormatSupported=18
TextureFormatSupported0=Base
TextureFormatSupported1=Base2
TextureFormatSupported2=InstantBase
TextureFormatSupported3=Splatting
TextureFormatSupported4=Splatting2
TextureFormatSupported5=Splatting4
TextureFormatSupported6=Splatting6
TextureFormatSupported7=Splatting7
TextureFormatSupported8=Base
TextureFormatSupported9=Base2
TextureFormatSupported10=InstantBaseShadowed
TextureFormatSupported11=Splatting3
TextureFormatSupported12=Splatting5
TextureFormatSupported13=SplattingShader
TextureStretchFactor=1
TextureFormat=Base
#Shadowed
MaterialHeight1=33
MaterialHeight2=66
MaterialHeight3=100
NumMatHeightSplat=4
SplatFilename0=splatting_sand.png
SplatFilename1=splatting_grass.png
SplatFilename2=splatting_rock.png
SplatFilename3=splatting_snow.png
VisibleRenderables=150
NumRenderablesLoading=10
RenderableLoadInterval=3
MaxAdjacentPages=1
MaxPreloadedPages=2
PageLoadInterval=5
MaxNumRenderables=256
IncrementRenderables=256
MaxNumTiles=256
IncrementTiles=256
SaveDeformation=yes
#VertexLit = yes
#TextureModifiable=yes
MaterialDistanceLod=15000
#HorizonVisibilityComputing=yes
RoughnessLod=no
DistanceLOD=10.1
LightMap=yes
Sunx=-0.32f
Suny=0.38f
Sunz=0.87f
Ambient=0.5f
Diffuse=0.5f
Blur=0.0f
# where to put camera on load.
BaseCameraViewpoint.x=0.0f
BaseCameraViewpoint.y=500.0f
BaseCameraViewpoint.z=0.0f
Baselookat.x=0.0f
Baselookat.y=500.0f
Baselookat.z=100.0f
my code to deform :
case TokenDelivery::TKN_ACT_ADD: //when clicked
{
Ogre::uint bsi = 10;
Ogre::uint bwh = 5;
float bsc = 1.5f;
if ( tconfig->mAttributes.find( "BrushScale" ) != tconfig->mAttributes.end() )
bsc = tconfig->mAttributes["BrushScale"]->mReal;
if ( tconfig->mAttributes.find( "BrushSize" ) != tconfig->mAttributes.end() )
bsi = tconfig->mAttributes["BrushSize"]->mInt;
mBrushArray = new float[(bsi*2)*(bsi*2)];
CoreGame::GraphicSupport* graphicSupport = CoreGame::GraphicSupport::AddRef();
/* bool sa = true;
graphicSupport->GetOgreGameSceneMgr().setOption("SaveDeformation", &sa);
*/ commented to try with and without...
graphicSupport->GetOgreGameSceneMgr().setOption( "BrushScale", &bsc );
graphicSupport->GetOgreGameSceneMgr().setOption( "BrushSize", &bsi );
graphicSupport->Release();
case TokenDelivery::TKN_ACT_ADD: //when pressed and mouving...
{
if ( mDeleting == true )
{
CoreGame::GraphicSupport* graphicSupport = CoreGame::GraphicSupport::AddRef();
const std::string& className = delivery.GetClassName();
CoreGame::TokenDef::Token* tconfig = delivery.GetTokenDef().GetClasses().find( className )->second->mTokens.find( delivery.GetTokenName() )->second;
std::string brushType = delivery.GetTokenName();
//
Ogre::uint bwh = 5;
Ogre::uint bsi = 10;
if ( tconfig->mAttributes.find( "BrushSize" ) != tconfig->mAttributes.end() )
bsi = tconfig->mAttributes["BrushSize"]->mInt;
if ( tconfig->mAttributes.find( "BrushWH" ) != tconfig->mAttributes.end() )
bwh = tconfig->mAttributes["BrushWH"]->mInt;
for(int i=0; i<(bsi*2)*(bsi*2);++i)
{
mBrushArray[i] = 1.0f;
}
graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArray", mBrushArray );
//graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArrayHeight", &(bsi*2) );
//graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArrayWidth", &(bsi*2) );
float offX, offY, offZ;
offX = offY = offZ = 0.0f;
/* graphicSupport->GetOgreGameSceneMgr().getOption( "PositionX", &offX);
graphicSupport->GetOgreGameSceneMgr().getOption( "PositionY", &offY);
graphicSupport->GetOgreGameSceneMgr().getOption( "PositionZ", &offZ); */ depend on the map need to be fixed :D
offX = SysRunConfig->GetFloatValue("HeightMapX");
offY = SysRunConfig->GetFloatValue("HeightMapY");
offZ = SysRunConfig->GetFloatValue("HeightMapZ");
Ogre::Vector3 hit(vertex.GetX()-offX,vertex.GetY()-offY,vertex.GetZ()-offZ);
//graphicSupport->GetOgreGameSceneMgr().setOption("fillBrushArray", &hit); for later use...
if( brushType.compare( "Deform" ) == 0 )
{
graphicSupport->GetOgreGameSceneMgr().setOption( "DeformationCenter", &hit);
}
...
this deform the heightmap in my heightmap editor... but no luck saving the deformation...
thank you in advance...
Grelot