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

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

?? landscape.java

?? java3D game engine design of the source [three-dimensionalvirtualrealitynetworkprogram] - "virtual
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:

// Landscape.java
// Andrew Davison, August 2003, dandrew@ratree.psu.ac.th

/* Landscape loads a landscape made up of a mesh and a texture.
   If the user supplied the filename, fname, then Landscape looks
   in models/fname.obj for the mesh, and models/fname.jpg for the
   texture.

   The resulting BranchGroup, landBG, is added to the scene (sceneBG).

   The Landscape may contain two kinds of scenery:

     * full 3D shapes, loaded with PropManager.
       Intended for irregular objects which the user can move around,
       and perhaps enter (e.g. a castle).

     * ground cover, which are 2D images that rotate to always face
       the user. Intended for simple, symmetrical objects that
       'decorate' the scene, such as trees, bushes.

       Since many copies will be required, a SharedGroup node is
       used for each unique piece of ground cover.
       Ground cover is managed by a GroundCover object.

    The Landscape is surrounded by four walls which are covered
    in a mountain range image.
*/

import java.io.*;
import java.util.*;

import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.image.*;

import com.sun.j3d.loaders.objectfile.ObjectFile;
import com.sun.j3d.loaders.*;

import com.sun.j3d.utils.picking.*;



public class Landscape
{
  private static final double LAND_LEN = 60.0;  
           // length of landscape in world coordinates
  private static final String WALL_PIC = "models/mountain2Sq.jpg";
           // texture used for the four walls around the landscape

  private BranchGroup sceneBG;
  private BranchGroup landBG = null;   // holding the landscape parts
  private Shape3D landShape3D = null;  // holding the landscape mesh

  // various mesh dimensions, set in getLandDimensions()
  private double landLength, minHeight, maxHeight;
  private double scaleLen;

  private Vector3d originVec = null;   
       // where the user starts in the landscape (in world coordinates)


  public Landscape(BranchGroup sceneBG, String fname)
  {
    this.sceneBG = sceneBG;
    loadMesh(fname);        // initialize landBG
    getLandShape(landBG);   // initialize landShape3D

    // set the picking capabilities so that intersection
    // coords can be extracted after the shape is picked
    PickTool.setCapabilities(landShape3D, PickTool.INTERSECT_COORD);
 
    getLandDimensions(landShape3D);   // extracts sizes from landShape3D

    makeScenery(landBG, fname);   // add any scenery
    addWalls();                   // walls around the landscape

    GroundCover gc = new GroundCover(fname);
    landBG.addChild( gc.getCoverBG() );    // add any ground cover

    addLandtoScene(landBG);
    addLandTexture(landShape3D, fname);
  }  // end Landscape()



  private void loadMesh(String fname)
  /* Load the terrain mesh from models/fname.obj.
     We use Java 3D's OBJ loader. Then assign its BranchGroup to
     landBG.
  */
  {
    FileWriter ofw = null;
    String fn = new String("models/" + fname + ".obj");   // assume OBJ file in models/
    System.out.println( "Loading terrain mesh from: " + fn + " ..." );
    try {
      ObjectFile f = new ObjectFile();    // ObjectFile.STRIPIFY
      Scene loadedScene = f.load(fn);

      if(loadedScene == null ) {
        System.out.println("Scene not found in: " + fn);
        System.exit(0);
      }
 
      landBG = loadedScene.getSceneGroup();    // the land's BG
      if(landBG == null ) {
        System.out.println("No land branch group found");
        System.exit(0);
      }
    }
    catch( IOException ioe )
    { System.err.println("Terrain mesh load error: " + fn); 
      System.exit(0);
    }
  } // end of loadMesh()



  private void getLandShape(BranchGroup landBG)
  /* Check that landBG (the mesh's BranchGroup) contains a
     single Shape3D, and assign it to landShape3D for later.
     Also check that the shape holds a single GeometryArray.

     landShape3D is later used for picking, and its dimensions
     are extracted. 
  */
  {
    if (landBG.numChildren() > 1)
      System.out.println("More than one child in land branch group");

    Node node = landBG.getChild(0);
    if (!(node instanceof Shape3D)) {
      System.out.println("No Shape3D found in land branch group");
      System.exit(0);
    }
    landShape3D = (Shape3D) node;
  
    if (landShape3D == null) {
      System.out.println("Land Shape3D has no value");
      System.exit(0);
    }

    if (landShape3D.numGeometries() > 1)
      System.out.println("More than 1 geometry in land branch group");

    Geometry g = landShape3D.getGeometry();
    if (!(g instanceof GeometryArray)) {
      System.out.println("No Geometry Array found in land Shape3D");
      System.exit(0);
    }
  }  // end of getLandShape()



  private void getLandDimensions(Shape3D landShape3D)
  /* If we reach this point, then landShape3D contains a single
     GeometryArray of points representing the landscape's mesh.
     
     We can get the dimensions of the mesh by using a BoundingBox.

     Check if the XY plane is the 'floor' of the landscape, which
     is how the TerraGen mesh should have been exported. The X and
     Y lengths should be the same, and start at (0,0).

     Set the following vars:
       * landLength     // length of the X (and Y) side
       * scaleLen       // the scaling necessary to fit landLength
                        // into LAND_LEN units in the world
       * minHeight and maxHeight   // along the Z axis
  */
  {
    // get the bounds of the shape
    BoundingBox boundBox = new BoundingBox( landShape3D.getBounds() );
    Point3d lower = new Point3d();
    Point3d upper = new Point3d();
    boundBox.getLower(lower); boundBox.getUpper(upper);
    System.out.println("lower: " + lower + "\nupper: " + upper );

   if ((lower.y == 0) && (upper.x == upper.y)) {
     // System.out.println("XY being used as the floor");
   }
   else if ((lower.z == 0) && (upper.x == upper.z)) {
     System.out.println("Error: XZ set as the floor; change to XY in Terragen");
     System.exit(0);
   }
   else {
     System.out.println("Cannot determine floor axes");
     System.out.println("Y range should == X range, and start at 0");
     System.exit(0);
   }

   landLength = upper.x;
   scaleLen = LAND_LEN/landLength;
   System.out.println("scaleLen: " + scaleLen );
   minHeight = lower.z;  
   maxHeight = upper.z;
  }  // end of getLandDimensions()


  private void addLandtoScene(BranchGroup landBG)
  /* The floor of the landscape is the XY plane, starting at (0,0),
     with sides of landLength units.

     The landscape (landBG) is rotated to lie on the XZ plane, scaled
     to have floor sides of length LAND_LEN (scaleLen = LAND_LEN/landLength),
     then translated so that the center of the landscape is at (0,0).
  */
  {
     // rotate and scale land
     Transform3D t3d = new Transform3D();
     t3d.rotX( -Math.PI/2.0 );    // so land's XY is resting on the XZ plane
     t3d.setScale( new Vector3d(scaleLen, scaleLen, scaleLen) );  // scale
     TransformGroup sTG = new TransformGroup(t3d);
     sTG.addChild(landBG);

     // center the land, which starts at (0,0) on the XZ plane,
     // so move it left and forward
     Transform3D t3d1 = new Transform3D();
     t3d1.set( new Vector3d(-LAND_LEN/2, 0, LAND_LEN/2));  // translate
     TransformGroup posTG = new TransformGroup(t3d1);
     posTG.addChild( sTG ); 

     sceneBG.addChild(posTG);
  }  // end of addLandtoScene()



  // ----------------------- add texture to the land ------------------


  private void addLandTexture(Shape3D shape, String fname)
  /* The land texture (in models/fname.jpg) shows the landscape from
     above, and is used to colour the mesh loaded from the OBJ file.

     To save memory, the shape is one-sided.
     The texture is blended with a white material so that lighting 
     effects can be shown.
  */
  {  Appearance app = shape.getAppearance();

    // generate texture coords that 'stretch' the texture over the mesh
    app.setTexCoordGeneration( stampTexCoords(shape) );

    // combine texture with colour and lighting of underlying surface
    TextureAttributes ta = new TextureAttributes();
    ta.setTextureMode( TextureAttributes.MODULATE );
    app.setTextureAttributes( ta );

    // apply texture to shape
    Texture2D tex = loadLandTexture(fname);
    if (tex != null) {
      app.setTexture(tex);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩成人综合天天影院 | 欧美亚洲动漫精品| 久久亚洲一区二区三区四区| 久久精品综合网| 亚州成人在线电影| 不卡视频一二三四| 久久先锋影音av鲁色资源网| 亚洲国产婷婷综合在线精品| 国产福利一区二区| 欧美va亚洲va在线观看蝴蝶网| 亚洲精品亚洲人成人网在线播放| 国产在线视视频有精品| 欧美精品在线观看一区二区| 亚洲免费看黄网站| av动漫一区二区| 国产精品午夜春色av| 激情欧美日韩一区二区| 欧美一区二区三区在线观看| 一二三四区精品视频| 91在线视频18| 国产精品国产三级国产三级人妇 | 亚洲电影你懂得| 色偷偷一区二区三区| 国产精品高潮呻吟| jlzzjlzz亚洲女人18| 国产精品每日更新在线播放网址| 韩国精品免费视频| 久久久亚洲欧洲日产国码αv| 麻豆精品国产91久久久久久| 日韩一区二区精品在线观看| 蜜桃av噜噜一区二区三区小说| 欧美顶级少妇做爰| 青青草精品视频| 日韩免费视频一区二区| 久久精品国产精品青草| 久久久久久久电影| 国产91精品一区二区| 中文字幕在线一区二区三区| 成人av免费网站| 亚洲人成网站影音先锋播放| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲三级在线观看| 欧美日韩精品一区二区在线播放| 亚洲在线观看免费视频| 欧美一区二区三区免费视频 | 久久综合九色欧美综合狠狠| 国内成+人亚洲+欧美+综合在线| 国产午夜精品在线观看| 成人av网站免费观看| 一区二区三区在线免费视频| 欧美日韩国产中文| 韩国午夜理伦三级不卡影院| 国产欧美日本一区二区三区| av一二三不卡影片| 视频在线观看国产精品| 2024国产精品| 欧美精品亚洲二区| 国产乱一区二区| 综合亚洲深深色噜噜狠狠网站| 欧美日韩一级片在线观看| 久久成人久久鬼色| 国产精品久久久久久久蜜臀| 欧美色大人视频| 国产九色精品成人porny| 亚洲欧美一区二区三区国产精品 | 久久午夜电影网| 欧美性高清videossexo| 激情综合色播五月| 亚洲精品自拍动漫在线| 日韩欧美国产一区二区三区| 99精品欧美一区二区蜜桃免费| 丝袜美腿亚洲色图| 中文字幕+乱码+中文字幕一区| 欧美日韩国产美女| 成人性生交大片免费看在线播放 | 一区二区在线免费| 久久综合狠狠综合久久激情| 在线免费观看日韩欧美| 国产精品一区二区三区网站| 亚洲综合一区二区三区| 国产午夜精品在线观看| 欧美吞精做爰啪啪高潮| 成人白浆超碰人人人人| 国产一区啦啦啦在线观看| 欧美日本乱大交xxxxx| 亚洲图片你懂的| 精品国产不卡一区二区三区| 精品视频免费在线| 国产经典欧美精品| 另类中文字幕网| 亚洲r级在线视频| 亚洲欧美日韩人成在线播放| 国产日韩欧美精品在线| 日韩三级中文字幕| 欧美性xxxxxxxx| 99re在线视频这里只有精品| 国内成人免费视频| 久久99国产精品免费| 石原莉奈在线亚洲二区| 亚洲最大成人网4388xx| 亚洲乱码国产乱码精品精小说| 国产亚洲1区2区3区| 精品国产乱码久久久久久免费| 欧美日本一区二区| 3atv在线一区二区三区| 欧美日韩中文字幕一区| 欧美综合天天夜夜久久| 日本精品视频一区二区三区| 成人精品gif动图一区| 成人午夜av影视| 成人av综合在线| 91偷拍与自偷拍精品| 99综合电影在线视频| 色综合天天性综合| 91精品国产综合久久精品| 91国偷自产一区二区三区观看| 色综合婷婷久久| 欧美日韩一级片在线观看| 717成人午夜免费福利电影| 欧美裸体bbwbbwbbw| 欧美一级生活片| 精品国产自在久精品国产| www国产精品av| 国产精品久久久久久妇女6080| 中文字幕日韩精品一区| 亚洲欧美电影一区二区| 亚洲成国产人片在线观看| 免费观看日韩电影| 国产综合色在线| 99re热这里只有精品免费视频| 色婷婷激情综合| 欧美丰满美乳xxx高潮www| 欧美r级在线观看| 亚洲欧美中日韩| 日韩高清不卡在线| 国产成+人+日韩+欧美+亚洲| 99久久777色| 欧美日韩一区二区三区在线| 日韩欧美亚洲另类制服综合在线| 精品国产成人在线影院 | 日本一区二区动态图| 亚洲欧洲www| 日本不卡视频在线观看| 精品亚洲国产成人av制服丝袜| 成人丝袜18视频在线观看| 欧美三区在线观看| 国产日产精品一区| 亚洲成在人线免费| 国产成人精品影视| 欧美日韩国产精选| 欧美国产成人精品| 日韩av午夜在线观看| 成人av电影在线| 欧美一区二区三区婷婷月色| 国产精品国产a级| 麻豆91在线播放免费| 91黄色免费版| 国产蜜臀97一区二区三区| 日韩精品午夜视频| 91麻豆国产福利精品| 久久精品一区二区三区不卡牛牛| 亚洲在线成人精品| 成人黄色777网| 精品国产伦一区二区三区观看体验| 中文字幕亚洲成人| 国产福利一区在线观看| 91精品久久久久久久91蜜桃| 亚洲靠逼com| 成人av在线看| 久久久美女毛片| 麻豆国产欧美一区二区三区| 在线日韩av片| 亚洲人成人一区二区在线观看| 国产在线精品一区二区夜色| 欧美日产在线观看| 亚洲午夜视频在线观看| 成人久久视频在线观看| 欧美精品一区二区三区在线播放| 亚洲h精品动漫在线观看| 色综合天天综合狠狠| 中文字幕av不卡| 国产成人自拍在线| 久久久久免费观看| 久久99国产精品久久| 日韩精品一区二区三区swag| 天天操天天干天天综合网| 日本精品视频一区二区| 亚洲日本欧美天堂| 色综合久久久网| 捆绑调教一区二区三区| 欧美一区二区视频网站| 日韩精品1区2区3区| 91精品国产日韩91久久久久久| 亚洲成人免费视频| 欧美日韩久久一区| 日本aⅴ精品一区二区三区| 欧美一区午夜精品| 美国十次综合导航| 精品国产一二三区| 国产成人日日夜夜|