From e541500e9afad8a0fb0c8c3ac3eb197444505bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Podgajny?= Date: Sun, 8 Jan 2023 14:20:57 +0100 Subject: [PATCH] Change platform --- .../com/example/rayx/Model/Raycasting/Quality.java | 4 ++-- .../Raycasting/Analyse/RenderSteps/Ray.java | 13 +------------ .../Raycasting/Analyse/RenderSteps/Sight.java | 8 ++++---- .../Raycasting/PreBaking/Math/Functions.java | 3 ++- .../rayx/Model/Raycasting/RenderProcedure.java | 3 --- src/main/java/com/example/rayx/View/ByteMatrix.java | 4 ++-- .../BasicElements/PixelSet/ColumnPixel.java | 13 ++++++++----- .../example/rayx/View/UI/Components/StatusBar.java | 3 +-- .../java/com/example/rayx/View/UI/RenderScene.java | 2 +- 9 files changed, 21 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/example/rayx/Model/Raycasting/Quality.java b/src/main/java/com/example/rayx/Model/Raycasting/Quality.java index 2509188..3cefb69 100644 --- a/src/main/java/com/example/rayx/Model/Raycasting/Quality.java +++ b/src/main/java/com/example/rayx/Model/Raycasting/Quality.java @@ -6,8 +6,8 @@ public final class Quality { - public static final int SCREEN_STEP_STAND =3; - public static final int SCREEN_STEP_WALK = 4; + public static final int SCREEN_STEP_STAND =4; + public static final int SCREEN_STEP_WALK = 5; public final static byte textureResolution = 64; public static int SCREEN_STEP; diff --git a/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Ray.java b/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Ray.java index 3deac92..acc5323 100644 --- a/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Ray.java +++ b/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Ray.java @@ -10,9 +10,6 @@ import com.example.rayx.View.Raycasting.UpperBlocks.Other.UpperBuildingBlocks; public final class Ray extends RenderStep{ - - - public static boolean renderFloor; public static boolean finish; @@ -31,26 +28,18 @@ public final class Ray extends RenderStep{ public static byte halfupx; public static boolean halfupper; - public static boolean spriterendered; - public static int lceili; - public static int spriteStableCounter; - public static boolean upperbuildingx; public static boolean lupperbuildingx; public static byte lhalfupx; - public static boolean upperbuildingXa; public static boolean upperXa; - public static byte uppershapeX; public static boolean luppershape; public static boolean luppershapeR; - public static boolean outside; - public static int floorDown; public static int lfloorDown; public static int maxY; @@ -136,7 +125,7 @@ public static void analyse(float fi){ InPoint.analyse(r); - if(Map.map[(int) PointOnRay.posX][(int) PointOnRay.posY] == 5 ){ + if(Map.map[(int) PointOnRay.posX][(int) PointOnRay.posY] == 5 ){ PreColumn.minY = RenderProcedure.cameraY - (int)( PreColumn.height); } diff --git a/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Sight.java b/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Sight.java index 8a00208..9b2031d 100644 --- a/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Sight.java +++ b/src/main/java/com/example/rayx/Model/Raycasting/Raycasting/Analyse/RenderSteps/Sight.java @@ -123,16 +123,16 @@ public static void analyse(){ RenderProcedure.canvasHeight = 300; if(Map.floorH[(int)RenderProcedure.pos.x][(int)RenderProcedure.pos.y] ==-1){ - RenderProcedure.cameraY = 260; + RenderProcedure.cameraY = 280; }else if(Map.floorH[(int)RenderProcedure.pos.x][(int)RenderProcedure.pos.y] ==1){ - RenderProcedure.canvasHeight = 340; - RenderProcedure.cameraY = 340; + RenderProcedure.canvasHeight = 330; + RenderProcedure.cameraY = 330; }else{ RenderProcedure.cameraY = 300; } - for(float fi = RenderProcedure.angle - RenderProcedure.pi/6 ;fi= 0 ? nval : 0; } public static float getSinDeltaX(int angle){ return sinDeltaX[(angle)]; diff --git a/src/main/java/com/example/rayx/Model/Raycasting/RenderProcedure.java b/src/main/java/com/example/rayx/Model/Raycasting/RenderProcedure.java index 9b60372..972c4dc 100644 --- a/src/main/java/com/example/rayx/Model/Raycasting/RenderProcedure.java +++ b/src/main/java/com/example/rayx/Model/Raycasting/RenderProcedure.java @@ -15,11 +15,8 @@ public final class RenderProcedure extends Render { public static int canvasHeight= 300; public final static byte distance =16; public final static int deltaPosMask = 0x3f; - - public static final float pi = (float) Math.PI; public static float realWidth; - public static RaycasterPoint pos = new RaycasterPoint(61.5f,64.5f); public static float angle = 0; diff --git a/src/main/java/com/example/rayx/View/ByteMatrix.java b/src/main/java/com/example/rayx/View/ByteMatrix.java index 0e96ce0..c0342d2 100644 --- a/src/main/java/com/example/rayx/View/ByteMatrix.java +++ b/src/main/java/com/example/rayx/View/ByteMatrix.java @@ -2,12 +2,12 @@ public class ByteMatrix { - public static int SCREEN_WIDTH = 640; + public static int SCREEN_WIDTH = 800; public static int SCREEN_HEIGHT = 600; public static final int pixelWidth = 4; public static final int shiftPixelWidth = 2; - public static final int maxLen = 768000 << shiftPixelWidth>>1; + public static final int maxLen = 960000 << shiftPixelWidth>>1; public static int lenScreen = (SCREEN_WIDTH*SCREEN_HEIGHT) << shiftPixelWidth; public static byte[] pixels = new byte[lenScreen]; diff --git a/src/main/java/com/example/rayx/View/Raycasting/BasicElements/PixelSet/ColumnPixel.java b/src/main/java/com/example/rayx/View/Raycasting/BasicElements/PixelSet/ColumnPixel.java index cb29c70..80acaf8 100644 --- a/src/main/java/com/example/rayx/View/Raycasting/BasicElements/PixelSet/ColumnPixel.java +++ b/src/main/java/com/example/rayx/View/Raycasting/BasicElements/PixelSet/ColumnPixel.java @@ -11,7 +11,7 @@ public final class ColumnPixel { - + final static int maxHeight = (int)(450*RenderProcedure.realWidth); public static void setPixelColumn(int pos, int column, int y, int shadow, Texture tex ){ if(pos>0 && pos < Render.maxLen) { @@ -53,13 +53,16 @@ public static void drawSmallColumn(int llminh,int llmaxh,boolean upperb,int shad final int floorY = (Ray.maxY)*(int)RenderProcedure.realWidth; for(int y=Column.posStart;y= minimal && y < maximal && y>=minimalY&& (y>maxY || y= minimal && y < maximal && y >= minimalY && (y > maxY || y < minY)) || upperb) { - final int acolumn = ((int) Column.dc & RenderProcedure.deltaPosMask); - setPixelColumn(y + Column.trnsx, acolumn, (int) texPos & 0x7f, shadow,tex); + final int acolumn = ((int) Column.dc & RenderProcedure.deltaPosMask); + setPixelColumn(y + Column.trnsx, acolumn, (int) texPos & 0x7f, shadow, tex); + } + }else{ + break; } - deltaP ++; if(deltaP >= deltaPos) { texPos+= deltaP / deltaPos; diff --git a/src/main/java/com/example/rayx/View/UI/Components/StatusBar.java b/src/main/java/com/example/rayx/View/UI/Components/StatusBar.java index 47b1459..f954919 100644 --- a/src/main/java/com/example/rayx/View/UI/Components/StatusBar.java +++ b/src/main/java/com/example/rayx/View/UI/Components/StatusBar.java @@ -1,7 +1,6 @@ package com.example.rayx.View.UI.Components; import com.example.rayx.View.Render; -import javafx.scene.image.ImageView; import javafx.scene.image.PixelWriter; import javafx.scene.image.WritableImage; import javafx.scene.image.WritablePixelFormat; @@ -61,7 +60,7 @@ private WritableImage generateImage(int width, int height, int red, int green, i public StatusBar(Stage stage) { super(stage); - this.setImage(img = generateImage(640,600,0,0,0)); + this.setImage(img = generateImage(800,600,0,0,0)); } } diff --git a/src/main/java/com/example/rayx/View/UI/RenderScene.java b/src/main/java/com/example/rayx/View/UI/RenderScene.java index 99c12b9..370222d 100644 --- a/src/main/java/com/example/rayx/View/UI/RenderScene.java +++ b/src/main/java/com/example/rayx/View/UI/RenderScene.java @@ -18,7 +18,7 @@ public class RenderScene extends Scene{ public RenderScene(Stage stage, Pane root, RayApp app){ - super(root, 800,600); + super(root, 1024,768); this.setCursor(null);