Skip to content

Commit

Permalink
Change platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Podgajny committed Jan 8, 2023
1 parent 8449073 commit e541500
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/example/rayx/Model/Raycasting/Quality.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<RenderProcedure.angle+RenderProcedure.pi/6; fi+=Quality.deltaFi) {
for(float fi = RenderProcedure.angle - RenderProcedure.pi/4.8f ;fi<RenderProcedure.angle+RenderProcedure.pi/4.8f; fi+=Quality.deltaFi) {
Ray.analyse(fi);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static void precount(float deltaRaycasterStep, float raycasterStep) {
}
}
public static int getValue(double val){
return (int)((val + 6.283)*(double) 1000);
int nval = (int)((val + 6.283)*(double) 1000);
return nval >= 0 ? nval : 0;
}
public static float getSinDeltaX(int angle){
return sinDeltaX[(angle)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/example/rayx/View/ByteMatrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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<Column.posFinal;y+=RenderProcedure.realWidth) {
if ((y<floorY && y >= minimal && y < maximal && y>=minimalY&& (y>maxY || y<minY)) || upperb) {
if(y < maxHeight) {
if ((y < floorY && 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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));

}
}
2 changes: 1 addition & 1 deletion src/main/java/com/example/rayx/View/UI/RenderScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e541500

Please sign in to comment.