Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
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  
  VRML and Capability bits  (Read 1387 times)
0 Members and 1 Guest are viewing this topic.
Offline asimonk

Junior Newbie

Java games rock!

« Posted 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>();
    Map<Integer,Integer> freqBits = new LinkedHashMap<Integer,Integer>();
    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)
      Enumeration children = group.getAllChildren();
         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: 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)
      Enumeration e = group.getAllChildren();
         Object o = (Object)e.nextElement();
         if(o instanceof Group)

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.
Offline Jeff

JGO Coder

Got any cats?

« Reply #1 - Posted 2005-07-29 23:19:18 »

Well..  I have a suggestion but you may not like it...

Basically what a lot of people do is write recursive code they run after the loader laods the scene but before they make it live to traverse the tree and set the bits they need.

I know that Paul Byrne in the J3D group attempted to write a generic tree traverser to do things like this, but I dont know if its public and/or if it is where it lives.

I can ask him on Tuesday...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Offline asimonk

Junior Newbie

Java games rock!

« Reply #2 - Posted 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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mithrandir

Senior Devvie

Cut from being on the bleeding edge too long

« Reply #3 - Posted 2005-08-08 16:16:45 »

We try to be pretty good about setting the right capability bits, but sometimes this just don't work out right. For example, if you set a Group node as the key to the map with ALLOW_CHILDREN_WRITE, and we're using a TransformGroup as the internal implementation, then we won't pick that up: our code uses TransformGroup.class as the key to the map. There's a lot of places where this comes into play due to all the derived classes that are part of the Java3D design.

If you have specific instances that are not being set correctly, please post a bug report at for us to look through. Sometimes these are just trivial errors in our handling and can be fixed in a minute or too. Doing a generic audit is something we currently don't have time to do, but if we know of specific cases, that makes our lives much, much easier and we can take the hour or two out of our schedule to go fix it.

The site for 3D Graphics information
Aviatrix3D JOGL Scenegraph
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.

theagentd (71 views)
2017-02-18 13:42:33

theagentd (76 views)
2017-02-18 13:35:16

h.pernpeintner (1242 views)
2017-01-24 22:39:11

h.pernpeintner (1230 views)
2017-01-24 22:38:32

Galdo (1781 views)
2017-01-12 13:44:09

Archive (1896 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2432 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2285 views)
2016-12-15 21:50:57

Lunch (2364 views)
2016-12-06 16:01:40

ral0r2 (2153 views)
2016-11-23 16:08:26
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!