本文整理了Java中org.lwjglb.engine.items.Terrain.getHeight()
方法的一些代码示例,展示了Terrain.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terrain.getHeight()
方法的具体详情如下:
包路径:org.lwjglb.engine.items.Terrain
类名称:Terrain
方法名:getHeight
暂无
代码示例来源:origin: lwjglgamedev/lwjglbook
@Override
public void update(float interval, MouseInput mouseInput) {
// Update camera based on mouse
if (mouseInput.isRightButtonPressed()) {
Vector2f rotVec = mouseInput.getDisplVec();
camera.moveRotation(rotVec.x * MOUSE_SENSITIVITY, rotVec.y * MOUSE_SENSITIVITY, 0);
}
// Update camera position
Vector3f prevPos = new Vector3f(camera.getPosition());
camera.movePosition(cameraInc.x * CAMERA_POS_STEP, cameraInc.y * CAMERA_POS_STEP, cameraInc.z * CAMERA_POS_STEP);
// Check if there has been a collision. If true, set the y position to
// the maximum height
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
}
lightAngle += angleInc;
if (lightAngle < 0) {
lightAngle = 0;
} else if (lightAngle > 180) {
lightAngle = 180;
}
float zValue = (float) Math.cos(Math.toRadians(lightAngle));
float yValue = (float) Math.sin(Math.toRadians(lightAngle));
Vector3f lightDirection = this.scene.getSceneLight().getDirectionalLight().getDirection();
lightDirection.x = 0;
lightDirection.y = yValue;
lightDirection.z = zValue;
lightDirection.normalize();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
@Override
public void update(float interval, MouseInput mouseInput) {
// Update camera based on mouse
if (mouseInput.isRightButtonPressed()) {
Vector2f rotVec = mouseInput.getDisplVec();
camera.moveRotation(rotVec.x * MOUSE_SENSITIVITY, rotVec.y * MOUSE_SENSITIVITY, 0);
}
// Update camera position
Vector3f prevPos = new Vector3f(camera.getPosition());
camera.movePosition(cameraInc.x * CAMERA_POS_STEP, cameraInc.y * CAMERA_POS_STEP, cameraInc.z * CAMERA_POS_STEP);
// Check if there has been a collision. If true, set the y position to
// the maximum height
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
}
lightAngle += angleInc;
if (lightAngle < 0) {
lightAngle = 0;
} else if (lightAngle > 180) {
lightAngle = 180;
}
float zValue = (float) Math.cos(Math.toRadians(lightAngle));
float yValue = (float) Math.sin(Math.toRadians(lightAngle));
Vector3f lightDirection = this.scene.getSceneLight().getDirectionalLight().getDirection();
lightDirection.x = 0;
lightDirection.y = yValue;
lightDirection.z = zValue;
lightDirection.normalize();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
@Override
public void update(float interval, MouseInput mouseInput) {
// Update camera based on mouse
if (mouseInput.isRightButtonPressed()) {
Vector2f rotVec = mouseInput.getDisplVec();
camera.moveRotation(rotVec.x * MOUSE_SENSITIVITY, rotVec.y * MOUSE_SENSITIVITY, 0);
}
// Update camera position
Vector3f prevPos = new Vector3f(camera.getPosition());
camera.movePosition(cameraInc.x * CAMERA_POS_STEP, cameraInc.y * CAMERA_POS_STEP, cameraInc.z * CAMERA_POS_STEP);
// Check if there has been a collision. If true, set the y position to
// the maximum height
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
}
lightAngle += angleInc;
if (lightAngle < 0) {
lightAngle = 0;
} else if (lightAngle > 180) {
lightAngle = 180;
}
float zValue = (float) Math.cos(Math.toRadians(lightAngle));
float yValue = (float) Math.sin(Math.toRadians(lightAngle));
Vector3f lightDirection = this.scene.getSceneLight().getDirectionalLight().getDirection();
lightDirection.x = 0;
lightDirection.y = yValue;
lightDirection.z = zValue;
lightDirection.normalize();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
@Override
public void update(float interval, MouseInput mouseInput) {
// Update camera based on mouse
if (mouseInput.isRightButtonPressed()) {
Vector2f rotVec = mouseInput.getDisplVec();
camera.moveRotation(rotVec.x * MOUSE_SENSITIVITY, rotVec.y * MOUSE_SENSITIVITY, 0);
}
// Update camera position
Vector3f prevPos = new Vector3f(camera.getPosition());
camera.movePosition(cameraInc.x * CAMERA_POS_STEP, cameraInc.y * CAMERA_POS_STEP, cameraInc.z * CAMERA_POS_STEP);
// Check if there has been a collision. If true, set the y position to
// the maximum height
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
}
// Update directional light direction, intensity and colour
SceneLight sceneLight = scene.getSceneLight();
DirectionalLight directionalLight = sceneLight.getDirectionalLight();
double angRad = Math.toRadians(lightAngle);
directionalLight.getDirection().x = (float) Math.sin(angRad);
directionalLight.getDirection().y = (float) Math.cos(angRad);
}
代码示例来源:origin: lwjglgamedev/lwjglbook
@Override
public void update(float interval, MouseInput mouseInput) {
// Update camera based on mouse
if (mouseInput.isRightButtonPressed()) {
Vector2f rotVec = mouseInput.getDisplVec();
camera.moveRotation(rotVec.x * MOUSE_SENSITIVITY, rotVec.y * MOUSE_SENSITIVITY, 0);
}
// Update camera position
Vector3f prevPos = new Vector3f(camera.getPosition());
camera.movePosition(cameraInc.x * CAMERA_POS_STEP, cameraInc.y * CAMERA_POS_STEP, cameraInc.z * CAMERA_POS_STEP);
// Check if there has been a collision. If true, set the y position to
// the maximum height
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
}
lightAngle += angleInc;
if (lightAngle < 0) {
lightAngle = 0;
} else if (lightAngle > 180) {
lightAngle = 180;
}
float zValue = (float) Math.cos(Math.toRadians(lightAngle));
float yValue = (float) Math.sin(Math.toRadians(lightAngle));
Vector3f lightDirection = this.scene.getSceneLight().getDirectionalLight().getDirection();
lightDirection.x = 0;
lightDirection.y = yValue;
lightDirection.z = zValue;
lightDirection.normalize();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain != null ? terrain.getHeight(camera.getPosition()) : -Float.MAX_VALUE;
if (camera.getPosition().y <= height) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain.getHeight(camera.getPosition());
if ( camera.getPosition().y <= height ) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
代码示例来源:origin: lwjglgamedev/lwjglbook
float height = terrain.getHeight(camera.getPosition());
if ( camera.getPosition().y <= height ) {
camera.setPosition(prevPos.x, prevPos.y, prevPos.z);
内容来源于网络,如有侵权,请联系作者删除!