Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [odejava] References instead of copies  (Read 1150 times)
0 Members and 1 Guest are viewing this topic.
Offline Per_T

Senior Newbie





« Posted 2004-11-21 16:08:25 »

Hi there,

Can't someone (Will) make PlaceableGeom.getQuaternion() and PlaceableGeom.getPosition() pass references instead of copies?
Offline Mithrandir

Senior Member




Cut from being on the bleeding edge too long


« Reply #1 - Posted 2004-11-21 21:53:00 »

Can you please explain what you want better. Placeable geom works both ways for both methods already.  It will either create a new container object, or you can pass it an object to fill in the details.

The site for 3D Graphics information http://www.j3d.org/
Aviatrix3D JOGL Scenegraph http://aviatrix3d.j3d.org/
Programming is essentially a markup language surrounding mathematical formulae and thus, should not be patentable.
Offline Per_T

Senior Newbie





« Reply #2 - Posted 2004-11-22 15:00:59 »

Well, I'd like to be able to do:

myPlaceableGeom.getQuaternion().x = ....
myPlaceableGeom.getPosition().x = ....
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mithrandir

Senior Member




Cut from being on the bleeding edge too long


« Reply #3 - Posted 2004-11-22 22:20:44 »

Well the javadoc states this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
javax.vecmath.Vector3f       getPosition()
          Returns the current position.
 void       getPosition(float[] result)
          Returns the current position using the provided float array.
 javax.vecmath.Vector3f       getPosition(javax.vecmath.Vector3f result)
          Returns the current position using the provided Vector3f
 javax.vecmath.Quat4f       getQuaternion()
          Returns the quaternion.
 javax.vecmath.Quat4f       getQuaternion(javax.vecmath.Quat4f result)
          Returns the quaternion using the provided Quad4f


So I don't know what else you need.

The site for 3D Graphics information http://www.j3d.org/
Aviatrix3D JOGL Scenegraph http://aviatrix3d.j3d.org/
Programming is essentially a markup language surrounding mathematical formulae and thus, should not be patentable.
Offline kevglass

JGO Kernel


Medals: 85
Projects: 25


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2004-11-23 05:59:38 »

It seems Per_T wants to be able to reset the position of the object by setting the values of the returned Vector3f. However, that would go against any sort of encapsulation of data... for instance, who's to say how position is held intenally? The vector3f you get back might have been generated from the matrix being held for the object. Who's to say how it might change in the future..

Kev

Offline Per_T

Senior Newbie





« Reply #5 - Posted 2004-11-23 07:16:00 »

Well, this is really not a big issue. I'ts just the way jME does it, and I thought it would be nice to have it the same way in ODE, because I'm using the two together.

If you guys wanna have it the way it is, that's really no problem Smiley

On my initial post I'd missed the
1  
2  
  javax.vecmath.Quat4f  getQuaternion(javax.vecmath.Quat4f result)
     Returns the quaternion using the provided Quad4f

which solves the "optimization issue".
Offline Mithrandir

Senior Member




Cut from being on the bleeding edge too long


« Reply #6 - Posted 2004-11-23 12:48:24 »

Quote
It seems Per_T wants to be able to reset the position of the object by setting the values of the returned Vector3f.


Which, of course, is very bad programming.  Apart from that horrible use of side-effects, odejava does not keep anything locally anyway in the high-level classes. Setting a value immediately calls the native code directly. Reading a value does the same thing. Direct setting of a variable like that above would have no effect on the code.

The site for 3D Graphics information http://www.j3d.org/
Aviatrix3D JOGL Scenegraph http://aviatrix3d.j3d.org/
Programming is essentially a markup language surrounding mathematical formulae and thus, should not be patentable.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (32 views)
2014-04-15 18:08:23

BurntPizza (29 views)
2014-04-15 03:46:01

UprightPath (44 views)
2014-04-14 17:39:50

UprightPath (27 views)
2014-04-14 17:35:47

Porlus (44 views)
2014-04-14 15:48:38

tom_mai78101 (65 views)
2014-04-10 04:04:31

BurntPizza (125 views)
2014-04-08 23:06:04

tom_mai78101 (225 views)
2014-04-05 13:34:39

trollwarrior1 (190 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!