New Tiled Terrain Scene Node [works with Irr 1.5]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

By library I mean Irrlicht.dll ...are you using one from demo or your own one?

Its strange, if terrain->drop() returns false there is no apparent reason why it should crash...

Did you tried some other compilers except Digital Mars and Borland Turbo Explorer?
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

Ok...I tried it with both DLLs,the one that comes with the demo and the one I made.The result is the same,after alt +F4 I get :'Tiled.exe has encountered a problem and needs to close.'I named my build project 'Tiled'.

Besides those 2 compilers I have tried it with the free Borland command line tools,BCC55.With the same result.

I do not have any Microsoft compilers installed at the moment.

I have a copy of Microsoft 2003 on a backup CD someplace,let me try that.
C4Cypher
Posts: 10
Joined: Tue Jun 05, 2007 12:17 pm

Post by C4Cypher »

I'm going to give a shot at translating this source to VB.Net, if I do it right, the resulting class should be compatable with the rest of the .Net languages. I know just enough C++ to wade my way through, the only problem being struct inheritance. VB structures can't inherit, so I'm going to have to go into the Irrlicht header files to find some of the parent definitions. Also, a lot of structs used in the original Cpp source would probably be better as simple classes in VB.

If somone has already ported this to .Net, please let me know before I get deeper into this.

Arras, this is a wonderful class you've built.
"I got a present for you" -Commando
"May the way of the Hero Lead to the Triforce" -If you have to ask, I'll beat you with a herring
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Thanks C4Cypher. neotoma was working on some wrapper lately but I dont know status of his work. As for VB unfortunately I have no knoweledge of it so I cant help. As for structures and classes in C++ only diference is default public/private setup and for classes constructor and destructor is automaticly created by compiler if you dont provide one.

Good luck.
smartwhiz
Posts: 120
Joined: Wed Jan 14, 2004 6:03 pm
Location: India

Post by smartwhiz »

wayata go man... thats givin me a solid 225 on FPS...!!!
Thanks and With Regards
Smartwhiz
C4Cypher
Posts: 10
Joined: Tue Jun 05, 2007 12:17 pm

Post by C4Cypher »

Due to a lack of custom scene node support for the .net wrapper, I'm shifting my focus to using IrrlichtSharp.
"I got a present for you" -Commando
"May the way of the Hero Lead to the Triforce" -If you have to ask, I'll beat you with a herring
C4Cypher
Posts: 10
Joined: Tue Jun 05, 2007 12:17 pm

Post by C4Cypher »

For the time being, I'm shifting focus to a more .net friendly environment, and I'm trying to design my own terrain algorythm, but I'm going to be borrowing from arra's design, and I'll be giving him an acknowledgement in my code.

I'm hoping to abstract the game engine from the rendering process to the point that migrating it to different rendering engines will be a simple process, so a possible port to irrlicht in one of it's forms is a future possibility. Thanks guys for your help, discussion and all of the wonderful documentation.
"I got a present for you" -Commando
"May the way of the Hero Lead to the Triforce" -If you have to ask, I'll beat you with a herring
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

I use ShTLTerrainSceneNode in my project, but it had a lot of signed/unsigned warnings. I edited it, so that it doesn't throw any warning. Here is the edited code:
http://ebbsoft.netgames.lv/files/ShTlTerrainSceneNode.zip

P.S. I have changed nothing in the code but the types of variables to signed/unsigned where needed. If you plan to continue developing it arras, please use my code, so that it is safe against data loss (signed/unsigned missmatch).
rwrz
Posts: 3
Joined: Sat Jul 16, 2005 12:01 am

Post by rwrz »

Hello,

Im testing this class a lot here.
I like a lot too.

But, how can i have this terrain working with irrlicht collision detection ?

Thanks

Rodrigo
In Lak'Ech
Im another of you!
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

But, how can i have this terrain working with irrlicht collision detection ?
I made an addon for this class: I added a triangle selector for each mesh, which you will be able to use with irrlicht collision system. I will post it here later.
rwrz
Posts: 3
Joined: Sat Jul 16, 2005 12:01 am

Post by rwrz »

Cool.

Its a nice idea. Do you want to send it to me ? I can host this file.
Send to my email if you want: rodrigo.rwrz@gmail.com

Thanks


Now, another question ... To make a larger view of terrain, i just need to chenge the tileSize ? So i can render bigger terrains, right ?

But i will can put only 1 texture per tile ? Or i can put a texture in a half of a tile ?

Thanks

Rodrigo
In Lak'Ech
Im another of you!
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

elvman >> thanks a lot, realy nice from you. I use Dev C++ and I would need to switch to another compiler in order to clean it up.

rwrz >> Try to awoid collision detection with terrain if possible. Its slow. Mostly what you need is getHeight() function. Terrain also include getIntersectionWithLine() function for line of sight, bullet collision or similar. I spended lot of time optimizing it.
To make a larger view of terrain, i just need to chenge the tileSize
Right. Or you can increase size of vissible mesh. That will decrease performance of course.
But i will can put only 1 texture per tile ? Or i can put a texture in a half of a tile ?
Terrain use only one texture (well it use 2 but one of them is created internaly). This texture however can be put together from seweral smaller textures (texture tiles). Terrain contain functions which allowe you to set UV coordinates of individual tiles so each tile can display diferent texture tile.
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Arras, can you post some code showing how to use the heightmap method of making your tiled terrain node? I can't seem to get it working :P
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Yes:

Following code will create the same terrain as Irrlicht TerrainRendering example. All textures are one from this example. You can find them in Irrlicht media directory.

Code: Select all

#include <irrlicht.h>
using namespace irr;

#include "ShTlTerrainSceneNode.h"

int main()
{
    IrrlichtDevice *device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800, 600), 32, false, false, false, 0);
    
    video::IVideoDriver *driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
    
    // create terrain scene node
    ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, 255, 255, 1, 100);
	terrain->drop();
	
	// load height data from texture
	terrain->loadHeightMap("terrain-heightmap.bmp", 10);
	
	// load color map
	terrain->loadColorMap("terrain-texture.jpg");
	
	// set detail texture
	terrain->setMaterialTexture(0, driver->getTexture("detailmap3.jpg"));
	
	// smooth normals
	terrain->smoothNormals();
	
	terrain->setMaterialFlag(video::EMF_LIGHTING, false);
	
	scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
	
	// set terrain to follow camera
	terrain->follow(camera);
	
	while(device->run())
    {
        driver->beginScene(true, true, video::SColor(255,100,101,140));

		smgr->drawAll();
		
		driver->endScene();
    }
    device->drop();
    
    return 0;
}
Only diference will be scale of terrain-texture.jpg since it is larger than terrain itself.
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Ah.. Is there a way to make the detailmap repeat less? I notice I cannot use the ->scaleTexture(); function. Otherwise it worked perfectly :D
Post Reply