Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 03:28:37 am
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)WorldCoordinate or CoordinateNode?
Pages: [1]
Print
Author Topic: WorldCoordinate or CoordinateNode?  (Read 1581 times)
raubezia
Just dropped in

Offline Offline

Posts: 21


View Profile
« on: 30. March 2008, 09:20:27 am »

Hi

I am new to Xith and I have problems with calculation the right position and sizes.
I want only to write a 2D game (using rectangles with textures). The main problem are the sizes and the position. I have used setScreenScale(), but this will cause trouble with the pick() method (is it a bug?). Setting the Viewport will not have the right effect (it reduces the area of painting on an higher value!?)

On the other hand I don't want to use a global coordinate system rather than a local one.
After a hint from Marvin, I had a deeper view into the hud code, but the coordinate code is deeply involed. Is it possible to get a CoordinateNode? It should give control about the used scale and will allow to determine the exact position (for displaying and picking).

The fields used in the CoordinateNode may be (sorry for the vague definition)
- origin of the point(0,0)
- the calculation value of lets say 10px (as a setted value) to X (while X is the position in the local coordinate)
- the rotation
This will allow to set two pictures or other 3D elements in simple way and scale but not effecting others outside.

What do you think about? Or is there already such a node.

D.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 30. March 2008, 04:13:06 pm »

The main problem are the sizes and the position. I have used setScreenScale(), but this will cause trouble with the pick() method (is it a bug?).

It was a bug. Though it was the center of view, which wasn't honored by the PickRay. It is fixed now.

Setting the Viewport will not have the right effect (it reduces the area of painting on an higher value!?)

I don't know, what you mean with "higher value", but: yes.

On the other hand I don't want to use a global coordinate system rather than a local one.
After a hint from Marvin, I had a deeper view into the hud code, but the coordinate code is deeply involed. Is it possible to get a CoordinateNode? It should give control about the used scale and will allow to determine the exact position (for displaying and picking).

The fields used in the CoordinateNode may be (sorry for the vague definition)
- origin of the point(0,0)
- the calculation value of lets say 10px (as a setted value) to X (while X is the position in the local coordinate)
- the rotation
This will allow to set two pictures or other 3D elements in simple way and scale but not effecting others outside.

What do you think about? Or is there already such a node.

Please update from SVN and have a look at the org.xith3d.test.twodee.TwoDeeTest1. I have added new factory methods to the RenderPass class, whih allow for creating a RenderPass, which is correctly setup for 2D-rendering in resolution range/space. This should be, what you want about the coordinate system. These new methods basically contain the RenderPass-setup-code from the HUD.

Please tell me, if you like it this way.

the only thing, that might irritate a little bit is, that you have to use negative y-coordinates, which cannot be easily avoided, since it is the way, OpenGL works.

Marvin
Logged
raubezia
Just dropped in

Offline Offline

Posts: 21


View Profile
« Reply #2 on: 08. April 2008, 09:19:03 pm »

Hay cool - thanks.
I had a look on it and I will use this in my TwoDee Game Wink

D.

PS:
Quote
I don't know, what you mean with "higher value", but: yes.
"Higher value means" to use grater values than canvas.getHeight() and canvas.getWidth() in
Code:
        Rect2i viewport = new Rect2i(0,0,getCanvas().getWidth(),getCanvas().getHeight());
        getCanvas().setViewport(viewport);
.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic