terra3d.java

来自「java3D game engine design of the source 」· Java 代码 · 共 71 行

JAVA
71
字号
// Terra3D.java// Andrew Davison, August 2003, dandrew@ratree.psu.ac.th/* Load a terrain created using the TerraGen application,   and exported as a .obj file (a mesh) and a .jpg (a texture).   Use the Terra3D.bat file which takes the name of the   terrain as an argument.     e.g. Terrain3D test2   This looks in /models for test2.obj and test2.jpg.   The terrain may include 3D scenery, and *must* have a start   position for the user, which are specified in            /models/<fn>.txt   e.g.    /models/test2.txt   The terrain may be populated with ground cover at random locations   within a certain range of heights.   The name of the ground cover GIFs, and the number required are   specified in            /models/<fn>GC.txt   e.g.    /models/test2GC.txt   The user can navigate over the surface of the terrain using   key controls.   ------------------------------------------   Compilation can be carried out with compileTerra3D.bat:        javac -classpath "%CLASSPATH%;ncsa\portfolio.jar" *.java*/import javax.swing.*;import java.awt.*;public class Terra3D extends JFrame{  public Terra3D(String fn)   {    super("Terra3D");    Container c = getContentPane();    c.setLayout( new BorderLayout() );    WrapTerra3D w3d = new WrapTerra3D(fn);    c.add(w3d, BorderLayout.CENTER);    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );    pack();    setResizable(false);    // fixed size display    show();  } // end of Terra3D()// -----------------------------------------  public static void main(String[] args)  {     if (args.length == 1)      new Terra3D(args[0]);    else      System.out.println(       "Usage: java -cp %CLASSPATH%;ncsa\\portfolio.jar Terra3D  <file>");  }} // end of Terra3D class

⌨️ 快捷键说明

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