mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-03 06:24:49 -04:00
MSVC and TDMGCC fixes
This commit is contained in:
Vendored
+5
@@ -38,4 +38,9 @@ namespace CubicVR {
|
||||
|
||||
}
|
||||
|
||||
#include <cmath>
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Vendored
+6
-5
@@ -10,6 +10,7 @@
|
||||
#define CubicVR2_frustum_h
|
||||
|
||||
#include <vector>
|
||||
#include "cubic_types.h"
|
||||
#include "mat4.h"
|
||||
#include "vec3.h"
|
||||
#include "vec4.h"
|
||||
@@ -75,14 +76,14 @@ namespace CubicVR {
|
||||
|
||||
//Sphere
|
||||
__float fov = 1 / pMatrix[5];
|
||||
__float near = -planes[PLANE_NEAR][3];
|
||||
__float far = planes[PLANE_FAR][3];
|
||||
__float view_length = far - near;
|
||||
__float znear = -planes[PLANE_NEAR][3];
|
||||
__float zfar = planes[PLANE_FAR][3];
|
||||
__float view_length = zfar - znear;
|
||||
__float height = view_length * fov;
|
||||
__float width = height;
|
||||
|
||||
vec3 P(0, 0, near + view_length * 0.5f);
|
||||
vec3 Q(width, height, near + view_length);
|
||||
vec3 P(0, 0, znear + view_length * 0.5f);
|
||||
vec3 Q(width, height, znear + view_length);
|
||||
vec3 diff = vec3::subtract(P, Q);
|
||||
__float diff_mag = vec3::length(diff);
|
||||
|
||||
|
||||
Vendored
+1
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include "vec3.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace CubicVR {
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -72,15 +72,15 @@ namespace CubicVR {
|
||||
return mOut;
|
||||
}
|
||||
|
||||
static mat4 perspective(__float fovy, __float aspect, __float near, __float far) {
|
||||
static mat4 perspective(__float fovy, __float aspect, __float znear, __float zfar) {
|
||||
__float yFac = tan(fovy * (float)M_PI / 360.0f);
|
||||
__float xFac = yFac * aspect;
|
||||
|
||||
return mat4(
|
||||
1.0f / xFac, 0, 0, 0, 0, 1.0f / yFac, 0, 0, 0, 0, -(far + near) / (far - near), -1, 0, 0, -(2.0f * far * near) / (far - near), 0);
|
||||
1.0f / xFac, 0, 0, 0, 0, 1.0f / yFac, 0, 0, 0, 0, -(zfar + znear) / (zfar - znear), -1, 0, 0, -(2.0f * zfar * znear) / (zfar - znear), 0);
|
||||
};
|
||||
static mat4 ortho(__float left,__float right,__float bottom,__float top,__float near,__float far) {
|
||||
return mat4(2.0f / (right - left), 0, 0, 0, 0, 2.0f / (top - bottom), 0, 0, 0, 0, -2.0f / (far - near), 0, -(left + right) / (right - left), -(top + bottom) / (top - bottom), -(far + near) / (far - near), 1);
|
||||
static mat4 ortho(__float left,__float right,__float bottom,__float top,__float znear,__float zfar) {
|
||||
return mat4(2.0f / (right - left), 0, 0, 0, 0, 2.0f / (top - bottom), 0, 0, 0, 0, -2.0f / (zfar - znear), 0, -(left + right) / (right - left), -(top + bottom) / (top - bottom), -(zfar + znear) / (zfar - znear), 1);
|
||||
};
|
||||
static __float determinant(mat4 m) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user