mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
code cleanup
This commit is contained in:
parent
aa6ec55792
commit
4feb25621c
@ -30,7 +30,7 @@ public class GameWindow {
|
||||
private static Connection connection;
|
||||
private static PlayerController playerController;
|
||||
|
||||
static boolean running = false;
|
||||
private static boolean running = false;
|
||||
public static boolean paused = false;
|
||||
|
||||
public static void prepare() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -28,7 +28,7 @@ import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
public class OpenGLWindow {
|
||||
private final boolean fullscreen;
|
||||
long window;
|
||||
private long window;
|
||||
private int width, height;
|
||||
private double mouseX;
|
||||
private double mouseY;
|
||||
|
@ -32,7 +32,7 @@ public class WorldRenderer {
|
||||
private BlockModelLoader modelLoader;
|
||||
|
||||
private LinkedBlockingQueue<Pair<ChunkLocation, Chunk>> queuedChunks;
|
||||
Thread chunkLoadThread;
|
||||
private Thread chunkLoadThread;
|
||||
|
||||
public WorldRenderer() {
|
||||
faces = new HashMap<>();
|
||||
|
@ -23,9 +23,8 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class BlockConfiguration {
|
||||
BlockRotations rotation;
|
||||
HashSet<BlockProperties> blockProperties;
|
||||
|
||||
private BlockRotations rotation;
|
||||
private HashSet<BlockProperties> blockProperties;
|
||||
|
||||
public BlockConfiguration(JsonObject json) {
|
||||
if (json.has("facing")) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
|
@ -33,7 +33,7 @@ import static de.bixilon.minosoft.util.Util.readJsonAsset;
|
||||
|
||||
public class BlockModelLoader {
|
||||
private final HashMap<String, HashMap<String, BlockModelInterface>> blockDescriptionMap;
|
||||
TextureLoader textureLoader;
|
||||
private TextureLoader textureLoader;
|
||||
|
||||
public BlockModelLoader() {
|
||||
blockDescriptionMap = new HashMap<>();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -18,9 +18,9 @@ import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlockPosition;
|
||||
import de.bixilon.minosoft.render.texture.InFaceUV;
|
||||
|
||||
public class Face {
|
||||
final SubBlockPosition[] positions;
|
||||
int rotation;
|
||||
InFaceUV uv;
|
||||
private final SubBlockPosition[] positions;
|
||||
private int rotation;
|
||||
private InFaceUV uv;
|
||||
|
||||
public Face(float texture, InFaceUV uv, SubBlockPosition[] facePositions) {
|
||||
this(texture, uv, facePositions, 0);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,12 +13,9 @@
|
||||
|
||||
package de.bixilon.minosoft.render.blockModels.specialModels;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.bixilon.minosoft.Config;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.BlockRotations;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.render.blockModels.BlockConfiguration;
|
||||
import de.bixilon.minosoft.render.blockModels.BlockConfigurationTrue;
|
||||
@ -28,16 +25,13 @@ import de.bixilon.minosoft.render.blockModels.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlock;
|
||||
import de.bixilon.minosoft.render.texture.TextureLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.bixilon.minosoft.util.Util.readJsonFromFile;
|
||||
|
||||
public class BlockModel implements BlockModelInterface {
|
||||
HashMap<BlockConfiguration, HashSet<SubBlock>> blockConfigurationStates;
|
||||
boolean isFull;
|
||||
private final HashMap<BlockConfiguration, HashSet<SubBlock>> blockConfigurationStates;
|
||||
private final boolean isFull;
|
||||
|
||||
public BlockModel(JsonObject block, String mod) {
|
||||
blockConfigurationStates = new HashMap<>();
|
||||
@ -57,10 +51,6 @@ public class BlockModel implements BlockModelInterface {
|
||||
isFull = true;
|
||||
}
|
||||
|
||||
public BlockModel() {
|
||||
}
|
||||
|
||||
|
||||
public static HashSet<Face> prepareBlockState(HashSet<SubBlock> subBlocks,
|
||||
HashMap<FaceOrientation, Boolean> adjacentBlocks, Block block) {
|
||||
HashSet<Face> result = new HashSet<>();
|
||||
|
@ -29,7 +29,7 @@ import java.util.HashSet;
|
||||
import static de.bixilon.minosoft.render.blockModels.specialModels.BlockModel.*;
|
||||
|
||||
public class CropModel implements BlockModelInterface {
|
||||
HashMap<String, HashSet<SubBlock>> modelMap;
|
||||
private final HashMap<String, HashSet<SubBlock>> modelMap;
|
||||
|
||||
public CropModel(JsonObject block, String mod) {
|
||||
int stages = block.get("stages").getAsInt();
|
||||
|
@ -30,11 +30,11 @@ import java.util.HashSet;
|
||||
import static de.bixilon.minosoft.render.blockModels.specialModels.BlockModel.*;
|
||||
|
||||
public class DoorModel implements BlockModelInterface {
|
||||
HashSet<SubBlock> bottom;
|
||||
HashSet<SubBlock> bottom_hinge;
|
||||
private final HashSet<SubBlock> bottom;
|
||||
private final HashSet<SubBlock> bottom_hinge;
|
||||
|
||||
HashSet<SubBlock> top;
|
||||
HashSet<SubBlock> top_hinge;
|
||||
private final HashSet<SubBlock> top;
|
||||
private final HashSet<SubBlock> top_hinge;
|
||||
|
||||
public DoorModel(JsonObject block, String mod) {
|
||||
bottom = BlockModelInterface.load(mod, block.get("bottom").getAsString());
|
||||
|
@ -27,10 +27,9 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class FireModel implements BlockModelInterface {
|
||||
HashSet<SubBlock> floor;
|
||||
HashSet<SubBlock> side;
|
||||
HashSet<SubBlock> up;
|
||||
|
||||
private final HashSet<SubBlock> floor;
|
||||
private final HashSet<SubBlock> side;
|
||||
private final HashSet<SubBlock> up;
|
||||
|
||||
public FireModel(JsonObject block, String mod) {
|
||||
floor = BlockModelInterface.load(mod, block.get("floor").getAsString());
|
||||
|
@ -27,9 +27,9 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class StairsModel implements BlockModelInterface {
|
||||
HashSet<SubBlock> straight;
|
||||
HashSet<SubBlock> inner;
|
||||
HashSet<SubBlock> outer;
|
||||
private final HashSet<SubBlock> straight;
|
||||
private final HashSet<SubBlock> inner;
|
||||
private final HashSet<SubBlock> outer;
|
||||
|
||||
public StairsModel(JsonObject block, String mod) {
|
||||
straight = BlockModelInterface.load(mod, block.get("straight").getAsString());
|
||||
|
@ -32,7 +32,7 @@ public class Cuboid {
|
||||
FaceOrientation.NORTH, new int[]{5, 4, 0, 1}
|
||||
);
|
||||
|
||||
HashMap<FaceOrientation, SubBlockPosition[]> facePositionMap;
|
||||
private final HashMap<FaceOrientation, SubBlockPosition[]> facePositionMap;
|
||||
|
||||
public Cuboid(SubBlockPosition from, SubBlockPosition to, SubBlockRotation rotation) {
|
||||
SubBlockPosition[] positions = new SubBlockPosition[8];
|
||||
|
@ -25,16 +25,16 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class SubBlock {
|
||||
SubBlockRotation rotation;
|
||||
private SubBlockRotation rotation;
|
||||
|
||||
HashMap<FaceOrientation, Float> textureCoordinates;
|
||||
HashMap<FaceOrientation, String> textures;
|
||||
HashMap<FaceOrientation, Integer> textureRotations;
|
||||
HashMap<FaceOrientation, Boolean> cullFaceTextures;
|
||||
private final HashMap<FaceOrientation, Float> textureCoordinates;
|
||||
private final HashMap<FaceOrientation, String> textures;
|
||||
private final HashMap<FaceOrientation, Integer> textureRotations;
|
||||
private final HashMap<FaceOrientation, Boolean> cullFaceTextures;
|
||||
|
||||
HashMap<FaceOrientation, InFaceUV> uv;
|
||||
private final HashMap<FaceOrientation, InFaceUV> uv;
|
||||
|
||||
Cuboid cuboid;
|
||||
private final Cuboid cuboid;
|
||||
|
||||
private final boolean isFull;
|
||||
|
||||
|
@ -22,20 +22,22 @@ import static de.bixilon.minosoft.render.blockModels.Face.RenderConstants.blockR
|
||||
import static org.lwjgl.opengl.GL11.glVertex3f;
|
||||
|
||||
public class SubBlockPosition {
|
||||
float x, y, z;
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public static final SubBlockPosition middlePos = new SubBlockPosition(8, 8, 8);
|
||||
private static final SubBlockPosition middlePos = new SubBlockPosition(8, 8, 8);
|
||||
|
||||
public static final SubBlockRotation westRotator = new SubBlockRotation(middlePos, Axis.Y, 90);
|
||||
public static final SubBlockRotation eastRotator = new SubBlockRotation(middlePos, Axis.Y, 270);
|
||||
public static final SubBlockRotation southRotator = new SubBlockRotation(middlePos, Axis.Y, 180);
|
||||
private static final SubBlockRotation westRotator = new SubBlockRotation(middlePos, Axis.Y, 90);
|
||||
private static final SubBlockRotation eastRotator = new SubBlockRotation(middlePos, Axis.Y, 270);
|
||||
private static final SubBlockRotation southRotator = new SubBlockRotation(middlePos, Axis.Y, 180);
|
||||
|
||||
public static final SubBlockRotation xAxisRotator = new SubBlockRotation(middlePos, Axis.Z, 90);
|
||||
public static final SubBlockRotation zAxisRotator = new SubBlockRotation(middlePos, Axis.X, 90);
|
||||
private static final SubBlockRotation xAxisRotator = new SubBlockRotation(middlePos, Axis.Z, 90);
|
||||
private static final SubBlockRotation zAxisRotator = new SubBlockRotation(middlePos, Axis.X, 90);
|
||||
|
||||
public static final SubBlockRotation downRotator = new SubBlockRotation(middlePos, Axis.X, 90);
|
||||
public static final SubBlockRotation downAltRotator = new SubBlockRotation(middlePos, Axis.X, 180);
|
||||
public static final SubBlockRotation upRotator = new SubBlockRotation(middlePos, Axis.X, -90);
|
||||
private static final SubBlockRotation downRotator = new SubBlockRotation(middlePos, Axis.X, 90);
|
||||
private static final SubBlockRotation downAltRotator = new SubBlockRotation(middlePos, Axis.X, 180);
|
||||
private static final SubBlockRotation upRotator = new SubBlockRotation(middlePos, Axis.X, -90);
|
||||
|
||||
|
||||
public SubBlockPosition(JsonArray json) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -21,9 +21,9 @@ import static java.lang.StrictMath.cos;
|
||||
import static java.lang.StrictMath.sin;
|
||||
|
||||
public class SubBlockRotation {
|
||||
SubBlockPosition origin;
|
||||
Axis direction;
|
||||
float angle;
|
||||
private final SubBlockPosition origin;
|
||||
private Axis direction;
|
||||
private final float angle;
|
||||
|
||||
public SubBlockRotation(SubBlockPosition origin, Axis direction, float angle) {
|
||||
this.origin = origin;
|
||||
@ -35,15 +35,9 @@ public class SubBlockRotation {
|
||||
origin = new SubBlockPosition(rotation.get("origin").getAsJsonArray());
|
||||
String axis = rotation.get("axis").getAsString();
|
||||
switch (axis) {
|
||||
case "x":
|
||||
direction = Axis.X;
|
||||
break;
|
||||
case "y":
|
||||
direction = Axis.Y;
|
||||
break;
|
||||
case "z":
|
||||
direction = Axis.Z;
|
||||
break;
|
||||
case "x" -> direction = Axis.X;
|
||||
case "y" -> direction = Axis.Y;
|
||||
case "z" -> direction = Axis.Z;
|
||||
}
|
||||
angle = rotation.get("angle").getAsFloat();
|
||||
}
|
||||
@ -63,21 +57,21 @@ public class SubBlockRotation {
|
||||
SubBlockPosition transformed = SubBlockPosition.subtract(position, origin);
|
||||
Pair<Float, Float> rotated;
|
||||
switch (direction) {
|
||||
case X:
|
||||
case X -> {
|
||||
rotated = rotate(transformed.y, transformed.z, angle);
|
||||
transformed.y = rotated.getKey();
|
||||
transformed.z = rotated.getValue();
|
||||
break;
|
||||
case Y:
|
||||
}
|
||||
case Y -> {
|
||||
rotated = rotate(transformed.x, transformed.z, angle);
|
||||
transformed.x = rotated.getKey();
|
||||
transformed.z = rotated.getValue();
|
||||
break;
|
||||
case Z:
|
||||
}
|
||||
case Z -> {
|
||||
rotated = rotate(transformed.x, transformed.y, angle);
|
||||
transformed.x = rotated.getKey();
|
||||
transformed.y = rotated.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SubBlockPosition.add(transformed, origin);
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ import static java.lang.StrictMath.*;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
|
||||
public class CameraMovement {
|
||||
Vec3 cameraFront = new Vec3(0.0f, 0.0f, -1.0f);
|
||||
private static final float sensitivity = 0.1f;
|
||||
private Vec3 cameraFront = new Vec3(0.0f, 0.0f, -1.0f);
|
||||
|
||||
private boolean firstMouse = false;
|
||||
private float lastX;
|
||||
@ -30,11 +31,11 @@ public class CameraMovement {
|
||||
private float pitch;
|
||||
|
||||
public void mouseCallback(long l, double xPos, double yPos) {
|
||||
// variable l is unused but always given by openGL so it is needed in the method signature
|
||||
if (GameWindow.paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
// variable l is unused but always given by openGL so we need it in the method signature
|
||||
if (firstMouse) {
|
||||
lastX = (float) xPos;
|
||||
lastY = (float) yPos;
|
||||
@ -46,18 +47,18 @@ public class CameraMovement {
|
||||
lastX = (float) xPos;
|
||||
lastY = (float) yPos;
|
||||
|
||||
float sensitivity = 0.1f; // change this value to your liking
|
||||
xoffset *= sensitivity;
|
||||
yoffset *= sensitivity;
|
||||
|
||||
yaw += xoffset;
|
||||
pitch += yoffset;
|
||||
|
||||
// make sure that pitch does not get out of bounds
|
||||
if (pitch > 89.0f)
|
||||
if (pitch > 89.0f) {
|
||||
pitch = 89.0f;
|
||||
if (pitch < -89.0f)
|
||||
}
|
||||
if (pitch < -89.0f) {
|
||||
pitch = -89.0f;
|
||||
}
|
||||
|
||||
Vec3 front = new Vec3();
|
||||
front.x = (float) -(sin(toRadians(yaw)) * cos(toRadians(pitch)));
|
||||
|
@ -23,9 +23,9 @@ import static de.bixilon.minosoft.render.utility.AdditionalMath.betterRound;
|
||||
import static de.bixilon.minosoft.render.utility.AdditionalMath.valuesBetween;
|
||||
|
||||
public class CollisionHandler {
|
||||
World world;
|
||||
PlayerController controller;
|
||||
BlockModelLoader modelLoader;
|
||||
private final World world;
|
||||
private final PlayerController controller;
|
||||
private final BlockModelLoader modelLoader;
|
||||
|
||||
public CollisionHandler(PlayerController controller) {
|
||||
world = GameWindow.getConnection().getPlayer().getWorld();
|
||||
@ -35,7 +35,7 @@ public class CollisionHandler {
|
||||
|
||||
public void handleCollisions() {
|
||||
if (isPositionValid(controller.playerPos)) {
|
||||
// we aren't collided with anything so the player Position does not have to be adjusted
|
||||
// the player currently isn't colliding with with anything so the player Position does not have to be adjusted
|
||||
return;
|
||||
}
|
||||
xAxisCollision();
|
||||
@ -73,7 +73,7 @@ public class CollisionHandler {
|
||||
controller.playerVelocity.y = 0;
|
||||
|
||||
if (deltaY < 0) {
|
||||
controller.onGround = true;
|
||||
controller.setOnGround(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,14 +22,15 @@ import static de.bixilon.minosoft.render.utility.Vec3.mul;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
|
||||
public class PlayerController {
|
||||
private final float playerHeight = 1.8f;
|
||||
private final float playerWidth = 0.25f;
|
||||
private static final float playerHeight = 1.8f;
|
||||
private static final float playerWidth = 0.25f;
|
||||
private static final float gravity = 13;
|
||||
|
||||
CameraMovement cameraMovement;
|
||||
PlayerMovement playerMovement;
|
||||
Vec3 playerPos = new Vec3(); // the feet position of the player
|
||||
Vec3 playerVelocity = new Vec3();
|
||||
float gravity = 9.81f;
|
||||
boolean onGround;
|
||||
private boolean onGround;
|
||||
private boolean enableGravity;
|
||||
private CollisionHandler collisionHandler;
|
||||
public Vec3 oldPos;
|
||||
@ -121,4 +122,8 @@ public class PlayerController {
|
||||
public float getPlayerHeight() {
|
||||
return playerHeight;
|
||||
}
|
||||
|
||||
public void setOnGround(boolean onGround) {
|
||||
this.onGround = onGround;
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,6 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A simple camera controller to fly around the scene
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.movement;
|
||||
|
||||
import de.bixilon.minosoft.render.GameWindow;
|
||||
@ -25,20 +21,19 @@ import static de.bixilon.minosoft.render.utility.Vec3.mul;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
public class PlayerMovement {
|
||||
private static final float FLY_SPEED = 0.1f;
|
||||
private static final Vec3 CAMERA_UP = new Vec3(0f, 1f, 0f);
|
||||
|
||||
private final long window;
|
||||
Vec3 cameraFront;
|
||||
Vec3 cameraUp = new Vec3(0f, 1f, 0f);
|
||||
|
||||
float flySpeed = 0.1f;
|
||||
|
||||
Vec3 playerPos;
|
||||
private Vec3 cameraFront;
|
||||
private Vec3 playerPos;
|
||||
|
||||
public PlayerMovement(long window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
private void processInput(float deltaTime) {
|
||||
float cameraSpeed = flySpeed / deltaTime;
|
||||
float cameraSpeed = FLY_SPEED / deltaTime;
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) {
|
||||
playerPos.add(mul(cameraFront, -cameraSpeed * deltaTime));
|
||||
@ -47,10 +42,10 @@ public class PlayerMovement {
|
||||
playerPos.add(mul(cameraFront, cameraSpeed * deltaTime));
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) {
|
||||
playerPos.add(mul(cross(cameraUp, cameraFront), -cameraSpeed * deltaTime));
|
||||
playerPos.add(mul(cross(CAMERA_UP, cameraFront), -cameraSpeed * deltaTime));
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) {
|
||||
playerPos.add(mul(cross(cameraUp, cameraFront), cameraSpeed * deltaTime));
|
||||
playerPos.add(mul(cross(CAMERA_UP, cameraFront), cameraSpeed * deltaTime));
|
||||
}
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -20,7 +20,7 @@ import static de.bixilon.minosoft.render.blockModels.Face.RenderConstants.textur
|
||||
import static org.lwjgl.opengl.GL11.glTexCoord2f;
|
||||
|
||||
public class InFaceUV {
|
||||
public int u1, v1, u2, v2;
|
||||
public final int u1, v1, u2, v2;
|
||||
|
||||
public float realU1, realV1, realU2, realV2;
|
||||
|
||||
|
@ -33,10 +33,10 @@ import static org.lwjgl.opengl.GL30.glGenerateMipmap;
|
||||
|
||||
public class TextureLoader {
|
||||
private final HashMap<String, HashMap<String, Integer>> textureCoordinates;
|
||||
int textureID;
|
||||
float step;
|
||||
int totalTextures = 0;
|
||||
HashMap<String, HashMap<String, BufferedImage>> images;
|
||||
private int textureID;
|
||||
private float step;
|
||||
private int totalTextures = 0;
|
||||
private HashMap<String, HashMap<String, BufferedImage>> images;
|
||||
|
||||
public TextureLoader(HashMap<String, HashSet<String>> textures, HashMap<String, HashMap<String, float[]>> tints) {
|
||||
textureCoordinates = new HashMap<>();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -39,8 +39,4 @@ public class AdditionalMath {
|
||||
}
|
||||
return (int) x - 1;
|
||||
}
|
||||
|
||||
public static boolean isBetween(double x, double a, double b) {
|
||||
return x <= a && x >= b || x >= a && x <= b;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.utility;
|
||||
|
||||
public class Triplet<T, T1, T2> {
|
||||
public T item1;
|
||||
public T1 item2;
|
||||
public T2 item3;
|
||||
|
||||
public Triplet(T item1, T1 item2, T2 item3) {
|
||||
this.item1 = item1;
|
||||
this.item2 = item2;
|
||||
this.item3 = item3;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020 Lukas Eisenhauer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user