⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 displayboundingsphere.java

📁 Java 3D Game SDK.老外做的.
💻 JAVA
字号:
/* * Sphere.java */package org.java3dgamesdk.graphics.util;import javax.media.j3d.*;import javax.vecmath.*;import com.sun.j3d.utils.geometry.*;import org.java3dgamesdk.graphics.*;/** * * @author  Norbert Nopper */public class DisplayBoundingSphere extends Model3D {        /**     * Class variable for the red color.     */    final public static Color3f RED = new Color3f(1.0f, 0.0f, 0.0f);        /**     * Class variable for the green color.     */    final public static Color3f GREEN = new Color3f(0.0f, 1.0f, 0.0f);    /**     * Class variable for the blue color.     */    final public static Color3f BLUE = new Color3f(0.0f, 0.0f, 1.0f);        final public static int MODEL_FASTEST = 0;    final public static int MODEL_NICEST = 1;    final public static int MODEL_SHADE_FLAT = 2;    final public static int MODEL_SHADE_GOURAUD = 3;            final public static int TRANS_NONE = 0;    final public static int TRANS_FASTEST = 1;    final public static int TRANS_NICEST = 2;    final public static int TRANS_SCREEN_DOOR = 3;    final public static int TRANS_BLENDED = 4;            private Sphere      sphere;        public DisplayBoundingSphere(BoundingSphere boundingSphere) {        Point3d center = new Point3d();        boundingSphere.getCenter(center);                Appearance appearance = new Appearance();        appearance.setColoringAttributes(new ColoringAttributes(GREEN, MODEL_FASTEST));        appearance.setTransparencyAttributes(new TransparencyAttributes(TRANS_FASTEST, 0.9f));        sphere = new Sphere((float)boundingSphere.getRadius(), appearance);                        x = center.x;        y = center.y;        z = center.z;    }            public void changeColor(Color3f color) {        Appearance appearance = sphere.getAppearance();        ColoringAttributes attributes = appearance.getColoringAttributes();        attributes.setColor(color);        appearance.setColoringAttributes(attributes);        sphere.setAppearance(appearance);    }            /**     * Nothing needs to be updated.     *     * @param time the passed time in milliseconds     */    protected void updateModel(long time) {        // do nothing    }        /**     * Render the line.     *     * @param gc3D the graphics contect 3D to render on     */        protected void drawModel(GraphicsContext3D gc3D) {                gc3D.setAppearance(sphere.getAppearance());                gc3D.draw(sphere.getShape());            }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -