]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
optimize culling (not Perfect)
authorPeter Schaefer <schaeferpm@gmail.com>
Tue, 28 Jun 2016 03:45:58 +0000 (05:45 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Tue, 28 Jun 2016 03:45:58 +0000 (05:45 +0200)
Door Texture

Weave/Scene/Camera.cpp
textures/model_door.psb [new file with mode: 0644]
textures/model_door_2D.png [new file with mode: 0644]

index 0982c9d362132e83a49cb4dd6faeeff19639756f..67984bf4c9d980a4b12ad0da1f81a5367df0e9a8 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..acc83f4
Binary files /dev/null and b/textures/model_door_2D.png differ