Releasing Terrain resources ?

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Releasing Terrain resources ?

Post by DeusXL »

Hello everyone,

I switched to Irrlicht .NET recently and I come with a couple of questions on "how to release resources".
Here's the problem :
My world is composed by many terrains (heightmap + texture) and I load them with a basic addTerrainSceneNode. The problem comes when a player leaves on of these terrains... I tried everything but whatever I do, no RAM is released and whenever he re-enters, the resource for the terrain (~50 MO) are reallocated... Moreover, with each new terrain loaded I lose ~10 FPS even if I release old terrain... I even tried to modify .NET wrapper to release resources but nothing has worked... Is there a way to solve this problem ?

2nd "problem" :
I use 256x256 heightmaps and I need to scale them greatly... When there were moutains, the render was horrible, not smoothed at all...
I modified "bool CTerrainSceneNode::loadHeightMap( io::IReadFile* file, video::SColor vertexColor )" in Irrlicht base library and added :

Code: Select all

for(s32 i = 0; i < 10; i++)
{
	for(int index = 2; index < (TerrainData.Size * TerrainData.Size - 2); index++)
    {
           pMeshBuffer->Vertices[index].Pos.Y = 
               (pMeshBuffer->Vertices[index - 2].Pos.Y + pMeshBuffer->Vertices[index - 1].Pos.Y +
                pMeshBuffer->Vertices[index + 1].Pos.Y + pMeshBuffer->Vertices[index + 2].Pos.Y) / 4;
    }
}
The result is quite prettier, I was just wondering if I wasn't adding some "issues" and/or if there was any other better way to solve this problem.

Thank you for everything (more than all for trying to understand my terrible english :p)
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
HantaCore
Posts: 21
Joined: Wed Mar 22, 2006 4:38 pm

Post by HantaCore »

we could try to add some "Disposable" attributes to the classes (like ITerrainSceneNode), calling the destructor of the native instance for exemple... but that's just an idea :)
Currently working on a C# MMORPG using Irrlicht.NET
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

Actually I add a dispose (heriting from IDisposable) function who "drops" (I remember that "drop" calls the destructor of the object) the base SceneNode and it works almost perfectly : now I get the fps back and i gain 80% of RAM released... Better than 0% and no fps but not perfect :roll:
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
HantaCore
Posts: 21
Joined: Wed Mar 22, 2006 4:38 pm

Post by HantaCore »

great ;)
Currently working on a C# MMORPG using Irrlicht.NET
Locked