/** * Creates a blank TransformGroup with the proper capabilities. */ private static TransformGroup createTransformGroup () { TransformGroup tg = new TransformGroup(); tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); tg.setPickable(false); tg.setCollidable(false); return tg; }
/** * Creates a blank TransformGroup with the proper capabilities. */ private static TransformGroup createTransformGroup () { TransformGroup tg = new TransformGroup(); tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); tg.setPickable(false); tg.setCollidable(false); return tg; }
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickCanvas = new PickCanvas(canvas, root); }
public EdgeGroup(E edge, Node shape) { this.edge = edge; this.shape = shape; setCapability(TransformGroup.ENABLE_PICK_REPORTING); // Cylinder cylinder = new Cylinder(radius, 1, // Cylinder.GENERATE_NORMALS | // Cylinder.GENERATE_TEXTURE_COORDS | // Cylinder.ENABLE_GEOMETRY_PICKING, // 26, 26, look); Transform3D t = new Transform3D(); t.setTranslation(new Vector3f(0.f, .5f, 0.f)); TransformGroup group = new TransformGroup(t); group.addChild(shape); addChild(group); }
/** * Combines any number of shapes into one shape and returns it. */ public static Shape combine (Shape... shapes) { BranchGroup combinedGroup = createBranchGroup(); TransformGroup combinedTransform = new TransformGroup(); for (int i = 0; i < shapes.length; i++) { BranchGroup bg = shapes[i].bg; TransformGroup tg = shapes[i].tg; offscreenGroup.removeChild(bg); onscreenGroup.removeChild(bg); bg.removeChild(tg); combinedTransform.addChild(shapes[i].tg); } combinedGroup.addChild(combinedTransform); offscreenGroup.addChild(combinedGroup); return new Shape(combinedGroup, combinedTransform); }
/** * Combines any number of shapes into one shape and returns it. */ public static Shape combine (Shape... shapes) { BranchGroup combinedGroup = createBranchGroup(); TransformGroup combinedTransform = new TransformGroup(); for (int i = 0; i < shapes.length; i++) { BranchGroup bg = shapes[i].bg; TransformGroup tg = shapes[i].tg; offscreenGroup.removeChild(bg); onscreenGroup.removeChild(bg); bg.removeChild(tg); combinedTransform.addChild(shapes[i].tg); } combinedGroup.addChild(combinedTransform); offscreenGroup.addChild(combinedGroup); return new Shape(combinedGroup, combinedTransform); }
private static Shape drawLWS (String filename) { Lw3dLoader loader = new Lw3dLoader(); try { BranchGroup bg = loader.load(filename).getSceneGroup(); bg.setCapability(BranchGroup.ALLOW_CHILDREN_READ); bg.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); bg.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); bg.setCapability(BranchGroup.ALLOW_DETACH); TransformGroup transGroup = new TransformGroup(); transGroup.addChild(bg); BranchGroup bg2 = createBranchGroup(); bg2.addChild(transGroup); offscreenGroup.addChild(bg2); return new Shape(bg2, transGroup); } catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); } return null; }
private static Shape drawLWS (String filename) { Lw3dLoader loader = new Lw3dLoader(); try { BranchGroup bg = loader.load(filename).getSceneGroup(); bg.setCapability(BranchGroup.ALLOW_CHILDREN_READ); bg.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); bg.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); bg.setCapability(BranchGroup.ALLOW_DETACH); TransformGroup transGroup = new TransformGroup(); transGroup.addChild(bg); BranchGroup bg2 = createBranchGroup(); bg2.addChild(transGroup); offscreenGroup.addChild(bg2); return new Shape(bg2, transGroup); } catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); } return null; }
/** * Draws a Java3D Shape3D object with the given properties. * * @param polygonFill Polygon fill properties, specified by Java 3D. */ private static Shape shape (Shape3D shape, boolean fill, Transform3D transform, boolean custom) { Appearance ap; if (custom) ap = createCustomAppearance(fill); else ap = createAppearance(null, fill); shape.setAppearance(ap); TransformGroup transGroup = new TransformGroup(); if (transform != null) transGroup.setTransform(transform); transGroup.addChild(shape); BranchGroup bg = createBranchGroup(); bg.addChild(transGroup); offscreenGroup.addChild(bg); return new Shape(bg, transGroup); }
/** * Draws a Java3D Shape3D object with the given properties. * * @param polygonFill Polygon fill properties, specified by Java 3D. */ private static Shape shape (Shape3D shape, boolean fill, Transform3D transform, boolean custom) { Appearance ap; if (custom) ap = createCustomAppearance(fill); else ap = createAppearance(null, fill); shape.setAppearance(ap); TransformGroup transGroup = new TransformGroup(); if (transform != null) transGroup.setTransform(transform); transGroup.addChild(shape); BranchGroup bg = createBranchGroup(); bg.addChild(transGroup); offscreenGroup.addChild(bg); return new Shape(bg, transGroup); }
/** * Constructeur de BVolume. Cree toute l'arborescence de l'objet et initialise une apparence par defaut. */ public BVolume() { nom_ = null; pere_ = null; index_ = 0; visible_ = false; rapide_ = false; boite_ = new GrBoite(); setCapability(BranchGroup.ALLOW_DETACH); tg_ = new TransformGroup(); tg_.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tg_.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); tg_.setCapability(Group.ALLOW_CHILDREN_WRITE); tg_.setCapability(Group.ALLOW_CHILDREN_READ); tg_.setCapability(Group.ALLOW_CHILDREN_EXTEND); tg_.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ); addChild(tg_); }
boiteEnglobante_ = new com.sun.j3d.utils.geometry.Box((float) (up.x - low.x) / 2, (float) (up.y - low.y) / 2, (float) (up.z - low.z) / 2, ap); final TransformGroup btg = new TransformGroup(); final TransformGroup bTg = new TransformGroup(); final Transform3D t3d = new Transform3D(); t3d.set(new Vector3d((low.x + up.x) / 2, (low.y + up.y) / 2, (low.z + up.z) / 2));
TransformGroup transGroup = new TransformGroup(); transGroup.addChild(bg); BranchGroup bg2 = createBranchGroup();
TransformGroup transGroup = new TransformGroup(); transGroup.addChild(bg); BranchGroup bg2 = createBranchGroup();
public BUnivers(final BCanvas3D _canvas) { canvas_ = _canvas; locale_ = new Locale(this); final ViewPlatform camera = new ViewPlatform(); final BranchGroup viewGroup = new BranchGroup(); final TransformGroup viewTg = new TransformGroup(); viewTg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); viewTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); viewTg.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ); viewTg.addChild(camera); viewGroup.addChild(viewTg); final PhysicalBody body = new PhysicalBody(); final PhysicalEnvironment env = new PhysicalEnvironment(); final View view = new View(); view.setPhysicalBody(body); view.setPhysicalEnvironment(env); view.setBackClipDistance(100); view.setFrontClipDistance(.1); view.addCanvas3D(canvas_); view.attachViewPlatform(camera); transformU_ = viewTg; position_ = new Vector3d(); viewGroup.setCapability(BranchGroup.ALLOW_DETACH); locale_.addBranchGraph(viewGroup); }
TransformGroup tg = new TransformGroup(tt);
final TransformGroup bTg = new TransformGroup(); final Transform3D t3d = new Transform3D(); t3d.set(new Vector3d((up.x - low.x) / 2, (float) (up.y - low.y) / 2, neg_ * (float) (up.z - low.z) / 2));
final TransformGroup bTg = new TransformGroup(); final Transform3D t3d = new Transform3D(); t3d.set(new Vector3d((low.x + up.x) / 2, (low.y + up.y) / 2, (low.z + up.z) / 2));
boiteEnglobante_ = new com.sun.j3d.utils.geometry.Box((float) (up.x - low.x) / 2, (float) (up.y - low.y) / 2, (float) (up.z - low.z) / 2, ap); final TransformGroup bTg = new TransformGroup(); final Transform3D t3d = new Transform3D(); t3d.set(new Vector3d((up.x - low.x) / 2, (float) (up.y - low.y) / 2, -(float) (up.z - low.z) / 2));
(float) (up.z - low.z) / 2, ap); final TransformGroup bTg= new TransformGroup(); final Transform3D t3d= new Transform3D(); t3d.set(