rendering unit icons and clickable surfaces

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
d3x0r
Posts: 6
Joined: Mon Dec 14, 2009 1:58 pm

rendering unit icons and clickable surfaces

Post by d3x0r »

I have a few technical questions about some of the issues, and how I can start building the appropriate things...

1) Depth-apprpriate icons. Many times there is a HUD icon which is shown over a body, I don't see any examples of this; I understand that some mechanism similar to picking can be used to find the position fo the 3d object in the scene as projected onto the 2d surface, but the depth cooredinate needs to be applied to the icon also. Is there a orthagonal rendering mode? so that icons I would put on the display can be placed at that x,y without modification by the Z (usual it's x/z, y/z... )... icons on the display are really 2d planes right? with the texture being the image of the icon from 0.0 to 1.0?

2) I really need a surface that is a simple object type I can create in a scene which will give me mouse events with the coordinate on the texture-plane, and the ability to quickly update the texture... a GUI on a cube, if you will. It would be best if the interface to update the texture allowed updating a sub-region of that image.
d3x0r
Posts: 6
Joined: Mon Dec 14, 2009 1:58 pm

rendering unit icons and clickable surfaces

Post by d3x0r »

really? noone can point me anywhere to get further information? was kinda hoping that the clickable surface would be done for in-world gui controls
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Your description seems to be a little too technical to really see what you're after. Do you need a way to find the proper x/y screen coord to put something above a 3d object? Or do you want to put something like a health bar above some character? Or is it really just a 2d gui question?
d3x0r
Posts: 6
Joined: Mon Dec 14, 2009 1:58 pm

Most of the above

Post by d3x0r »

I'd like to know if there's a node type that I can create which is a simple 2d billboard surface that I can dynamically update with content (might be something like a 2d scroller game) that is rendered as a plane in 3d space. This plane I would like to click on and get mouse events back. Ideally it would be an object I could derrive from some base class and override OnMouse() and OnDraw() events.

and seperately; Is there a class which would be useful for rendering icons over units. (which whould usually be done on the 2d HUD, but I do want to just set the orthagonal projection matrix and specify the Z coordinate too, to see if something so simple actually makes the icon go into the screen.) Thigs like mouse cursors and stuff would use this sort of object also.

Third, I'd like a simple method to get the current depth of any specific point in a 3d scene (so that a mouse rendered in the 2d box can be given an appropriate depth).
CuteAlien
Admin
Posts: 10037
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

There is IBillboardSceneNode - you can change it's material (including the textures) the same way you can for other nodes. That can be used for overhead-icons.

Nodes do not receive events, that is stuff you have to code in your game.

For collision checks take a look at irr::scene::ISceneCollisionManager - you can access it from the scenemanager with smgr->getSceneCollisionManager ().
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply