just some rendering "improvements"

pull/7/head
hYdos 2020-02-25 19:58:07 +10:00
parent 4ef88b50cd
commit 47e44d2d91
4 changed files with 7 additions and 17 deletions

View File

@ -29,13 +29,13 @@ public class Litecraft extends Game
public Litecraft()
{
Constants.movementSpeed = 0.00005f;
Constants.turnSpeed = 0.00002f;
Constants.turnSpeed = 0.00006f;
Constants.gravity = -0.0000000005f;
Constants.jumpPower = 0.00005f;
Window.create(1200, 800, "LiteCraft", 60);
GingerUtils.init();
Window.setBackgroundColour(0.2f, 0.2f, 0.8f);
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/dirt.png");
Window.setBackgroundColour(0.2f, 0.2f, 0.6f);
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/gravel.png");
StaticCube.scaleCube(1);
Player player = new Player(dirtModel, new Vector3f(0, 0, -3), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f));
Camera camera = new Camera(new Vector3f(0, 0.1f, 0), player);

View File

@ -25,7 +25,7 @@ public class Player extends RenderObject
{
this.currentSpeed = Constants.movementSpeed;
}
else if (Window.isKeyPressed(GLFW.GLFW_KEY_S))
else if (Window.isKeyDown(GLFW.GLFW_KEY_S))
{
this.currentSpeed = -Constants.movementSpeed;
}
@ -39,8 +39,6 @@ public class Player extends RenderObject
}
else if (Window.isKeyDown(GLFW.GLFW_KEY_D))
{ this.currentTurn = -Constants.turnSpeed; }
if (!Window.isKeyDown(68) || !Window.isKeyDown(65))
{ this.currentTurn = 0; }
if (Window.isKeyDown(GLFW.GLFW_KEY_SPACE))
{
jump();

View File

@ -116,12 +116,6 @@ public class Window
public static boolean isKeyDown(int keycode)
{ return GLFW.glfwGetKey(window, keycode) == 1; }
public static boolean isKeyPressed(int keyCode)
{ return isKeyDown(keyCode) && !keys[keyCode]; }
public static boolean isKeyReleased(int keyCode)
{ return !isKeyDown(keyCode) && keys[keyCode]; }
public static boolean isMouseDown(int mouseButton)
{ return GLFW.glfwGetMouseButton(window, mouseButton) == 1; }

View File

@ -20,8 +20,8 @@ const vec4 plane = vec4(0, -1, 0, 15);
uniform float useFakeLighting;
const float density = 0.01;
const float gradient = 5.0;
const float density = 0.025;
const float gradient = 3.0;
void main(void){
@ -35,9 +35,7 @@ void main(void){
pass_textureCoords = textureCoords;
vec3 actualNormal = normal;
if(useFakeLighting > 0.5){
actualNormal = vec3(0.0, 1.0, 0.0);
}
actualNormal = vec3(0.0, 1.0, 0.0);
surfaceNormal = (transformationMatrix * vec4(actualNormal, 0.0)).xyz;
for(int i=0;i<5;i++){