Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 02:55:03 pm
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Moving/extending PickHost functionality
Pages: [1]
Print
Author Topic: Moving/extending PickHost functionality  (Read 2436 times)
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« on: 14. February 2007, 01:00:33 pm »

I have a need to pick Links to SharedGroups.  The class hierarchy is

  • Node
     
    • Leaf
           
      • Link
      • Shape3D
      • other stuff
         
    • GroupNode
           
      • Group
                 
        • TransformGroup
        • SharedGroup
        • other stuff
               
         
Since any Leaf could potentially be picked (although I cannot see how Sound, Behavior, etc. could actually happen), does it make sense to move the getPickHost method up to Leaf?  It almost seems as if a Pickable interface would be nice; however, that doesn't really seem to make sense since all Nodes may be isPickable().
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #1 on: 14. February 2007, 04:17:22 pm »

In the meanwhile, use NodeMap Smiley
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 14. February 2007, 06:25:29 pm »

I will optimize the PickingLibrary for GC-friendliness now. And while I do it, I will add the functionality to pick Links.

I guess you mean, that the PickHost thing should be moved up to Node, but not to Leaf. I will see, if I can do it. Maybe there must be a new interface called PickHost, that NodeGroup and Link have to implement. I believe, this is the way to go.

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #3 on: 14. February 2007, 07:01:01 pm »

GroupNode contains setPickHost( boolean ).

Shape3D contains getPickHost()

I think all I need is to move (or you to move) getPickHost() to Leaf.  If I understand correctly, the various picking mechanisms will always place a Leaf in the PickResult.  We are then supposed to ask the Leaf for its PickHost.  Am I missing something?
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 14. February 2007, 07:54:25 pm »

GroupNode contains setPickHost( boolean ).

Shape3D contains getPickHost()

I think all I need is to move (or you to move) getPickHost() to Leaf.  If I understand correctly, the various picking mechanisms will always place a Leaf in the PickResult.  We are then supposed to ask the Leaf for its PickHost.  Am I missing something?

Oh, I misunderstood you. Moving the getPickHost() method to Leaf is ok, principally. But I will do it, when it will actually have an effect. So far only Shape3D instances are picked. And therefore the getPickHost() method woun't be usable in any way in Leaf for now. Just wait unitl tomorrw.

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #5 on: 14. February 2007, 08:30:57 pm »

Sweet, thanks.  My program gains substantial benefit by using Links.  This way, I can keep focusing on SWT threading :-)
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 14. February 2007, 08:33:39 pm »

Sweet, thanks.  My program gains substantial benefit by using Links.  This way, I can keep focusing on SWT threading :-)

Yeah, cool.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 15. February 2007, 04:10:29 am »

Links can now be PickHosts as well. And The PickingLibrary is fully capable of picking Links/SharedGroups. Though it is fully untested. I will do some tests tomorrow. It's late now.

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

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #8 on: 16. February 2007, 04:17:30 am »

Links can now be PickHosts as well. And The PickingLibrary is fully capable of picking Links/SharedGroups. Though it is fully untested. I will do some tests tomorrow. It's late now.

I wasn't working at all Grin. Now it is Wink.

To pick on a linked shape with PickingLibrary (or of course PickScheduler from Xith3DEnvironment), you just have to do the following:
Code:
Link link = new Link( new SharedGroup( myPickedShape ) );
link.setPickHost( true );

Then the PickResult instance will return the Link from the getPckHost() method. Note, that the getPickHost() method of the Leaf class only returns a GroupNode. It is simply not possible to handle it that way. But getting the Link from the PickResult just works great.

To get the Link as a pick-host from the PickResult, no GroupNode inside the Link must be defined as pick-host!

All Leaf implementations are now pickable with PickingLibrary. But you have to be aware, that other Leaf types (like Sound) need proper Bounds to be set (e.g a new BoundingSphere instance). Otherwise it won't be pickable. And of course a Link (which is a Leaf extension) is not handled like a Leaf in the picking algorithm, but more like a Group.

Enjoy Smiley

Marvin
« Last Edit: 16. February 2007, 04:26:37 am by Marvin Fröhlich » Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #9 on: 16. February 2007, 09:18:00 am »

Looks great.  Exactly what I needed.  Thanks so much!!
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #10 on: 16. February 2007, 01:53:21 pm »

Looks great.  Exactly what I needed.  Thanks so much!!

You're welcome Smiley
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic