亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 3dflyover.txt

?? This example creates a 3D fly-over of the city of Boston
?? TXT
?? 第 1 頁 / 共 5 頁
字號:
/**********************************************************
 Copyright (C) 2001   Daniel Selman

 First distributed with the book "Java 3D Programming"
 by Daniel Selman and published by Manning Publications.
 http://manning.com/selman

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation, version 2.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 The license can be found on the WWW at:
 http://www.fsf.org/copyleft/gpl.html

 Or by writing to:
 Free Software Foundation, Inc.,
 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

 Authors can be contacted at:
 Daniel Selman: daniel@selman.org

 If you make changes you think others would like, please 
 contact one of the authors or someone at the 
 www.j3d.org web site.
 **************************************************************/

/**
 * This example creates a 3D fly-over of the city of Boston. The viewer is
 * animated using a RotPosScaleTCBSplinePathInterpolator as well as 3
 * helicopters. The example uses PointSounds attached to the helicopters to
 * generate 3D spatial audio.
 */

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsConfigTemplate;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Vector;

import javax.media.j3d.Alpha;
import javax.media.j3d.Appearance;
import javax.media.j3d.AudioDevice;
import javax.media.j3d.Background;
import javax.media.j3d.BackgroundSound;
import javax.media.j3d.Behavior;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.Bounds;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.ColoringAttributes;
import javax.media.j3d.DistanceLOD;
import javax.media.j3d.GeometryArray;
import javax.media.j3d.GraphicsConfigTemplate3D;
import javax.media.j3d.Group;
import javax.media.j3d.ImageComponent2D;
import javax.media.j3d.Locale;
import javax.media.j3d.MediaContainer;
import javax.media.j3d.Node;
import javax.media.j3d.PhysicalBody;
import javax.media.j3d.PhysicalEnvironment;
import javax.media.j3d.PointSound;
import javax.media.j3d.QuadArray;
import javax.media.j3d.Shape3D;
import javax.media.j3d.Sound;
import javax.media.j3d.Switch;
import javax.media.j3d.Texture;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.media.j3d.ViewPlatform;
import javax.media.j3d.VirtualUniverse;
import javax.media.j3d.WakeupCondition;
import javax.media.j3d.WakeupCriterion;
import javax.media.j3d.WakeupOnCollisionEntry;
import javax.media.j3d.WakeupOnCollisionExit;
import javax.media.j3d.WakeupOr;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.vecmath.Color3f;
import javax.vecmath.Point2f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;

import com.sun.j3d.audioengines.javasound.JavaSoundMixer;
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.loaders.objectfile.ObjectFile;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.behaviors.interpolators.RotPosScaleTCBSplinePathInterpolator;
import com.sun.j3d.utils.behaviors.interpolators.TCBKeyFrame;
import com.sun.j3d.utils.geometry.Primitive;
import com.sun.j3d.utils.geometry.Sphere;
import com.sun.j3d.utils.image.TextureLoader;

/*
 * This example uses a Spline Interpolator to animate a fly-over the city of
 * Boston. The city is rendered using satellite images with a Level of Detail
 * behavior. The scene includes a number of moving helicopters, each with an
 * associated sound.
 */
public class SplineInterpolatorTest extends Java3dApplet {
  // size of the 3D window - enlage on powerful systems
  private static int m_kWidth = 200;

  private static int m_kHeight = 200;

  // a shared appearance for the buildings we create
  private Appearance m_BuildingAppearance = null;

  // the size of the high resolution "world".
  // the world is centered at 0,0,0 and extends
  // to +- LAND_WIDTH in the x direction and
  //+- LAND_LENGTH in the z direction.
  // These dimensions are loosely based on pixel
  // coordinates from the texture images
  private static final float LAND_WIDTH = 180;

  private static final float LAND_LENGTH = 180;

  // the satellite images used as textures have
  // been manually edited so that the water in the
  // images corresponds to the following RGB values.
  // this allows the application to avoid creating
  // buildings in the water!
  private static final float WATER_COLOR_RED = 0;

  private static final float WATER_COLOR_GREEN = 57;

  private static final float WATER_COLOR_BLUE = 123;

  public SplineInterpolatorTest() {
    initJava3d();
  }

  // scale eveything so we can use pixel coordinates
  protected double getScale() {
    return 0.1;
  }

  protected int getCanvas3dWidth(Canvas3D c3d) {
    return m_kWidth;
  }

  protected int getCanvas3dHeight(Canvas3D c3d) {
    return m_kHeight;
  }

  protected Bounds createApplicationBounds() {
    m_ApplicationBounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
        10.0);
    return m_ApplicationBounds;
  }

  // we want a texture mapped background of a sky
  protected Background createBackground() {
    // add the sky backdrop
    Background back = new Background();
    back.setApplicationBounds(getApplicationBounds());

    BranchGroup bgGeometry = new BranchGroup();

    // create an appearance and assign the texture image
    Appearance app = new Appearance();
    Texture tex = new TextureLoader("sky.gif", this).getTexture();
    app.setTexture(tex);

    Sphere sphere = new Sphere(1.0f, Primitive.GENERATE_TEXTURE_COORDS
        | Primitive.GENERATE_NORMALS_INWARD, app);

    bgGeometry.addChild(sphere);
    back.setGeometry(bgGeometry);

    return back;
  }

  // this controls how close to a helicopter we can
  // be and still hear it. If the helicopters sound
  // scheduling bounds intersect our ViewPlatformActivationRadius
  // the sound of the helicopter is potentially audible.
  protected float getViewPlatformActivationRadius() {
    return 20;
  }

  // creates the objects within our world
  protected BranchGroup createSceneBranchGroup() {
    BranchGroup objRoot = super.createSceneBranchGroup();

    // create a root TG in case we need to scale the scene
    TransformGroup objTrans = new TransformGroup();
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

    Transform3D t3d = new Transform3D();
    objTrans.setTransform(t3d);

    Group hiResGroup = createLodLand(objTrans);
    createBuildings(objTrans);
    createHelicopters(objTrans);

    // connect
    objRoot.addChild(objTrans);

    return objRoot;
  }

  // we create 2 TransformGroups above the ViewPlatform:
  // the first merely applies a scale, while the second
  // has a RotPosScaleTCBSplinePathInterpolator attached
  // so that the viewer of the scene is animated along
  // a spline curve.
  public TransformGroup[] getViewTransformGroupArray() {
    TransformGroup[] tgArray = new TransformGroup[2];
    tgArray[0] = new TransformGroup();
    tgArray[1] = new TransformGroup();

    Transform3D t3d = new Transform3D();
    t3d.setScale(getScale());
    t3d.invert();
    tgArray[0].setTransform(t3d);

    // create an Alpha object for the Interpolator
    Alpha alpha = new Alpha(-1, Alpha.INCREASING_ENABLE
        | Alpha.DECREASING_ENABLE, 0, 0, 25000, 4000, 100, 20000, 5000,
        50);

    // ensure the Interpolator can access the TG
    tgArray[1].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    try {
      // create the Interpolator and load the keyframes from disk
      RotPosScaleTCBSplinePathInterpolator splineInterpolator = Utils
          .createSplinePathInterpolator(new UiAlpha(alpha),
              tgArray[1], new Transform3D(), new URL(
                  getWorkingDirectory(),
                  "rotate_viewer_spline.xls"));

      // set the scheduling bounds and attach to the scenegraph
      splineInterpolator.setSchedulingBounds(getApplicationBounds());
      tgArray[1].addChild(splineInterpolator);
    } catch (Exception e) {
      System.err.println(e.toString());
    }

    return tgArray;
  }

  // overidden so that the example can use audio
  protected AudioDevice createAudioDevice(PhysicalEnvironment pe) {
    return new JavaSoundMixer(pe);
  }

  // creates a Switch group that contains two versions
  // of the world - the first is a high resolution version,
  // the second if a lower resolution version.
  public Group createLodLand(Group g) {
    Switch switchNode = new Switch();
    switchNode.setCapability(Switch.ALLOW_SWITCH_WRITE);

    Group hiResGroup = createLand(switchNode);
    createEnvirons(switchNode);

    // create a DistanceLOD that will select the child of
    // the Switch node based on distance. Here we are selecting
    // child 0 (high res) if we are closer than 180 units to
    // 0,0,0 and child 1 (low res) otherwise.
    float[] distanceArray = { 180 };

    DistanceLOD distanceLod = new DistanceLOD(distanceArray);
    distanceLod.setSchedulingBounds(getApplicationBounds());
    distanceLod.addSwitch(switchNode);

    g.addChild(distanceLod);
    g.addChild(switchNode);

    return hiResGroup;
  }

  // creates a high resolution representation of the world.
  // a single texture mapped square and a larger (water colored)
  // square to act as a horizon.
  public Group createLand(Group g) {
    Land land = new Land(this, g, ComplexObject.GEOMETRY
        | ComplexObject.TEXTURE);
    Group hiResGroup = land.createObject(new Appearance(), new Vector3d(),
        new Vector3d(LAND_WIDTH, 1, LAND_LENGTH), "boston.gif", null,
        null);

    Appearance app = new Appearance();
    app.setColoringAttributes(new ColoringAttributes(
        WATER_COLOR_RED / 255f, WATER_COLOR_GREEN / 255f,
        WATER_COLOR_BLUE / 255f, ColoringAttributes.FASTEST));

    Land base = new Land(this, hiResGroup, ComplexObject.GEOMETRY);
    base.createObject(app, new Vector3d(0, -5, 0), new Vector3d(
        4 * LAND_WIDTH, 1, 4 * LAND_LENGTH), null, null, null);

    return hiResGroup;
  }

  // creates a low resolution version of the world and
  // applies the low resolution satellite image
  public Group createEnvirons(Group g) {
    Land environs = new Land(this, g, ComplexObject.GEOMETRY
        | ComplexObject.TEXTURE);
    return environs.createObject(new Appearance(), new Vector3d(),
        new Vector3d(2 * LAND_WIDTH, 1, 2 * LAND_LENGTH),
        "environs.gif", null, null);
  }

  // returns true if the given x,z location in the world
  // corresponds to water in the satellite image
  protected boolean isLocationWater(BufferedImage image, float posX,
      float posZ) {
    Color color = null;

    float imageWidth = image.getWidth();
    float imageHeight = image.getHeight();

    // range from 0 to 1
    float nPixelX = (posX + LAND_WIDTH) / (2 * LAND_WIDTH);
    float nPixelY = (posZ + LAND_LENGTH) / (2 * LAND_LENGTH);

    // rescale
    nPixelX *= imageWidth;
    nPixelY *= imageHeight;

    if (nPixelX >= 0 && nPixelX < imageWidth && nPixelY >= 0
        && nPixelY < imageHeight) {
      color = new Color(image.getRGB((int) nPixelX, (int) nPixelY));
      return (color.getBlue() >= WATER_COLOR_BLUE
          && color.getGreen() <= WATER_COLOR_GREEN && color.getRed() <= WATER_COLOR_RED);
    }

    return false;
  }

  // creates up to 120 building objects - ensures that
  // buildings are not positioned over water.
  public Group createBuildings(Group g) {
    m_BuildingAppearance = new Appearance();
    BranchGroup bg = new BranchGroup();

    Texture tex = new TextureLoader("boston.gif", this).getTexture();
    BufferedImage image = ((ImageComponent2D) tex.getImage(0)).getImage();

    final int nMaxBuildings = 120;

    for (int n = 0; n < nMaxBuildings; n++) {
      Cuboid building = new Cuboid(this, bg, ComplexObject.GEOMETRY
          | ComplexObject.TEXTURE);

      float posX = (int) Utils.getRandomNumber(0, LAND_WIDTH);
      float posZ = (int) Utils.getRandomNumber(0, LAND_LENGTH);

      if (isLocationWater(image, posX, posZ) == false) {
        building.createObject(m_BuildingAppearance, new Vector3d(posX,
            0, posZ), new Vector3d(Utils.getRandomNumber(3, 2),
            Utils.getRandomNumber(8, 7), Utils
                .getRandomNumber(3, 2)), "house.gif", null,
            null);
      }
    }

    g.addChild(bg);
    return bg;
  }

  // creates three helicopters
  public void createHelicopters(Group g) {
    for (int n = 0; n < 3; n++)
      createHelicopter(g);
  }

  // edit the positions of the clipping
  // planes so we don't clip on the front
  // plane prematurely
  protected double getBackClipDistance() {
    return 50.0;
  }

  protected double getFrontClipDistance() {
    return 0.1;
  }

  // creates a single helicopter object
  public Group createHelicopter(Group g) {
    BranchGroup bg = new BranchGroup();

    Helicopter heli = new Helicopter(this, bg, ComplexObject.GEOMETRY
        | ComplexObject.SOUND);

    heli.createObject(new Appearance(), new Vector3d(Utils.getRandomNumber(
        0, LAND_WIDTH), Utils.getRandomNumber(15, 5), Utils
        .getRandomNumber(0, LAND_LENGTH)), new Vector3d(10, 10, 10),
        null, "heli.wav", null);

    g.addChild(bg);

    return bg;
  }

  public static void main(String[] args) {
    SplineInterpolatorTest splineInterpolatorTest = new SplineInterpolatorTest();
    splineInterpolatorTest.saveCommandLineArguments(args);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品在线观看播放| 欧美日本一道本在线视频| 国产成人自拍高清视频在线免费播放| 老汉av免费一区二区三区| 国产大片一区二区| 色88888久久久久久影院野外| 欧美丰满少妇xxxbbb| 国产午夜精品一区二区三区视频 | 亚洲精选视频免费看| 麻豆91在线观看| 欧美亚洲动漫精品| 欧美韩国一区二区| 另类欧美日韩国产在线| 色婷婷综合久色| 国产亚洲欧美一级| 黄色日韩网站视频| 欧美一级精品大片| 亚洲一区二区中文在线| 成人高清视频免费观看| 精品国产免费久久| 蜜臀精品一区二区三区在线观看| 99这里只有精品| 国产目拍亚洲精品99久久精品| 日韩在线a电影| 欧美日韩午夜在线| 亚洲3atv精品一区二区三区| 白白色 亚洲乱淫| 亚洲国产精华液网站w| 成人一区二区视频| 亚洲欧美日韩久久| 色偷偷久久人人79超碰人人澡| 17c精品麻豆一区二区免费| 国产精品资源站在线| 精品国产91乱码一区二区三区| 日韩成人精品在线观看| 91精品国产91久久久久久最新毛片| 亚洲线精品一区二区三区八戒| 精品久久免费看| 不卡的电视剧免费网站有什么| 综合色中文字幕| 欧美日韩视频一区二区| 婷婷夜色潮精品综合在线| 在线播放中文字幕一区| 美脚の诱脚舐め脚责91| 久久久久久影视| 91久久久免费一区二区| 视频一区二区欧美| 国产精品午夜免费| 精品视频在线看| 成人自拍视频在线观看| 日韩在线观看一区二区| 亚洲欧美在线视频| 欧美一级在线免费| 色综合久久久久综合99| 欧美性受xxxx黑人xyx性爽| 天天做天天摸天天爽国产一区 | 久久99蜜桃精品| 亚洲女性喷水在线观看一区| 欧美色图片你懂的| 国产91精品露脸国语对白| 五月激情六月综合| 亚洲美女淫视频| 日本一区二区三区四区| 欧美三级电影精品| 欧美性大战久久久| 色哟哟一区二区| 9色porny自拍视频一区二区| 天天综合网天天综合色| 亚洲福利国产精品| 亚洲一区在线观看免费| 亚洲人成小说网站色在线| 26uuu久久天堂性欧美| 日韩久久精品一区| 日韩三级免费观看| 日韩一区二区三区在线观看| 欧美色电影在线| 欧美日韩亚洲综合在线| 欧美高清视频一二三区| 91精品国产91久久久久久一区二区| 欧美亚洲图片小说| 欧美巨大另类极品videosbest | 精品视频免费看| 欧美一区二区二区| 久久一日本道色综合| 欧美精品一区二区三区四区 | 麻豆传媒一区二区三区| 国产a级毛片一区| 成人福利视频在线| 欧美午夜电影一区| 精品电影一区二区三区| 中文字幕在线观看一区| 亚洲激情男女视频| 狠狠色丁香久久婷婷综| 99re热视频精品| 欧美亚洲免费在线一区| 欧美精品一区二区三区在线播放| 国产精品入口麻豆九色| 一区二区三区日韩欧美精品| 另类成人小视频在线| 日本韩国一区二区| 久久日一线二线三线suv| 一区二区三区国产精品| 国产在线观看免费一区| 欧美日韩一区二区三区不卡| 国产欧美日韩麻豆91| 日韩成人午夜精品| 777亚洲妇女| 日韩成人dvd| 欧美日韩的一区二区| 亚洲免费观看视频| 国产成人在线观看| 精品国产免费久久| 狂野欧美性猛交blacked| 91精品国产一区二区三区香蕉| 樱花影视一区二区| 91蜜桃免费观看视频| 国产农村妇女毛片精品久久麻豆| 国产一区二区三区久久悠悠色av| 欧美一级片在线| 麻豆国产精品视频| 国产亚洲污的网站| 99免费精品在线| 一区二区三区四区高清精品免费观看 | 99精品在线观看视频| 久久久久9999亚洲精品| 蜜桃av一区二区在线观看| 欧美亚洲丝袜传媒另类| 亚洲欧美另类图片小说| 色欧美片视频在线观看| 亚洲人快播电影网| 日韩一区二区三区电影在线观看 | 日本伦理一区二区| 蜜臀av在线播放一区二区三区 | 欧美大片在线观看一区二区| 国产在线精品国自产拍免费| 91色视频在线| 亚洲电影第三页| 一区二区三区四区中文字幕| 欧美成人三级电影在线| 色嗨嗨av一区二区三区| 大桥未久av一区二区三区中文| 亚洲影视资源网| 中文字幕五月欧美| 精品国产一区二区三区久久久蜜月 | 久久精品国产99久久6| 亚洲女厕所小便bbb| 2023国产精品自拍| 日韩欧美电影在线| 欧美日韩一区三区| 91国偷自产一区二区使用方法| 天天爽夜夜爽夜夜爽精品视频| 国产精品久久看| 国产婷婷色一区二区三区| 精品国产成人系列| 日韩一区二区三区免费看| 欧美中文字幕一区| 99久久精品国产精品久久| jiyouzz国产精品久久| 在线观看亚洲专区| 91精品国产色综合久久ai换脸| 欧美日韩免费一区二区三区视频| 激情文学综合插| 日韩不卡一区二区三区| 一区二区三区精品在线观看| 国产精品久久99| 中文字幕精品一区二区三区精品 | 欧美激情一区二区三区在线| 日韩亚洲欧美综合| 欧美一级日韩不卡播放免费| 69p69国产精品| 日韩精品一区二区三区中文不卡| 欧美喷潮久久久xxxxx| 91精品国产色综合久久| 欧美电影免费观看高清完整版| 欧美一区二区视频在线观看2022| 欧美日韩亚洲丝袜制服| 538在线一区二区精品国产| 欧美一区二区视频在线观看| 日韩精品自拍偷拍| 国产日韩精品一区二区浪潮av | 精品一区二区国语对白| 国产成人亚洲综合色影视 | 日本一区二区三区四区| 亚洲美女偷拍久久| 亚洲国产一区二区三区| 免费看欧美美女黄的网站| 久久99国产精品成人| 成人听书哪个软件好| 欧美日韩免费高清一区色橹橹 | www.欧美日韩| 欧美一级国产精品| 亚洲人成网站在线| 韩国欧美国产一区| 欧美日韩一区二区三区在线| 日韩精品在线网站| 亚洲成人手机在线| 97se亚洲国产综合自在线| 日韩西西人体444www| 亚洲最大成人网4388xx| 国产成人av电影在线播放|