Skip to content

Commit 4f8afab

Browse files
committed
nna
1 parent ceff8fa commit 4f8afab

File tree

27 files changed

+75
-1845
lines changed

27 files changed

+75
-1845
lines changed

common/src/main/java/dev/felnull/otyacraftengine/client/OtyacraftEngineClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import dev.felnull.otyacraftengine.client.gui.screen.debug.RenderTestScreen;
66
import dev.felnull.otyacraftengine.client.handler.ClientHandler;
77
import dev.felnull.otyacraftengine.client.handler.TestClientHandler;
8-
import dev.felnull.otyacraftengine.client.model.TestModel;
98
import dev.felnull.otyacraftengine.client.renderer.blockentity.TestRenderer;
109
import dev.felnull.otyacraftengine.client.renderer.item.TestItemRenderer;
1110
import dev.felnull.otyacraftengine.client.util.ClientUtilInit;
@@ -29,6 +28,5 @@ public static void testInit() {
2928
TestItemRenderer.init();
3029
TestBEScreen.fInit();
3130
RenderTestScreen.fInit();
32-
TestModel.init();
3331
}
3432
}

common/src/main/java/dev/felnull/otyacraftengine/client/gui/screen/debug/RenderTestScreen.java

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package dev.felnull.otyacraftengine.client.gui.screen.debug;
22

33
import com.mojang.blaze3d.vertex.PoseStack;
4+
import com.mojang.math.Vector3f;
45
import dev.felnull.otyacraftengine.OtyacraftEngine;
56
import dev.felnull.otyacraftengine.client.gui.screen.OEBaseScreen;
67
import dev.felnull.otyacraftengine.client.gui.screen.debug.rendertest.BakedModelRenderTest;
78
import dev.felnull.otyacraftengine.client.gui.screen.debug.rendertest.IRenderTest;
89
import dev.felnull.otyacraftengine.client.gui.screen.debug.rendertest.ItemRenderTest;
10+
import dev.felnull.otyacraftengine.client.util.OEClientUtil;
911
import dev.felnull.otyacraftengine.client.util.OERenderUtil;
1012
import net.minecraft.client.gui.components.Button;
1113
import net.minecraft.client.gui.components.EditBox;
@@ -30,6 +32,8 @@ public class RenderTestScreen extends OEBaseScreen {
3032
private int sampleCount;
3133
private int testCount = 1;
3234
private Motion motion = Motion.FIX;
35+
private Vector3f cameraPos = new Vector3f(0, 0, 1);
36+
private Vector3f cameraRot = new Vector3f();
3337

3438
private EditBox countBox;
3539

@@ -128,6 +132,46 @@ public void render(@NotNull PoseStack poseStack, int mx, int my, float f) {
128132
lastTime = System.nanoTime();
129133
}
130134

135+
@Override
136+
public void tick() {
137+
super.tick();
138+
if (motion == Motion.FREE_LOOK) {
139+
float speed = 1;
140+
if (OEClientUtil.isKeyInput(mc.options.keyUp)) {
141+
cameraPos.add(0, -speed, 0);
142+
}
143+
if (OEClientUtil.isKeyInput(mc.options.keyDown)) {
144+
cameraPos.add(0, speed, 0);
145+
}
146+
if (OEClientUtil.isKeyInput(mc.options.keyRight)) {
147+
cameraPos.add(speed, 0, 0);
148+
}
149+
if (OEClientUtil.isKeyInput(mc.options.keyLeft)) {
150+
cameraPos.add(-speed, 0, 0);
151+
}
152+
if (OEClientUtil.isKeyInput(mc.options.keySprint)) {
153+
cameraPos = new Vector3f(0, 0, 1);
154+
cameraRot = new Vector3f();
155+
}
156+
}
157+
}
158+
159+
@Override
160+
public boolean mouseDragged(double d, double e, int i, double f, double g) {
161+
if (motion == Motion.FREE_LOOK)
162+
cameraRot.add(-(float) g, (float) f, 0);
163+
return super.mouseDragged(d, e, i, f, g);
164+
}
165+
166+
@Override
167+
public boolean mouseScrolled(double d, double e, double f) {
168+
if (motion == Motion.FREE_LOOK) {
169+
cameraPos.add(0, 0, (float) f * (OEClientUtil.isKeyInput(mc.options.keyShift) ? 0.5f : 1f));
170+
cameraPos.set(cameraPos.x(), cameraPos.y(), Math.max(cameraPos.z(), 1));
171+
}
172+
return super.mouseScrolled(d, e, f);
173+
}
174+
131175
private void reset() {
132176
eqAll = 0;
133177
sampleCount = 0;
@@ -140,14 +184,27 @@ private void renderTest(@NotNull PoseStack poseStack, @NotNull MultiBufferSource
140184

141185
poseStack.pushPose();
142186

143-
144187
if (motion != Motion.TRANSLATED && motion != Motion.ROTED && motion != Motion.BOTH) {
145188
double x = width / 2f;
146189
double y = sy / 2f;
190+
191+
if (motion == Motion.FREE_LOOK) {
192+
x += cameraPos.x() * cameraPos.z();
193+
y += cameraPos.y() * cameraPos.z();
194+
195+
196+
poseStack.translate(x, y, 30);
197+
OERenderUtil.poseRotateAll(poseStack, cameraRot.x(), cameraRot.y(), cameraRot.z());
198+
poseStack.translate(-x, -y, -30);
199+
}
200+
147201
poseStack.translate(x, y, 1050.0D);
148202
poseStack.scale(1, 1, -1);
149203
poseStack.translate(0.0D, 0.0D, 1000);
150204
poseStack.scale((float) 30, (float) -30, (float) 30);
205+
206+
if (motion == Motion.FREE_LOOK)
207+
OERenderUtil.poseScaleAll(poseStack, cameraPos.z());
151208
}
152209

153210
for (int i = 0; i < count; i++) {
@@ -209,6 +266,6 @@ public static void fInit() {
209266
}
210267

211268
private static enum Motion {
212-
FIX, TRANSLATED, ROTED, BOTH;
269+
FIX, TRANSLATED, ROTED, BOTH, FREE_LOOK;
213270
}
214271
}

common/src/main/java/dev/felnull/otyacraftengine/client/model/OEModelLoader.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

common/src/main/java/dev/felnull/otyacraftengine/client/model/Raw3dModel.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

common/src/main/java/dev/felnull/otyacraftengine/client/model/TestModel.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

common/src/main/java/dev/felnull/otyacraftengine/client/model/obj/OEMtl.java

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)