Page 5 of 23

Posted: Mon May 07, 2007 3:30 pm
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?

Posted: Mon May 07, 2007 9:29 pm
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.

Posted: Fri Jun 08, 2007 1:05 am
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.

Posted: Fri Jun 08, 2007 8:07 am
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.

Posted: Sat Jun 09, 2007 6:07 am
by smartwhiz
wayata go man... thats givin me a solid 225 on FPS...!!!

Posted: Mon Jun 11, 2007 2:14 pm
by C4Cypher
Due to a lack of custom scene node support for the .net wrapper, I'm shifting my focus to using IrrlichtSharp.

Posted: Wed Jun 13, 2007 1:50 pm
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.

Posted: Mon Jul 09, 2007 1:47 pm
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).

Posted: Wed Jul 11, 2007 3:33 am
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

Posted: Wed Jul 11, 2007 9:34 am
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.

Posted: Wed Jul 11, 2007 1:26 pm
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

Posted: Fri Jul 13, 2007 11:47 pm
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.

Posted: Sun Jul 15, 2007 10:55 am
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

Posted: Sun Jul 15, 2007 3:08 pm
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.

Posted: Sun Jul 15, 2007 3:28 pm
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