From 8b7cfc8a1b1c9126b636e816ff3875f559ffbd54 Mon Sep 17 00:00:00 2001 From: creedvi Date: Thu, 1 Jul 2021 12:18:20 -0400 Subject: [PATCH] fixed errors in Core --- src/com/creedvi/raylib/java/rlj/core/Core.java | 16 ++++++++-------- .../raylib/java/rlj/core/camera/Camera3D.java | 10 +++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/com/creedvi/raylib/java/rlj/core/Core.java b/src/com/creedvi/raylib/java/rlj/core/Core.java index 2de52eb..23dc135 100644 --- a/src/com/creedvi/raylib/java/rlj/core/Core.java +++ b/src/com/creedvi/raylib/java/rlj/core/Core.java @@ -858,14 +858,14 @@ void BeginMode3D(Camera3D camera){ float aspect = (float) window.currentFbo.getWidth() / (float) window.currentFbo.getHeight(); - if (camera.getTypeI() == CAMERA_PERSPECTIVE.getCamType()){ + if (camera.getType() == CAMERA_PERSPECTIVE.getCamType()){ // Setup perspective projection double top = RL_CULL_DISTANCE_NEAR * Math.tan(camera.getFovy() * 0.5 * DEG2RAD); double right = top * aspect; rlFrustum(-right, right, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); } - else if (camera.getTypeI() == CAMERA_ORTHOGRAPHIC.getCamType()){ + else if (camera.getType() == CAMERA_ORTHOGRAPHIC.getCamType()){ // Setup orthographic projection double top = camera.getFovy() / 2.0; double right = top * aspect; @@ -974,12 +974,12 @@ public Ray GetMouseRay(Vector2 mouse, Camera3D camera){ Matrix matProj = MatrixIdentity(); - if (camera.getType() == CAMERA_PERSPECTIVE){ + if (camera.getType() == CAMERA_PERSPECTIVE.getCamType()){ // Calculate projection matrix from perspective matProj = MatrixPerspective(camera.getFovy() * DEG2RAD, ((double) GetScreenWidth() / (double) GetScreenHeight()), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); } - else if (camera.getType() == CAMERA_ORTHOGRAPHIC){ + else if (camera.getType() == CAMERA_ORTHOGRAPHIC.getCamType()){ float aspect = (float) window.screen.getWidth() / (float) window.screen.getHeight(); double top = camera.getFovy() / 2.0; double right = top * aspect; @@ -1003,10 +1003,10 @@ else if (camera.getType() == CAMERA_ORTHOGRAPHIC){ // Calculate normalized direction vector Vector3 direction = Vector3Normalize(Vector3Subtract(farPoint, nearPoint)); - if (camera.getType() == CAMERA_PERSPECTIVE){ + if (camera.getType() == CAMERA_PERSPECTIVE.getCamType()){ ray.position = camera.getPosition(); } - else if (camera.getType() == CAMERA_ORTHOGRAPHIC){ + else if (camera.getType() == CAMERA_ORTHOGRAPHIC.getCamType()){ ray.position = cameraPlanePointerPos; } @@ -1063,12 +1063,12 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera3D camera, int width, int hei // Calculate projection matrix (from perspective instead of frustum Matrix matProj = MatrixIdentity(); - if (camera.getType() == CAMERA_PERSPECTIVE){ + if (camera.getType() == CAMERA_PERSPECTIVE.getCamType()){ // Calculate projection matrix from perspective matProj = MatrixPerspective(camera.getFovy() * DEG2RAD, ((double) width / (double) height), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); } - else if (camera.getType() == CAMERA_ORTHOGRAPHIC){ + else if (camera.getType() == CAMERA_ORTHOGRAPHIC.getCamType()){ float aspect = (float) window.screen.getWidth() / (float) window.screen.getHeight(); double top = camera.getFovy() / 2.0; double right = top * aspect; diff --git a/src/com/creedvi/raylib/java/rlj/core/camera/Camera3D.java b/src/com/creedvi/raylib/java/rlj/core/camera/Camera3D.java index 0498d3c..ba6236a 100644 --- a/src/com/creedvi/raylib/java/rlj/core/camera/Camera3D.java +++ b/src/com/creedvi/raylib/java/rlj/core/camera/Camera3D.java @@ -8,7 +8,7 @@ public Camera3D(){ } - public Camera3D(Vector3 position, Vector3 target, Vector3 up, Float fovy, CameraProjection type){ + public Camera3D(Vector3 position, Vector3 target, Vector3 up, Float fovy, int type){ this.position = position; this.target = target; this.up = up; @@ -20,14 +20,10 @@ public float getFovy(){ return fovy; } - public CameraProjection getType(){ + public int getType(){ return type; } - public int getTypeI(){ - return type.camType; - } - @Override public void update(){ @@ -57,7 +53,7 @@ public void setPosition(Vector3 position){ this.position = position; } - public void setType(CameraProjection type){ + public void setType(int type){ this.type = type; }