Windows/WASM platform fixes

This commit is contained in:
John McCardle 2026-02-07 11:54:01 -05:00
commit 3ce7de6134
5 changed files with 27 additions and 11 deletions

View file

@ -247,30 +247,30 @@ struct mat4 {
// Perspective projection matrix
// fov: vertical field of view in radians
// aspect: width / height
// near, far: clipping planes
static mat4 perspective(float fov, float aspect, float near, float far) {
// nearPlane, farPlane: clipping planes
static mat4 perspective(float fov, float aspect, float nearPlane, float farPlane) {
mat4 result;
float tanHalfFov = std::tan(fov / 2.0f);
result.at(0, 0) = 1.0f / (aspect * tanHalfFov);
result.at(1, 1) = 1.0f / tanHalfFov;
result.at(2, 2) = -(far + near) / (far - near);
result.at(2, 2) = -(farPlane + nearPlane) / (farPlane - nearPlane);
result.at(2, 3) = -1.0f;
result.at(3, 2) = -(2.0f * far * near) / (far - near);
result.at(3, 2) = -(2.0f * farPlane * nearPlane) / (farPlane - nearPlane);
return result;
}
// Orthographic projection matrix
static mat4 ortho(float left, float right, float bottom, float top, float near, float far) {
static mat4 ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane) {
mat4 result = identity();
result.at(0, 0) = 2.0f / (right - left);
result.at(1, 1) = 2.0f / (top - bottom);
result.at(2, 2) = -2.0f / (far - near);
result.at(2, 2) = -2.0f / (farPlane - nearPlane);
result.at(3, 0) = -(right + left) / (right - left);
result.at(3, 1) = -(top + bottom) / (top - bottom);
result.at(3, 2) = -(far + near) / (far - near);
result.at(3, 2) = -(farPlane + nearPlane) / (farPlane - nearPlane);
return result;
}

View file

@ -51,7 +51,7 @@ PyObject* VoxelPoint::get_bool_member(PyVoxelPointObject* self, void* closure)
return NULL;
}
long member = reinterpret_cast<long>(closure);
intptr_t member = reinterpret_cast<intptr_t>(closure);
bool value = false;
switch (member) {
@ -82,7 +82,7 @@ int VoxelPoint::set_bool_member(PyVoxelPointObject* self, PyObject* value, void*
}
bool newValue = PyObject_IsTrue(value);
long member = reinterpret_cast<long>(closure);
intptr_t member = reinterpret_cast<intptr_t>(closure);
switch (member) {
case VOXEL_WALKABLE:
@ -111,7 +111,7 @@ PyObject* VoxelPoint::get_float_member(PyVoxelPointObject* self, void* closure)
return NULL;
}
long member = reinterpret_cast<long>(closure);
intptr_t member = reinterpret_cast<intptr_t>(closure);
float value = 0.0f;
switch (member) {
@ -146,7 +146,7 @@ int VoxelPoint::set_float_member(PyVoxelPointObject* self, PyObject* value, void
return -1;
}
long member = reinterpret_cast<long>(closure);
intptr_t member = reinterpret_cast<intptr_t>(closure);
switch (member) {
case VOXEL_HEIGHT: