Application method of addTerrainSceneNode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
idrose1025
Posts: 17
Joined: Mon May 08, 2006 8:58 am

Application method of addTerrainSceneNode

Post by idrose1025 »

Hello, I do not speak well English.

Much sorry .

16 images

Width 4 / Length 4

Want to sort.

16 images accomplish one map.

Want to appear on screen so.

16 image sizes are same all. [256 / 256]

Image

Want to understand method.

Ask counsel.
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

I m afraid i have not understand you problem ...
it seem you want make an image from 16 little images?

if yes here some point

1) Generate buffers:
1 for the 16 little images

1 fro the main image

2) Load the tile image into1 buffer ( createImageFromFile(...) )

3) copy the little tiles image into the main image buffer
something like this :

while( TileSrcheight > 0 ){
memcpy(&u4DestImage[iMosaicPos], &u4SrcImg[iPos], ( TileSrcWidth *4)); //Add an entire line of pixwels * color bytes (the image color format)
iPos += (TileSrcWidth );
iMosaicPos += (iDestwidth ) ; //Next Pixeel Row
TileSrcheight --;
}

repeat point 2),3) for every 16 tile images



4) tranform the image buffer nto an Iimage
DrwImgArr = driver->createImageFromData( format ,dimension2d<s32>(Imagewidth, Imageheigh ),u4FullImage,true );
5) generate texture from the image
TeturImgArr = driver->addTexture("ImageBuff", DrwImgArr);
6) add texture to an iGuiImage
UsrImgArr->setImage( TeturImgArr );



(
IGUIImage * UsrImgArr;
UsrImgArr = guienv->addImage(rect<s32>( 0 ,0 , Imagewidth, Imageheigh ));

IImage * DrwImgArr;
ITexture* TeturImgArr;
)

may be there i s a easier way using irrlicht favcilities
but i dont know.

Bye
idrose1025
Posts: 17
Joined: Mon May 08, 2006 8:58 am

Post by idrose1025 »

Hello

How must all 16 images do if is different?

Want to do via this method.

Code: Select all

scene::ITerrainSceneNode* terrain = NULL;
terrain = smgr->addTerrainSceneNode("image/map/plain_00.bmp");
	terrain->setScale(core::vector3df(64, 8, 64));
	terrain->setMaterialFlag(video::EMF_LIGHTING, false);
	terrain->setMaterialTexture(0, driver->getTexture("image/map/terrain-texture.jpg"));
	terrain->setMaterialTexture(1, driver->getTexture("image/map/detailmap3.jpg"));
	terrain->setMaterialType(video::EMT_DETAIL_MAP);
	terrain->scaleTexture(1.0f, 20.0f);

	// create triangle selector for the terrain	
	scene::ITriangleSelector* selector
		= smgr->createTerrainTriangleSelector(terrain, 0);
	terrain->setTriangleSelector(selector);
	mainTriangleSelector->addTriangleSelector(selector);
	selector->drop();

Help more once

Thank you .
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

Hi
for what i know addTerrainSceneNode(... take as parameter only a file name

may be you colod save the new image into a file?(i never tried it)
or
i saw a thread of 1 month ago about how to load from memory data , but now i don t remember its name, the goal was to override the addTerrainSceneNode function adding code to load from memory

bye
Post Reply