Texture selection
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
Texture selection
Hi all,
I am having a sm.bsp in that there are a number of textures and b3d files.
So here are my question :
1:- can i interact with those textures
2: When i use getMesh(sm.bsp ) a lot of b3d files also get loaded with it i am not able to animate them is it possible to interact with such animated files
if yes then pls give me some idea or if possible some link will be very help full
I m making a game in which the player has to interact with such textures depending on the task given
thanks
I am having a sm.bsp in that there are a number of textures and b3d files.
So here are my question :
1:- can i interact with those textures
2: When i use getMesh(sm.bsp ) a lot of b3d files also get loaded with it i am not able to animate them is it possible to interact with such animated files
if yes then pls give me some idea or if possible some link will be very help full
I m making a game in which the player has to interact with such textures depending on the task given
thanks
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
yes i mean textures
like i have got some items in supermarket then the player has to click on those textures and i should know the texture on which player has clicked
i know how to put the b3d files etc and then clicking on them i can know that
this b3d file has been clicked and so i get the score
but putting so many b3d models on my supermarket takes lot of memory and i cant play the game .
so if i put simple textures then size of supermarket will be low and i can play the game
like i have got some items in supermarket then the player has to click on those textures and i should know the texture on which player has clicked
i know how to put the b3d files etc and then clicking on them i can know that
this b3d file has been clicked and so i get the score
but putting so many b3d models on my supermarket takes lot of memory and i cant play the game .
so if i put simple textures then size of supermarket will be low and i can play the game
I think he wants to get the texture from a scenenode.
maybe you're searching for this:
maybe you're searching for this:
and this:irr::scene::ISceneNode Class Reference wrote:virtual video::SMaterial & getMaterial (u32 num)
Returns the material based on the zero based index i.
irr::video::SMaterial Class Reference wrote:ITexture * getTexture (u32 i) const
Gets the i-th texture.
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Sorry, I can't think of an easy way to do that. Irrlicht's collision detection only tells you the geometry of the intersected triangle, not which node it's part of. There's some patches in the tracker that address this, but I think they've rotted.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Finding the clicked triangle is easy, covered in the collision tutorial, but finding what texture is applied to that is harder i think...
i guess maybe you'd have to check each meshbuffer of your model and see if the clicked triangleis within that meshbuffer, which i suppose you could do by checking each set of 3 indices in the meshbuffer (which form a triangle of the mesh) and see if the vertices those indices refer to are at the same position as the 3 vertices in the clicked triangle. when you've found the triangle then you can grab the corresponding meshbuffer's material and texture.
unless anyone else knows a better way!
i guess maybe you'd have to check each meshbuffer of your model and see if the clicked triangleis within that meshbuffer, which i suppose you could do by checking each set of 3 indices in the meshbuffer (which form a triangle of the mesh) and see if the vertices those indices refer to are at the same position as the 3 vertices in the clicked triangle. when you've found the triangle then you can grab the corresponding meshbuffer's material and texture.
unless anyone else knows a better way!
-
- Posts: 23
- Joined: Thu Jul 31, 2008 7:35 am
You'd probably also have to transform the mesh buffers triangles into its node's transformation before checking...
Imagine you've scaled up your map by 10x on each axis. The vertices in the mesh buffer will not be affected, only the maps' node knows about this scaling and will scale it up when it's drawn only.
When you do the collision detection i imagine it would return you the scaled up triangle rather than the original triangle from the mesh buffer.
But this would be fairly easy to do, you just grab the node's transformation and apply it to the vertices before checking them against the collided polygon. (obviously you don't actually want to change the mesh buffer's vertices, just a local copy of them).
Imagine you've scaled up your map by 10x on each axis. The vertices in the mesh buffer will not be affected, only the maps' node knows about this scaling and will scale it up when it's drawn only.
When you do the collision detection i imagine it would return you the scaled up triangle rather than the original triangle from the mesh buffer.
But this would be fairly easy to do, you just grab the node's transformation and apply it to the vertices before checking them against the collided polygon. (obviously you don't actually want to change the mesh buffer's vertices, just a local copy of them).