01: /*
02: * $RCSfile: SceneTransform.java,v $
03: *
04: * @(#)Transform.java 1.48 98/10/21 16:57:19
05: *
06: * Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
07: *
08: * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
09: * modify and redistribute this software in source and binary code form,
10: * provided that i) this copyright notice and license appear on all copies of
11: * the software; and ii) Licensee does not utilize the software in a manner
12: * which is disparaging to Sun.
13: *
14: * This software is provided "AS IS," without a warranty of any kind. ALL
15: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
16: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
17: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
18: * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
19: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
20: * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
21: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
22: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
23: * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
24: * POSSIBILITY OF SUCH DAMAGES.
25: *
26: * This software is not designed or intended for use in on-line control of
27: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
28: * the design, construction, operation or maintenance of any nuclear
29: * facility. Licensee represents and warrants that it will not use or
30: * redistribute the Software for such purposes.
31: *
32: * $Revision: 1.2 $
33: * $Date: 2005/02/03 23:07:02 $
34: * $State: Exp $
35: */
36: /*
37: * @Author: Rick Goldberg
38: *
39: */
40: package org.jdesktop.j3d.loaders.vrml97.impl;
41:
42: import javax.media.j3d.*;
43: import javax.vecmath.*;
44:
45: /** Description of the Class */
46: public class SceneTransform extends Transform {
47: /**
48: *Constructor for the SceneTransform object
49: *
50: *@param loader Description of the Parameter
51: */
52: SceneTransform(Loader loader) {
53: super (loader);
54: }
55:
56: /** Description of the Method */
57: void initImpl() {
58: super .initImpl();
59: impl
60: .setCapability(javax.media.j3d.TransformGroup.ALLOW_TRANSFORM_READ);
61: impl
62: .setCapability(javax.media.j3d.TransformGroup.ALLOW_TRANSFORM_WRITE);
63: impl.setCapability(javax.media.j3d.Node.ALLOW_BOUNDS_READ);
64: impl.setCapability(javax.media.j3d.Node.ALLOW_BOUNDS_WRITE);
65: //impl.setCapability(javax.media.j3d.Node.ALLOW_AUTO_COMPUTE_BOUNDS_READ);
66: //impl.setCapability(javax.media.j3d.Node.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
67: impl.setCapability(javax.media.j3d.Node.ENABLE_PICK_REPORTING);
68: impl
69: .setCapability(javax.media.j3d.Node.ALLOW_LOCAL_TO_VWORLD_READ);
70:
71: impl.setPickable(true);
72: }
73:
74: /**
75: * Sets the sceneBounds attribute of the SceneTransform object
76: *
77: *@param b The new sceneBounds value
78: */
79: void setSceneBounds(BoundingSphere b) {
80: Point3d p = new Point3d();
81: ((BoundingSphere) b).getCenter(p);
82: center.setValue((float) p.x, (float) p.y, (float) p.z);
83: if (b.getRadius() > 10.0) {
84: float inv = 1.0f / (float) (b.getRadius());
85: // this did not seem to work ???
86: // while setting in the file did.
87: scale.setValue(inv, inv, inv);
88: }
89: }
90:
91: }
|