[help]Save Deformation not saving...[SOLVED]

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:
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

tuan kuranes

03-07-2008 12:34:17

SVN version has it working with does that work with 'terragen' terrain.
Check if you can make it work (terragen + demo) and then reproduce the same in your application.

grelot

03-07-2008 19:12:19

found a _save method that saved the terragen one with the demo but it's so far i cant seems to get to it and use it.. if it's what i need...

btw.. thank =P

if there's any way i can get to the _save method i'll let you know..

:EDIT: i'm talking about the _save method of PagingLandScapeData2D_HeightField this is the one that save the terragen with the demo...

grelot

07-07-2008 14:53:41

in the setOption of paginglandscapescenemanage add

if (strKey == "Save")
{
mData2DManager->getData2D(0,0)->_save();
return true;
}


0,0 depending of the page you wanna save
the strKey can be change to whatever you like...

and call setOption("Save", NULL ) to save manually...

tada..

thanks for the help...