Simple Terrain Class
Simple Terrain Class
Hi
My game went all slow so I did some simple profiling and well, it's really CPU bound
and it seemed that the Terrain node ate most of the CPU (I have several terrains visible ingame).
First I tried (stupidly) to use VBO but as the terrain optimizes itself each frame that was no good so I wrote a 'fixed' (as in 'not changing')
terrain class that works about the same as the original one (but with VBO) so I though I'd share it here.
BTW my game went from ~15fps to 150+ so for me it was the right thing to do
MSVC project (Windows exe included that shows original and new terrain).
My game went all slow so I did some simple profiling and well, it's really CPU bound
and it seemed that the Terrain node ate most of the CPU (I have several terrains visible ingame).
First I tried (stupidly) to use VBO but as the terrain optimizes itself each frame that was no good so I wrote a 'fixed' (as in 'not changing')
terrain class that works about the same as the original one (but with VBO) so I though I'd share it here.
BTW my game went from ~15fps to 150+ so for me it was the right thing to do
MSVC project (Windows exe included that shows original and new terrain).
This is cool. Nice work. I just testes the demo, haven't yet looked at the code. Is it easy to replace an original terrainscenenode by yours?
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
nice example
I am wondering could the default ITerrainSceneNode has the ability to be a static terrain officially?
I mean some additional function like
I am wondering could the default ITerrainSceneNode has the ability to be a static terrain officially?
I mean some additional function like
Code: Select all
bool setStaticTerrain(bool isStatic);
Thanks for the nice comments
@Brainsaw
It's not Exactly the same but switching shouldn't bee too hard, if you use
32-bits floating point maps you only need to change the creation call.
Well, the example uses a shader and IIRC the original has some sort of
'base texture' + 'detail map', don't know if that works with a 'normal' mesh.
Feel free to use the shader bundled though.
@vinjn
Or just add this code to Irrlicht (with loaders for 8 & 16 bits and surely some tweaking)?
@Brainsaw
It's not Exactly the same but switching shouldn't bee too hard, if you use
32-bits floating point maps you only need to change the creation call.
Well, the example uses a shader and IIRC the original has some sort of
'base texture' + 'detail map', don't know if that works with a 'normal' mesh.
Feel free to use the shader bundled though.
@vinjn
Or just add this code to Irrlicht (with loaders for 8 & 16 bits and surely some tweaking)?
OK, I'm now back from my vacation and I think I'll take a closer look within the next days, I think I'll try to create an IrrEdit plugin using the terrain (because I always create IrrEdit plugins ). I just try to do put as much of the necessary code into a plugin so that I don't have to code much specific stuff inside my programs but let the loadscene method do the necessary.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
this is superb!
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
In both versions I get black terrain. I guess it is not supposed to be black.
I get "Could not create hlsl shader" and "Shader number = -1" in the console window. Well, shader version 3.0 on my Radeon 9550...
I get "Could not create hlsl shader" and "Shader number = -1" in the console window. Well, shader version 3.0 on my Radeon 9550...
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Hello
Great job !!!
Thanks for your sharing
Unfortunately, I have the same issue than Shadowslair when i try to compile your sample.
The two versions are black
Radeon 5700
Your exe file + your irrlicht dll => ok
msvc 2005 + irrlichit 1.7.1
0 => black
1 => crash on m_MeshNode=smgr->addMeshSceneNode(m_Mesh,parent,-1,core::vector3df(0,0,0));
msvc express 2010 + irrlichit 1.7.1
0 => black
1 => crash on m_MeshNode=smgr->addMeshSceneNode(m_Mesh,parent,-1,core::vector3df(0,0,0));
msvc express 2010 + irrlichit 1.8.0 alpha
0 => black
1 => black
Run with no errors on console
I have missed something ?
Thanks in advance
Great job !!!
Thanks for your sharing
Unfortunately, I have the same issue than Shadowslair when i try to compile your sample.
The two versions are black
Radeon 5700
Your exe file + your irrlicht dll => ok
msvc 2005 + irrlichit 1.7.1
0 => black
1 => crash on m_MeshNode=smgr->addMeshSceneNode(m_Mesh,parent,-1,core::vector3df(0,0,0));
msvc express 2010 + irrlichit 1.7.1
0 => black
1 => crash on m_MeshNode=smgr->addMeshSceneNode(m_Mesh,parent,-1,core::vector3df(0,0,0));
msvc express 2010 + irrlichit 1.8.0 alpha
0 => black
1 => black
Run with no errors on console
I have missed something ?
Thanks in advance