Fix farplane bug

This commit is contained in:
James Lambert 2022-11-16 21:39:05 -07:00
parent 656f45e13f
commit b916035ed1
4 changed files with 7 additions and 1 deletions

View file

@ -84,6 +84,7 @@ Where `/home/james/Blender/blender-2.93.1-linux-x64` is the folder where Blender
## Current TODO list
- [ ] Passing into a cieling portal can sometimes mess with the player rotation
- [ ] render callback only once
- [ ] check for null allocations in render process
- [ ] stop looping sounds betwen levels

View file

@ -225,6 +225,8 @@ int renderPlanPortal(struct RenderPlan* renderPlan, struct Scene* scene, struct
transformConcat(exitPortal, &otherInverse, &portalCombined);
next->camera = current->camera;
next->camera.farPlane = DEFAULT_FAR_PLANE * SCENE_SCALE;
next->camera.nearPlane = DEFAULT_NEAR_PLANE * SCENE_SCALE;
next->aspectRatio = current->aspectRatio;
transformConcat(&portalCombined, &current->camera.transform, &next->camera.transform);

View file

@ -4,6 +4,9 @@
#include "./scene.h"
#include "../graphics/screen_clipper.h"
#define DEFAULT_FAR_PLANE 30.0f
#define DEFAULT_NEAR_PLANE 0.125f
#define MAX_PORTAL_STEPS 6
struct RenderProps {

View file

@ -41,7 +41,7 @@ void sceneUpdateListeners(struct Scene* scene);
void sceneInit(struct Scene* scene) {
signalsInit(1);
cameraInit(&scene->camera, 70.0f, 0.125f * SCENE_SCALE, 30.0f * SCENE_SCALE);
cameraInit(&scene->camera, 70.0f, DEFAULT_NEAR_PLANE * SCENE_SCALE, DEFAULT_FAR_PLANE * SCENE_SCALE);
struct Location* startLocation = levelGetLocation(gCurrentLevel->startLocation);
struct Location combinedLocation;