基于OpenGL实现的3D飞机上下左右移动 通过上下左右前后六个摄像头分别观察飞机模型
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-16 17:37 A2- 14871088
目录 0 2018-03-01 23:36 A2- 14871088in
目录 0 2018-03-01 23:36 A2- 14871088inRainParticle
文件 2452 2018-03-01 23:36 A2- 14871088inRainParticleRainParticle.class
文件 2278 2018-03-01 23:36 A2- 14871088inRainParticleParticleSystem.class
文件 804 2018-03-01 23:36 A2- 14871088inMain$1.class
文件 746 2018-03-01 23:36 A2- 14871088inMain$1$1.class
目录 0 2018-03-01 23:36 A2- 14871088inHelicopter
文件 10244 2018-03-01 23:36 A2- 14871088inHelicopterHelicopterRotors.class
文件 4656 2018-03-01 23:36 A2- 14871088inHelicopterHelicopterBody.class
目录 0 2018-03-01 23:36 A2- 14871088inTerrain
文件 1469 2018-03-01 23:36 A2- 14871088inTerrainHeightmapTerrain.class
文件 2796 2018-03-01 23:36 A2- 14871088inTerrainVector.class
文件 5525 2018-03-01 23:36 A2- 14871088inTerrainAbstractTerrain.class
文件 11336 2018-03-01 23:36 A2- 14871088inMain.class
目录 0 2018-03-01 23:36 A2- 14871088inSceneGraph
文件 2162 2018-03-01 23:36 A2- 14871088inSceneGraphScene.class
文件 1706 2018-03-01 23:36 A2- 14871088inSceneGraphVector3D.class
目录 0 2018-03-01 23:36 A2- 14871088inSceneGraphRenderables
文件 3574 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSkybox.class
文件 1229 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesCylinder.class
文件 1792 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesTree$Trunk.class
文件 1051 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesQuadrics.class
文件 4858 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesGround.class
文件 1390 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesBallTree.class
文件 1622 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSharpTree$SharpTreeHead.class
文件 1725 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesCube.class
文件 1108 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSphere.class
文件 780 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesTree.class
文件 1472 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSphereTree.class
文件 1162 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesDisc.class
............此处省略115个文件信息
import java.awt.Color;
import java.awt.frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import com.sun.opengl.util.Animator;
import com.sun.opengl.util.GLUT;
import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureIO;
import Helicopter.HelicopterRotors;
import RainParticle.ParticleSystem;
import SceneGraph.CameraNode;
import SceneGraph.LightNode;
import SceneGraph.Material;
import SceneGraph.Point3D;
import SceneGraph.Scene;
import SceneGraph.Vector3D;
import SceneGraph.Camera.*;
import SceneGraph.Light.DirectionalLight;
import SceneGraph.Light.PointLight;
import SceneGraph.Model.ObjModel;
import SceneGraph.Renderables.*;
import Terrain.AbstractTerrain;
import Terrain.HeightmapTerrain;
public class Main implements GLEventListener {
private Scene scene = null;
HelicopterRotors helicopter = null;
private double lastTick;
private GLUT glut = new GLUT();
private int windowWidth;
private int windowHeight;
private CameraNode[] camera;
private AbstractTerrain terrain;
private Texture terrainTexture;
private SmallPond pond;
private LightNode light = null;
private double clock = 0.0f; // the clock ranges from 0 to 24 - denoting hour of a day
GL gl;
private ParticleSystem particleSystem;
private ObjModel model;
@Override
// called when OpenGL is initialised
public void init(GLAutoDrawable drawable) {
gl = drawable.getGL();
lastTick = System.currentTimeMillis() / 1000.0;
scene = new Scene();
glut = new GLUT();
scene.setAmbientLightColour(Color.BLACK);
Origin origin = new Origin(“Axes“ scene.getRootNode());
origin.setScale(2.0f 2.0f 2.0f);
Ground ground = new Ground(“Grid“ scene.getRootNode() 98 1 drawable);
ground.getOrientation().setPitch(90.0f);
Skybox skybox = null;
Texture[] sky = new Texture[6];
try {
sky[0]= TextureIO.newTexture(new File(“data/textures/cloudy_noon_DN.jpg“) true);
sky[1]= TextureIO.newTexture(new File(“data/textures/sky_forward.png“) true);
sky[2]= TextureIO.newTexture(new File(“data/textures/sky_right.png“) true);
sky[3]= TextureIO.newTexture(new File(“data/textures/sky_back.png“) true);
sky[4]= TextureIO.newTexture(new File(“data/textures/sky_left.png“) true);
sky[5]= TextureIO.newTexture(new File(“data/textures/sky_up.png“) true);
skybox = new Skybox(“lovely day“ scene.getRootNode() sky);
} catch (IOException e) {
throw new RuntimeException(e);
}
skybox.setScale(100.0f 100.0f 100.0f);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-16 17:37 A2- 14871088
目录 0 2018-03-01 23:36 A2- 14871088in
目录 0 2018-03-01 23:36 A2- 14871088inRainParticle
文件 2452 2018-03-01 23:36 A2- 14871088inRainParticleRainParticle.class
文件 2278 2018-03-01 23:36 A2- 14871088inRainParticleParticleSystem.class
文件 804 2018-03-01 23:36 A2- 14871088inMain$1.class
文件 746 2018-03-01 23:36 A2- 14871088inMain$1$1.class
目录 0 2018-03-01 23:36 A2- 14871088inHelicopter
文件 10244 2018-03-01 23:36 A2- 14871088inHelicopterHelicopterRotors.class
文件 4656 2018-03-01 23:36 A2- 14871088inHelicopterHelicopterBody.class
目录 0 2018-03-01 23:36 A2- 14871088inTerrain
文件 1469 2018-03-01 23:36 A2- 14871088inTerrainHeightmapTerrain.class
文件 2796 2018-03-01 23:36 A2- 14871088inTerrainVector.class
文件 5525 2018-03-01 23:36 A2- 14871088inTerrainAbstractTerrain.class
文件 11336 2018-03-01 23:36 A2- 14871088inMain.class
目录 0 2018-03-01 23:36 A2- 14871088inSceneGraph
文件 2162 2018-03-01 23:36 A2- 14871088inSceneGraphScene.class
文件 1706 2018-03-01 23:36 A2- 14871088inSceneGraphVector3D.class
目录 0 2018-03-01 23:36 A2- 14871088inSceneGraphRenderables
文件 3574 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSkybox.class
文件 1229 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesCylinder.class
文件 1792 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesTree$Trunk.class
文件 1051 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesQuadrics.class
文件 4858 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesGround.class
文件 1390 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesBallTree.class
文件 1622 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSharpTree$SharpTreeHead.class
文件 1725 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesCube.class
文件 1108 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSphere.class
文件 780 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesTree.class
文件 1472 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesSphereTree.class
文件 1162 2018-03-01 23:36 A2- 14871088inSceneGraphRenderablesDisc.class
............此处省略115个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)