@Override protected void initWindow() { _canvas.setTitle("Shapes Example"); wrapCount = 5; addMesh(new Arrow("Arrow", 3, 1)); addMesh(new AxisRods("AxisRods", true, 3, 0.5)); addMesh(new Box("Box", new Vector3(), 3, 3, 3)); addMesh(new Capsule("Capsule", 5, 5, 5, 2, 5)); addMesh(new Cone("Cone", 8, 8, 2, 4)); addMesh(new Cylinder("Cylinder", 8, 8, 2, 4)); addMesh(new Disk("Disk", 8, 8, 3)); addMesh(new Dodecahedron("Dodecahedron", 3)); addMesh(new Dome("Dome", 8, 8, 3)); addMesh(new Hexagon("Hexagon", 3)); addMesh(new Icosahedron("Icosahedron", 3)); addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3)); addMesh(new Octahedron("Octahedron", 3)); addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8)); addMesh(new Pyramid("Pyramid", 2, 4)); addMesh(new Quad("Quad", 3, 3)); addMesh(new RoundedBox("RoundedBox", new Vector3(3, 3, 3))); addMesh(new Sphere("Sphere", 16, 16, 3)); addMesh(new GeoSphere("GeoSphere", true, 3, 3, TextureMode.Original)); addMesh(new StripBox("StripBox", new Vector3(), 3, 3, 3)); addMesh(new Teapot("Teapot")); addMesh(new Torus("Torus", 16, 8, 1.0, 2.5)); addMesh(new Tube("Tube", 2, 3, 4)); addMesh(createLines()); final TextureState ts = new TextureState(); ts.setTexture( TextureManager.load( "images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, Format.Guess, true)); _root.setRenderState(ts); final BlendState bs = new BlendState(); bs.setBlendEnabled(true); _root.setRenderState(bs); // Set up a reusable pick results _pickResults = new PrimitivePickResults(); _pickResults.setCheckDistance(true); // Set up our pick label _text = BasicText.createDefaultTextLabel("", "pick"); _text.setTranslation(10, 10, 0); _text.getSceneHints().setCullHint(CullHint.Always); _root.attachChild(_text); }
@Override protected void initExample() { _canvas.setTitle("Shapes Example"); wrapCount = 5; addMesh(new Arrow("Arrow", 3, 1)); addMesh(new AxisRods("AxisRods", true, 3, 0.5)); addMesh(new Box("Box", new Vector3(), 3, 3, 3)); addMesh(new Capsule("Capsule", 5, 5, 5, 2, 5)); addMesh(new Cone("Cone", 8, 8, 2, 4)); addMesh(new Cylinder("Cylinder", 8, 8, 2, 4)); addMesh(new Disk("Disk", 8, 8, 3)); addMesh(new Dodecahedron("Dodecahedron", 3)); addMesh(new Dome("Dome", 8, 8, 3)); addMesh(new Hexagon("Hexagon", 3)); addMesh(new Icosahedron("Icosahedron", 3)); addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3)); addMesh(new Octahedron("Octahedron", 3)); addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8)); addMesh(new Pyramid("Pyramid", 2, 4)); addMesh(new Quad("Quad", 3, 3)); addMesh(new RoundedBox("RoundedBox", new Vector3(3, 3, 3))); addMesh(new Sphere("Sphere", 16, 16, 3)); addMesh(new GeoSphere("GeoSphere", true, 3, 3, TextureMode.Original)); addMesh(new StripBox("StripBox", new Vector3(), 3, 3, 3)); addMesh(new Teapot("Teapot")); addMesh(new Torus("Torus", 16, 8, 1.0, 2.5)); addMesh(new Tube("Tube", 2, 3, 4)); addMesh(createLines()); final TextureState ts = new TextureState(); ts.setTexture( TextureManager.load( "images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, TextureStoreFormat.GuessCompressedFormat, true)); _root.setRenderState(ts); final BlendState bs = new BlendState(); bs.setBlendEnabled(true); _root.setRenderState(bs); // Set up a reusable pick results _pickResults = new BoundingPickResults(); _pickResults.setCheckDistance(true); // Set up our pick label _text = BasicText.createDefaultTextLabel("", "pick"); _text.setTranslation(10, 10, 0); _text.getSceneHints().setCullHint(CullHint.Always); _root.attachChild(_text); // Set up picked pulse _pickedControl = new SpatialController<Spatial>() { ColorRGBA curr = new ColorRGBA(); float val = 0; boolean add = true; public void update(final double time, final Spatial caller) { val += time * (add ? 1 : -1); if (val < 0) { val = -val; add = true; } else if (val > 1) { val = 1 - (val - (int) val); add = false; } curr.set(val, val, val, 1.0f); final MaterialState ms = (MaterialState) caller.getLocalRenderState(StateType.Material); ms.setAmbient(curr); } }; }