mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
added support for SubBlockRotation reading wip1
This commit is contained in:
parent
1fc93f067c
commit
1ad4e19e02
18
src/main/java/de/bixilon/minosoft/render/Face/Axis.java
Normal file
18
src/main/java/de/bixilon/minosoft/render/Face/Axis.java
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.Face;
|
||||
|
||||
public enum Axis {
|
||||
X, Y, Z
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.fullFace;
|
||||
package de.bixilon.minosoft.render.Face;
|
||||
|
||||
public enum FaceOrientation {
|
||||
EAST(0), WEST(1), UP(2), DOWN(3), SOUTH(4), NORTH(5);
|
@ -11,13 +11,13 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.fullFace;
|
||||
package de.bixilon.minosoft.render.Face;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.world.BlockPosition;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.collections.primitives.ArrayFloatList;
|
||||
|
||||
import static de.bixilon.minosoft.render.fullFace.RenderConstants.UV;
|
||||
import static de.bixilon.minosoft.render.Face.RenderConstants.UV;
|
||||
|
||||
public class FullFacePosition {
|
||||
private final BlockPosition blockPosition;
|
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.fullFace;
|
||||
package de.bixilon.minosoft.render.Face;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
|
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.fullFace;
|
||||
package de.bixilon.minosoft.render.Face;
|
||||
|
||||
public class RenderConstants {
|
||||
public static final int texturePackRes = 16;
|
@ -17,15 +17,15 @@ import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Blocks;
|
||||
import de.bixilon.minosoft.game.datatypes.world.*;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.render.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.blockModels.BlockModelLoader;
|
||||
import de.bixilon.minosoft.render.blockModels.Face;
|
||||
import de.bixilon.minosoft.render.fullFace.FaceOrientation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.bixilon.minosoft.render.fullFace.RenderConstants.faceDir;
|
||||
import static de.bixilon.minosoft.render.Face.RenderConstants.faceDir;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class WorldRenderer {
|
||||
|
@ -17,7 +17,8 @@ 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.render.fullFace.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlock;
|
||||
import de.bixilon.minosoft.render.texture.TextureLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -19,7 +19,7 @@ import de.bixilon.minosoft.Config;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Blocks;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.render.fullFace.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.texture.TextureLoader;
|
||||
import org.apache.commons.collections.primitives.ArrayFloatList;
|
||||
|
||||
|
@ -14,13 +14,14 @@
|
||||
package de.bixilon.minosoft.render.blockModels;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.world.BlockPosition;
|
||||
import de.bixilon.minosoft.render.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.Face.InFaceUV;
|
||||
import de.bixilon.minosoft.render.MainWindow;
|
||||
import de.bixilon.minosoft.render.fullFace.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.fullFace.InFaceUV;
|
||||
import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlock;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import static de.bixilon.minosoft.render.fullFace.RenderConstants.blockRes;
|
||||
import static de.bixilon.minosoft.render.fullFace.RenderConstants.texturePackRes;
|
||||
import static de.bixilon.minosoft.render.Face.RenderConstants.blockRes;
|
||||
import static de.bixilon.minosoft.render.Face.RenderConstants.texturePackRes;
|
||||
import static org.lwjgl.opengl.GL11.glTexCoord2f;
|
||||
import static org.lwjgl.opengl.GL11.glVertex3f;
|
||||
|
||||
|
@ -11,11 +11,12 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.blockModels;
|
||||
package de.bixilon.minosoft.render.blockModels.subBlocks;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.bixilon.minosoft.render.fullFace.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.fullFace.InFaceUV;
|
||||
import de.bixilon.minosoft.render.Face.FaceOrientation;
|
||||
import de.bixilon.minosoft.render.Face.InFaceUV;
|
||||
import de.bixilon.minosoft.render.blockModels.Face;
|
||||
import de.bixilon.minosoft.render.texture.TextureLoader;
|
||||
import javafx.util.Pair;
|
||||
|
||||
@ -24,6 +25,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class SubBlock {
|
||||
SubBlockRotation rotation;
|
||||
SubBlockPosition pos1; // the most negative Point of the SubBlock
|
||||
SubBlockPosition pos2; // the most positive Point of the SubBlock
|
||||
|
||||
@ -49,6 +51,9 @@ public class SubBlock {
|
||||
orientation, variables);
|
||||
}
|
||||
}
|
||||
if (json.has("rotation")) {
|
||||
rotation = new SubBlockRotation(json.get("rotation").getAsJsonObject());
|
||||
}
|
||||
isFull = (pos1.x == 0 && pos1.y == 0 && pos1.z == 0) && (pos2.x == 16 && pos2.y == 16 && pos2.z == 16);
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
@ -11,22 +11,16 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.render.blockModels;
|
||||
package de.bixilon.minosoft.render.blockModels.subBlocks;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
|
||||
public class SubBlockPosition {
|
||||
int x, y, z;
|
||||
|
||||
public SubBlockPosition(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
float x, y, z;
|
||||
|
||||
public SubBlockPosition(JsonArray json) {
|
||||
x = json.get(0).getAsInt();
|
||||
y = json.get(1).getAsInt();
|
||||
z = json.get(2).getAsInt();
|
||||
x = json.get(0).getAsFloat();
|
||||
y = json.get(1).getAsFloat();
|
||||
z = json.get(2).getAsFloat();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.blockModels.subBlocks;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.bixilon.minosoft.render.Face.Axis;
|
||||
|
||||
public class SubBlockRotation {
|
||||
SubBlockPosition origin;
|
||||
Axis direction;
|
||||
float angle;
|
||||
|
||||
public SubBlockRotation(JsonObject rotation) {
|
||||
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;
|
||||
}
|
||||
angle = rotation.get("angle").getAsFloat();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -26,7 +26,7 @@ public class PlayerController {
|
||||
private final float playerWidth = 0.5f;
|
||||
CameraMovement cameraMovement;
|
||||
PlayerMovement playerMovement;
|
||||
Vec3 playerPos = new Vec3(0, 1, 0); // the feet position of the player
|
||||
Vec3 playerPos = new Vec3(); // the feet position of the player
|
||||
Vec3 playerVelocity = new Vec3();
|
||||
float gravity = 9.81f;
|
||||
boolean onGround;
|
||||
|
Loading…
x
Reference in New Issue
Block a user