org.lwjglb.engine.graph.Renderer.init()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.lwjglb.engine.graph.Renderer.init方法的一些代码示例,展示了Renderer.init的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Renderer.init方法的具体详情如下:
包路径:org.lwjglb.engine.graph.Renderer
类名称:Renderer
方法名:init

Renderer.init介绍

暂无

代码示例

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  float skyBoxScale = 50.0f;
  float terrainScale = 10;
  int terrainSize = 3;
  float minY = -0.1f;
  float maxY = 0.1f;
  int textInc = 40;
  Terrain terrain = new Terrain(terrainSize, terrainScale, minY, maxY, "/textures/heightmap.png", "/textures/terrain.png", textInc);
  scene.setGameItems(terrain.getGameItems());
  // Setup  SkyBox
  SkyBox skyBox = new SkyBox("/models/skybox.obj", "/textures/skybox.png");
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  // Create HUD
  hud = new Hud("DEMO");
  camera.getPosition().x = 0.0f;
  camera.getPosition().z = 0.0f;
  camera.getPosition().y = -0.2f;
  camera.getRotation().x = 10.f;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  float skyBoxScale = 50.0f;        
  float terrainScale = 10;
  //int terrainSize = 3;
  int terrainSize = 3;
  float minY = -0.1f;
  float maxY = 0.1f;
  int textInc = 40;
  terrain = new Terrain(terrainSize, terrainScale, minY, maxY, "/textures/heightmap.png", "/textures/terrain.png", textInc);
  //terrain = new Terrain(terrainSize, terrainScale, minY, maxY, "/textures/heightmap_test.png", "/textures/terrain.png", textInc);
  scene.setGameItems(terrain.getGameItems());
  // Setup  SkyBox
  SkyBox skyBox = new SkyBox("/models/skybox.obj", "/textures/skybox.png");
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  // Create HUD
  hud = new Hud("DEMO");
  camera.getPosition().x = 0.0f;
  camera.getPosition().y = 5.0f;
  camera.getPosition().z = 0.0f;
  camera.getRotation().x = 90;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  float skyBoxScale = 50.0f;        
  float terrainScale = 10;
  //int terrainSize = 3;
  int terrainSize = 3;
  float minY = -0.1f;
  float maxY = 0.1f;
  int textInc = 40;
  terrain = new Terrain(terrainSize, terrainScale, minY, maxY, "/textures/heightmap.png", "/textures/terrain.png", textInc);
  scene.setGameItems(terrain.getGameItems());
  scene.setFog(new Fog(true, new Vector3f(0.5f, 0.5f, 0.5f), 0.15f));
  
  // Setup  SkyBox
  SkyBox skyBox = new SkyBox("/models/skybox.obj", "/textures/skybox.png");
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  // Create HUD
  hud = new Hud("DEMO");
  camera.getPosition().x = 0.0f;
  camera.getPosition().y = 5.0f;
  camera.getPosition().z = 0.0f;
  camera.getRotation().x = 90;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  // Setup  GameItems
  float reflectance = 1f;
  Mesh cubeMesh = OBJLoader.loadMesh("/models/cube.obj");
  Material cubeMaterial = new Material(new Vector4f(0, 1, 0, 1), reflectance);
  cubeMesh.setMaterial(cubeMaterial);
  cubeGameItem = new GameItem(cubeMesh);
  cubeGameItem.setPosition(0, 0, 0);
  cubeGameItem.setScale(0.5f);
  Mesh quadMesh = OBJLoader.loadMesh("/models/plane.obj");
  Material quadMaterial = new Material(new Vector4f(0.0f, 0.0f, 1.0f, 10.0f), reflectance);
  quadMesh.setMaterial(quadMaterial);
  GameItem quadGameItem = new GameItem(quadMesh);
  quadGameItem.setPosition(0, -1, 0);
  quadGameItem.setScale(2.5f);
  scene.setGameItems(new GameItem[]{cubeGameItem, quadGameItem});
  // Setup Lights
  setupLights();
  camera.getPosition().z = 2;
  hud = new Hud("");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  float reflectance = 1f;
  Mesh quadMesh = OBJLoader.loadMesh("/models/plane.obj");
  Material quadMaterial = new Material(new Vector4f(0.0f, 0.0f, 1.0f, 1.0f), reflectance);
  quadMesh.setMaterial(quadMaterial);
  GameItem quadGameItem = new GameItem(quadMesh);
  quadGameItem.setPosition(0, 0, 0);
  quadGameItem.setScale(2.5f);
  // Setup  GameItems
  MD5Model md5Meshodel = MD5Model.parse("/models/monster.md5mesh");
  GameItem monster = MD5Loader.process(md5Meshodel, new Vector4f(1, 1, 1, 1));
  monster.setScale(0.05f);
  monster.setRotation(90, 0, 0);
  scene.setGameItems(new GameItem[] { quadGameItem, monster} );
  // Setup Lights
  setupLights();
  camera.getPosition().x = 0.25f;
  camera.getPosition().y = 6.5f;
  camera.getPosition().z = 6.5f;
  camera.getRotation().x = 25;
  camera.getRotation().y = -1;
  hud = new Hud("");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  // Setup  GameItems
  float reflectance = 1f;
  Mesh cubeMesh = OBJLoader.loadMesh("/models/cube.obj");
  Material cubeMaterial = new Material(new Vector4f(0, 1, 0, 1), reflectance);
  cubeMesh.setMaterial(cubeMaterial);
  cubeGameItem = new GameItem(cubeMesh);
  cubeGameItem.setPosition(0, 0, 0);
  cubeGameItem.setScale(0.5f);
  Mesh quadMesh = OBJLoader.loadMesh("/models/plane.obj");
  Material quadMaterial = new Material(new Vector4f(0.0f, 0.0f, 1.0f, 1.0f), reflectance);
  quadMesh.setMaterial(quadMaterial);
  GameItem quadGameItem = new GameItem(quadMesh);
  quadGameItem.setPosition(0, -1, 0);
  quadGameItem.setScale(2.5f);
  scene.setGameItems(new GameItem[]{cubeGameItem, quadGameItem});
  // Setup Lights
  setupLights();
  camera.getPosition().z = 2;
  hud = new Hud("");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  Mesh[] houseMesh = StaticMeshesLoader.load("src/main/resources/models/house/house.obj", "src/main/resources/models/house");
  GameItem house = new GameItem(houseMesh);
  Mesh[] terrainMesh = StaticMeshesLoader.load("src/main/resources/models/terrain/terrain.obj", "src/main/resources/models/terrain");
  GameItem terrain = new GameItem(terrainMesh);
  terrain.setScale(100.0f);
  scene.setGameItems(new GameItem[]{house, terrain});
  // Shadows
  scene.setRenderShadows(true);
  // Fog
  Vector3f fogColour = new Vector3f(0.5f, 0.5f, 0.5f);
  scene.setFog(new Fog(true, fogColour, 0.02f));
  // Setup  SkyBox
  float skyBoxScale = 100.0f;
  SkyBox skyBox = new SkyBox("src/main/resources/models/skybox.obj", new Vector4f(0.65f, 0.65f, 0.65f, 1.0f));
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  camera.getPosition().x = -17.0f;
  camera.getPosition().y =  17.0f;
  camera.getPosition().z = -30.0f;
  camera.getRotation().x = 20.0f;
  camera.getRotation().y = 140.f;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  Mesh[] houseMesh = StaticMeshesLoader.load("src/main/resources/models/house/house.obj", "src/main/resources/models/house");
  GameItem house = new GameItem(houseMesh);
  Mesh[] terrainMesh = StaticMeshesLoader.load("src/main/resources/models/terrain/terrain.obj", "src/main/resources/models/terrain");
  GameItem terrain = new GameItem(terrainMesh);
  terrain.setScale(100.0f);
  scene.setGameItems(new GameItem[]{house, terrain});
  // Shadows
  scene.setRenderShadows(true);
  // Fog
  Vector3f fogColour = new Vector3f(0.5f, 0.5f, 0.5f);
  scene.setFog(new Fog(true, fogColour, 0.02f));
  // Setup  SkyBox
  float skyBoxScale = 100.0f;
  SkyBox skyBox = new SkyBox("src/main/resources/models/skybox.obj", new Vector4f(0.65f, 0.65f, 0.65f, 1.0f));
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  camera.getPosition().x = -17.0f;
  camera.getPosition().y =  17.0f;
  camera.getPosition().z = -30.0f;
  camera.getRotation().x = 20.0f;
  camera.getRotation().y = 140.f;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  // Setup  GameItems
  float reflectance = 0.65f;
  Texture normalMap = new Texture("/textures/rock_normals.png");
  Mesh quadMesh1 = OBJLoader.loadMesh("/models/quad.obj");
  Texture texture = new Texture("/textures/rock.png");
  Material quadMaterial1 = new Material(texture, reflectance);
  quadMesh1.setMaterial(quadMaterial1);
  GameItem quadGameItem1 = new GameItem(quadMesh1);
  quadGameItem1.setPosition(-3f, 0, 0);
  quadGameItem1.setScale(2.0f);
  quadGameItem1.setRotation(90, 0, 0);
  Mesh quadMesh2 = OBJLoader.loadMesh("/models/quad.obj");
  Material quadMaterial2 = new Material(texture, reflectance);
  quadMaterial2.setNormalMap(normalMap);
  quadMesh2.setMaterial(quadMaterial2);
  GameItem quadGameItem2 = new GameItem(quadMesh2);
  quadGameItem2.setPosition(3f, 0, 0);
  quadGameItem2.setScale(2.0f);
  quadGameItem2.setRotation(90, 0, 0);
  scene.setGameItems(new GameItem[]{quadGameItem1, quadGameItem2});
  // Setup Lights
  setupLights();
  camera.getPosition().y = 5.0f;
  camera.getRotation().x = 90;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  Mesh[] terrainMesh = StaticMeshesLoader.load("src/main/resources/models/terrain/terrain.obj", "src/main/resources/models/terrain");
  GameItem terrain = new GameItem(terrainMesh);
  terrain.setScale(100.0f);
  animItem = AnimMeshesLoader.loadAnimGameItem("src/main/resources/models/bob/boblamp.md5mesh", "");
  animItem.setScale(0.05f);
  animation = animItem.getCurrentAnimation();
  
  scene.setGameItems(new GameItem[]{animItem, terrain});
  // Shadows
  scene.setRenderShadows(true);
  // Fog
  Vector3f fogColour = new Vector3f(0.5f, 0.5f, 0.5f);
  scene.setFog(new Fog(true, fogColour, 0.02f));
  // Setup  SkyBox
  float skyBoxScale = 100.0f;
  SkyBox skyBox = new SkyBox("src/main/resources/models/skybox.obj", new Vector4f(0.65f, 0.65f, 0.65f, 1.0f));
  skyBox.setScale(skyBoxScale);
  scene.setSkyBox(skyBox);
  // Setup Lights
  setupLights();
  camera.getPosition().x = -1.5f;
  camera.getPosition().y = 3.0f;
  camera.getPosition().z = 4.5f;
  camera.getRotation().x = 15.0f;
  camera.getRotation().y = 390.0f;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);
  scene = new Scene();
  float reflectance = 1f;
  Mesh quadMesh = OBJLoader.loadMesh("/models/plane.obj");
  Material quadMaterial = new Material(new Vector4f(0.0f, 0.0f, 1.0f, 1.f), reflectance);
  quadMesh.setMaterial(quadMaterial);
  GameItem quadGameItem = new GameItem(quadMesh);
  quadGameItem.setPosition(0, 0, 0);
  quadGameItem.setScale(2.5f);
  // Setup  GameItems
  MD5Model md5Meshodel = MD5Model.parse("/models/monster.md5mesh");
  MD5AnimModel md5AnimModel = MD5AnimModel.parse("/models/monster.md5anim");
  //MD5Model md5Meshodel = MD5Model.parse("/models/boblamp.md5mesh");
  //MD5AnimModel md5AnimModel = MD5AnimModel.parse("/models/boblamp.md5anim");
  
  monster = MD5Loader.process(md5Meshodel, md5AnimModel, new Vector4f(1, 1, 1, 1));
  monster.setScale(0.05f);
  monster.setRotation(90, 0, 0);
  scene.setGameItems(new GameItem[] { quadGameItem, monster} );
  // Setup Lights
  setupLights();
  camera.getPosition().x = 0.25f;
  camera.getPosition().y = 6.5f;
  camera.getPosition().z = 6.5f;
  camera.getRotation().x = 25;
  camera.getRotation().y = -1;
  hud = new Hud("");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void init(Window window) throws Exception {
  renderer.init(window);

相关文章