Hey guys!
I started using Irrlicht yesterday after looking it over for awhile and so
I dived right into the complicated stuff.
Now my first project is sort of an experimental lets-learn-Irrlicht-inside-out
project and what I'm trying to accomplish is to load the world geometry
from an ancient 10 year old game, Tomb Raider actually, and so far I've
managed to correctly load all the world geometry and display it in Irrlicht
but right now it's kinda ugly because I haven't loaded textures or implemented
the portal renderer so in some of the later levels (like LEVEL4.PHD, St. Francis Folley)
and as a result some of the rooms overlap each other and so forth.
So I was hoping I could get some tips from some of the gurus.
First up is I need to be able to finish loading the room loading by adding
textures and the reason this is puzzling is because the rooms are defined by a series of rectangles and triangles which in turn define the tileset
they use along with their U/V coordinates
(Tiles are just texture maps with a bunch of textures on it)
so I need to be able to define multiple materials or something
on one mesh - can I define this on the mesh buffer level or something?
And second is that I need to be able to load the tilesets into the video
memory as a texture, how do I create a texture and upload the bitmap information in Irrlicht?
Third is that animated textures in TR are, from my understanding, are
created by changing the U/V coordinates of the triangle or rectangle
in question so I assume I just use an animated mesh for this?
I'm not too worried about the portal rendering issue right now
since I just want to go and accomplish my goal step by step.
I should probably also mention that I'm used to working in OpenGL.
Thanks!
How should I do this stuff?
materials, textures, etc.
You need to give us more info. How do you load TR level (convert to
.3ds, then load), or you got implemented a loader for .PHD, what is .phd
anyway (except it is TR level geometry format)? You want to texture map
this geometry but what problem exactly do you have?
You need maybe ultiple textures on one material and not multiple materials for mesh?
-Textures:
Until you explain a bit more here are
the basics of loading textures (though i bet you know this):
.3ds, then load), or you got implemented a loader for .PHD, what is .phd
anyway (except it is TR level geometry format)? You want to texture map
this geometry but what problem exactly do you have?
this i don't quite understand, what you wanted to say...the rooms are defined by a series of rectangles and triangles which in turn define the tileset
they use along with their U/V coordinates
You need maybe ultiple textures on one material and not multiple materials for mesh?
-Textures:
Until you explain a bit more here are
the basics of loading textures (though i bet you know this):
Code: Select all
video::ITexture* texture001 = driver->getTexture("../../data/textures/some-texture.bmp"); //you can use tga,jpg...
scenenode1->setMaterialTexture(0, driver->getTexture("../../media/spheremap.jpg"));
//when you have a scene node to attach tex to it-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Yes, mesh buffers are used to have several materials in one mesh. Each buffer has a set of faces (vertices and indices) combined with exactly one material. If several material share a vertex you have to duplicate it into all buffers.
If you have the bitmap already loaded (as an IImage) you can add the texture via the driver. But you could even just create a MemoryReadFile from some portion of the binary stream and call getTexture on that Reader - at least if the stream contains a supported image format. Just check the IVideoDriver API.
If you want to animate texture coords you should use Texture Matrices. They allow for transformation of UV coords per material and texture layer. You'd have to create some kind of scene node animator which applies (and interpolates) texture matrices based on a timeline.
If you have the bitmap already loaded (as an IImage) you can add the texture via the driver. But you could even just create a MemoryReadFile from some portion of the binary stream and call getTexture on that Reader - at least if the stream contains a supported image format. Just check the IVideoDriver API.
If you want to animate texture coords you should use Texture Matrices. They allow for transformation of UV coords per material and texture layer. You'd have to create some kind of scene node animator which applies (and interpolates) texture matrices based on a timeline.
-
constchar*
- Posts: 14
- Joined: Thu Sep 20, 2007 3:57 am
Re: materials, textures, etc.
I load the PHD file directly into Irrlicht by reading the file and thenmiha wrote:You need to give us more info.
converting the mesh information from the file into a mesh buffer.
The textures are held in the PHD file in a 8-bit format so I need to
create a texture object somehow and lock it where I can then set
the pixel data and then unlock it so Irrlicht can upload it to the video memory.
Tomb Raider level formats:
http://www.tnlc.com/eep/tr/TRosettaStone.html
Screenshot of my work: (I have EDS_BBOX enabled so I can see the bounds of the rooms)
