Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 3D / Re: Location of generic J3D tree walker on: 2005-08-05 17:37:49
awesome, i have been looking for something along these lines for a while. doing it myself was a bit of a headache.
2  Java Game APIs & Engines / Java 3D / Re: VRML and Capability bits on: 2005-08-03 16:25:57
A generic tree traverser would be a godsend. I'm a little curious why this sort of functionality doesn't exist in the form of a helper class or even on the loader itself. I'm running into similar capability bits (which I can only assume were devised to make life that much more irritating) with picking. It very well could be my complete misunderstanding of the nature of capability bits.
3  Java Game APIs & Engines / Java 3D / VRML and Capability bits on: 2005-07-29 21:50:21
So I'm using XJ3D to load my vrmls into my project. Allegedly the VRML97Loader can mass set capability bits, but  any actual confirmation to this is dodgy at best.,  using loader.setCapabilityRequiredMap(Map, Map). Even tracking down an example of this was futile. The code I used to initialize the loader is

     VRML97Loader loader = new VRML97Loader();
    Map<Integer,Integer> capabilityBits = new LinkedHashMap<Integer,Integer>();
    capabilityBits.put(BranchGroup.ALLOW_CHILDREN_READ,BranchGroup.ALLOW_CHILDREN_READ);
    Map<Integer,Integer> freqBits = new LinkedHashMap<Integer,Integer>();
    freqBits.put(BranchGroup.ALLOW_CHILDREN_READ,BranchGroup.ALLOW_CHILDREN_READ);
    loader.setCapabilityRequiredMap(capabilityBits, freqBits);

My problem is thus, I'm trying to add an object to a light's scope list to essentially highlight the object. The Light.addScope(Group) function only takes adds the Group and not its children. So I wrote a little hack to traverse the sub-graph and add all of the group nodes. 

   private void Scope(Light light, Group group)
   {
      light.addScope(group);//group.getCapability(BranchGroup.ALLOW_CHILDREN_READ)
      Enumeration children = group.getAllChildren();
      while(children.hasMoreElements())
      {
         Object o = (Object)children.nextElement();
         if(o instanceof Group)
         {
         Scope(light, (Group)o);
         }
      }
     
   }

Then I ran into my capability bit problem. It seems that while I can set the BranchGroup containing the loaded VRML model's bits, the loader's setCapabilityRequiredMap function, does not work as anticipated. I get the following expection:
 
javax.media.j3d.CapabilityNotSetException: Group: no capability to read children

I tried to manually traverse the sub-graph of the loaded VRML with a similar hack as above

   private void setCapability(Group group)
   {
      group.setCapability(Group.ALLOW_CHILDREN_READ);
      Enumeration e = group.getAllChildren();
      System.out.println(this.id);
      while(e.hasMoreElements())
      {
         Object o = (Object)e.nextElement();
         if(o instanceof Group)
         {
         setCapability((Group)o);
         }
      }     
   }

Not to keep you all in suspense, but it didn't work. So I'm curious if anyone has any suggestions as to what i have done wrong, or even a different approach to solving my problem. Any help would be greatly appreciate, thanks in advance.
4  Java Game APIs & Engines / Java 3D / Java3d, VRML and Picking on: 2004-11-30 12:15:50
Hey all

I'm about ready to pull my hair out over this one. I have a BranchGroup containing a TransformGroup containing a second BranchGroup holding a VRML file loaded with the XJ3D loader. Currently I am trying to implement a picking system such that when I click on an entity onscreen I can display some information stored in the entity's top level (the one above the TransformGroup) BranchGroup UserData. Currently it blows up on me with null pointer exceptions.

I I have made sure that when the VRML is loaded I recursively go through the file and enable picking on all of the objects. The problem that I am currently facing is getting from the portion of geometry that I click on to the top level of the entity structure.

Any suggestions would be greatly appreciated.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!