From: Peter Schaefer Date: Tue, 28 Jun 2016 03:45:58 +0000 (+0200) Subject: optimize culling (not Perfect) X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=c748ca04c5e22b33e2b1a3725f4df89665a26b58;p=cgue_weave.git optimize culling (not Perfect) Door Texture --- diff --git a/Weave/Scene/Camera.cpp b/Weave/Scene/Camera.cpp index 0982c9d..67984bf 100644 --- a/Weave/Scene/Camera.cpp +++ b/Weave/Scene/Camera.cpp @@ -6,8 +6,8 @@ using glm::lookAt; using glm::perspective; using glm::inverse; -#define VIEW_PITCH_MAX 10.3f -#define VIEW_PITCH_MIN -10.9f +#define VIEW_PITCH_MAX 0.6f +#define VIEW_PITCH_MIN -1.2f #define WORLD_UP vec3(0.f, 1.f, 0.f) @@ -19,11 +19,11 @@ Camera::Camera(float _yFov, float _xyRatio, float _zNear, float _zFar) : projection(perspective(yFov* (float)M_D2R, xyRatio, zNear, zFar)), pitch(0.f), yaw(0.f), - dist(2.f), //DIST + dist(2.5f), //DIST cPosition(0.f), - tan_alphaY(tan(_yFov * (float)M_D2R * .5f)), + tan_alphaY(tan(_yFov * (float)M_D2R * .51f)), Icos_alphaX(1.f/cos(atan(tan_alphaY*_xyRatio))), - Icos_alphaY(1.f/cos(_yFov * (float)M_D2R * .5f)) + Icos_alphaY(1.f/cos(_yFov * (float)M_D2R * .51f)) { updateVectors(); } @@ -117,9 +117,9 @@ void Camera::updateProjection(float _yFov, float _xyRatio, float _zNear, float _ zNear = _zNear; zFar = _zFar; - tan_alphaY = tan(yFov * (float)M_D2R * .5f); + tan_alphaY = tan(yFov * (float)M_D2R * .51f); Icos_alphaX = 1.f / cos(atan(tan_alphaY*xyRatio)); - Icos_alphaY = 1.f / cos(yFov * (float)M_D2R * .5f); + Icos_alphaY = 1.f / cos(yFov * (float)M_D2R * .51f); projection = perspective(yFov * (float)M_D2R, xyRatio, zNear, zFar); } @@ -132,6 +132,7 @@ void Camera::saveProjView() Camera::FC_stat Camera::frustum_sphere(vec3 _center, float _radius) const { FC_stat result = FC_INSIDE; + _radius += 1; vec3 v(_center - cCenter); vec3 pVCam(dot(v,cRight), dot(v,cUpVector), dot(v,cFront)); diff --git a/textures/model_door.psb b/textures/model_door.psb new file mode 100644 index 0000000..c956b72 Binary files /dev/null and b/textures/model_door.psb differ diff --git a/textures/model_door_2D.png b/textures/model_door_2D.png new file mode 100644 index 0000000..acc83f4 Binary files /dev/null and b/textures/model_door_2D.png differ