[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [x3d-public] Hiding def nodes, java and x3d



Opps... caught out.  I have found one example in the Xj3D installation and then as Tahir points out, I should have looked more closely to the general SAI tutorial page (which I had only scanned and seen code fragments).  If you read the text there are code examples linked.
 
Anyone care to comment on Xj3D vs CyberX3D?
 
John


From: Tahir Emre KALAYCI [mailto:tekrei@gmail.com]
Sent: Sat 31/03/2007 4:18 PM
To: Dickinson, John
Cc: x3d-public@web3d.org
Subject: Re: [x3d-public] Hiding def nodes, java and x3d

Hi,
http://www.xj3d.org/tutorials/general_sai.html contains all examples with tutorial.

On 3/31/07, Dickinson, John <john.dickinson@nrc-cnrc.gc.ca> wrote:
Okay...
I have been directed to use a switch node with my reused geometry below it which sounds good to me.  I'll check it out Monday.
 
I have also received a suggestion that I used Xj3D to make my code simpler... I was looking at their pages and not finding any complete examples!!!!  Is there a COMPLETE example of using Xj3D to parse, and save and even render a x3d file?  Or even a COMPLETE example of it doing any one of parsing, saving or showing.
 
The Chef3D sounds interesting but I am on a timeline now and I recently was found myself with a DEADLINE of April 11th to create a demo of what I am aiming to do. (Unexpectedly, multiple people involved will be gathered together in one place for another event and we want to take advantage of that.)
 
John


From: owner-x3d-public@web3d.org on behalf of Dickinson, John
Sent: Fri 30/03/2007 4:06 PM
To: x3d-public@web3d.org
Subject: [x3d-public] Hiding def nodes, java and x3d

Okay all,
I have started building my 3D greenhouse world and am making a java program to generate the x3d files based on a few inputs.
I believe I may be doing things the hard way so I wanted to get feedback on two points.
 
1) The geometry of the greenhouse requires a lot of repeated instances so I am using DEF and USE.
Currently I am tracking the first time I use a particular piece of geomtery (and an associated transform to get it to a neutral location and orientation) and adding a DEF attribute to the transform node and later using Shape nodes with USE to reuse it. 
 
To make my life simpler I would like to make the world initially with all these reused geometry/transform nodes predefined but hidden in a branch of the scene-graph not shown and forgo tracking "first use" data completely.  Is there a way to avoid rendering a whole branch of a scene-graph yet still have sub-branches of that scene graph visible when referenced elsewhere in the scene-graph?
 
2) I am using the java xml parsing and translating packages to read in a valid x3d scene (that is empty) and then adding nodes to it (DOM package) and then writting it to a new file name.  This works but means I have to work at one level higher abstraction than I would like. I mean I have to make an element or node of the right tag type and add the correct attributes rather than make a Transform node directly.  Is there an java package that has classes for each node in x3d and a way of loading/writting x3d files to be viewed externally (or internally).
 
I haven't had time to review CyberX3D for Java or Xj3D X3D Developer Toolkit .  In the long run I want to make a tabbed user interface that will allow me to define specific parameters describing a greenhouse (not limited to stuff relevant to the x3d model) and have it save/load those in a xml file.  The same program could should also generate an x3d file that may be viewed on another tab of the program (or in a browser) depending on performance limitations. The other greenhouse data will be used to generate output on other tabs ....
 
 
--------------------
Here is a sample of the code I have been writing so you can see why I would like a more x3d specific approach and predefine the DEF nodes in the "empty" .x3d base file I load and add branches too.
 
    Node getFrontNode(String trans)
    {
     Element t = document.createElement("Transform");
      t.setAttribute("translation", trans);
      Element f;
     if(firstFront)
     {
         f = document.createElement("Transform");
      // 6.5, 0, 0 ft in meters
      f.setAttribute("translation", "1.9812 0 0");
      f.setAttribute ("DEF", "front");
      Element ff = document.createElement("Inline");
      ff.setAttribute("url", "front.wrl");
      f.appendChild(ff);
      firstFront = false;
     } else {
      f = document.createElement("Shape");
      f.setAttribute("USE", "front");
     }
  t.appendChild(f);
  return t;
    }
 
Thanks
John
 



--
Tahir Emre KALAYCI
http://kodveus.blogspot.com
http://yzgrafik.ege.edu.tr/~tekrei
"Mornie utúlie"