More fixes
This commit is contained in:
parent
7214852dca
commit
60992f2bc5
|
@ -5,6 +5,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
#define _MIN(x, y) (x < y) ? x : y
|
#define _MIN(x, y) (x < y) ? x : y
|
||||||
|
|
||||||
|
@ -455,7 +456,7 @@ GL_FORCE_INLINE void _glLightVertexPoint(
|
||||||
#undef _PROCESS_COMPONENT
|
#undef _PROCESS_COMPONENT
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count) {
|
void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const uint32_t count) {
|
||||||
GLubyte i;
|
GLubyte i;
|
||||||
GLuint j;
|
GLuint j;
|
||||||
|
|
||||||
|
@ -503,7 +504,7 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count)
|
||||||
float Vx = -data->xyz[0];
|
float Vx = -data->xyz[0];
|
||||||
float Vy = -data->xyz[1];
|
float Vy = -data->xyz[1];
|
||||||
float Vz = -data->xyz[2];
|
float Vz = -data->xyz[2];
|
||||||
vec3f_normalize(Vx, Vy, Vz);
|
VEC3_NORMALIZE(Vx, Vy, Vz);
|
||||||
|
|
||||||
const float Nx = data->n[0];
|
const float Nx = data->n[0];
|
||||||
const float Ny = data->n[1];
|
const float Ny = data->n[1];
|
||||||
|
@ -523,15 +524,15 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count)
|
||||||
float Hy = (Ly + 0);
|
float Hy = (Ly + 0);
|
||||||
float Hz = (Lz + 1);
|
float Hz = (Lz + 1);
|
||||||
|
|
||||||
vec3f_normalize(Lx, Ly, Lz);
|
VEC3_NORMALIZE(Lx, Ly, Lz);
|
||||||
vec3f_normalize(Hx, Hy, Hz);
|
VEC3_NORMALIZE(Hx, Hy, Hz);
|
||||||
|
|
||||||
float LdotN, NdotH;
|
float LdotN, NdotH;
|
||||||
vec3f_dot(
|
VEC3_DOT(
|
||||||
Nx, Ny, Nz, Lx, Ly, Lz, LdotN
|
Nx, Ny, Nz, Lx, Ly, Lz, LdotN
|
||||||
);
|
);
|
||||||
|
|
||||||
vec3f_dot(
|
VEC3_DOT(
|
||||||
Nx, Ny, Nz, Hx, Hy, Hz, NdotH
|
Nx, Ny, Nz, Hx, Hy, Hz, NdotH
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -544,8 +545,7 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
float D;
|
float D;
|
||||||
|
VEC3_LENGTH(Lx, Ly, Lz, D);
|
||||||
vec3f_length(Lx, Ly, Lz, D);
|
|
||||||
|
|
||||||
float att = (
|
float att = (
|
||||||
LIGHTS[i].constant_attenuation + (
|
LIGHTS[i].constant_attenuation + (
|
||||||
|
@ -563,15 +563,15 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const int32_t count)
|
||||||
float Hy = (Ly + Vy);
|
float Hy = (Ly + Vy);
|
||||||
float Hz = (Lz + Vz);
|
float Hz = (Lz + Vz);
|
||||||
|
|
||||||
vec3f_normalize(Lx, Ly, Lz);
|
VEC3_NORMALIZE(Lx, Ly, Lz);
|
||||||
vec3f_normalize(Hx, Hy, Hz);
|
VEC3_NORMALIZE(Hx, Hy, Hz);
|
||||||
|
|
||||||
float LdotN, NdotH;
|
float LdotN, NdotH;
|
||||||
vec3f_dot(
|
VEC3_DOT(
|
||||||
Nx, Ny, Nz, Lx, Ly, Lz, LdotN
|
Nx, Ny, Nz, Lx, Ly, Lz, LdotN
|
||||||
);
|
);
|
||||||
|
|
||||||
vec3f_dot(
|
VEC3_DOT(
|
||||||
Nx, Ny, Nz, Hx, Hy, Hz, NdotH
|
Nx, Ny, Nz, Hx, Hy, Hz, NdotH
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
|
@ -244,6 +244,8 @@ enum GPUCommand {
|
||||||
GPU_CMD_SPRITE = 0xA0000000
|
GPU_CMD_SPRITE = 0xA0000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef float Matrix4x4[16];
|
||||||
|
|
||||||
void SceneBegin();
|
void SceneBegin();
|
||||||
|
|
||||||
void SceneListBegin(GPUList list);
|
void SceneListBegin(GPUList list);
|
||||||
|
|
|
@ -14,21 +14,31 @@
|
||||||
#define FASTCPY(dst, src, bytes) memcpy(dst, src, bytes)
|
#define FASTCPY(dst, src, bytes) memcpy(dst, src, bytes)
|
||||||
#define FASTCPY4(dst, src, bytes) memcpy(dst, src, bytes)
|
#define FASTCPY4(dst, src, bytes) memcpy(dst, src, bytes)
|
||||||
#define MEMSET4(dst, v, size) memset((dst), (v), (size))
|
#define MEMSET4(dst, v, size) memset((dst), (v), (size))
|
||||||
|
#define NORMALIZEVEC3(x, y, z) \
|
||||||
|
do { \
|
||||||
|
float l = MATH_fsrra((x) * (x) + (y) * (y) + (z) * (z)); \
|
||||||
|
x *= l; \
|
||||||
|
y *= l; \
|
||||||
|
z *= l; \
|
||||||
|
while(0); \
|
||||||
|
|
||||||
|
struct PolyHeader;
|
||||||
|
struct PolyContext;
|
||||||
|
|
||||||
inline void CompilePolyHeader(PolyHeader* out, const PolyContext* in) {
|
inline void CompilePolyHeader(PolyHeader* out, const PolyContext* in) {
|
||||||
(void) out;
|
(void) out;
|
||||||
(void) in;
|
(void) in;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void UploadMatrix4x4(const float* mat) {
|
inline void UploadMatrix4x4(const Matrix4x4* mat) {
|
||||||
(void) mat;
|
(void) mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MultiplyMatrix4x4(const float* mat) {
|
inline void MultiplyMatrix4x4(const Matrix4x4* mat) {
|
||||||
(void) mat;
|
(void) mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DownloadMatrix4x4(float* mat) {
|
inline void DownloadMatrix4x4(Matrix4x4* mat) {
|
||||||
(void) mat;
|
(void) mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ extern void* memcpy4 (void *dest, const void *src, size_t count);
|
||||||
|
|
||||||
#define MAX_TEXTURE_SIZE 1024
|
#define MAX_TEXTURE_SIZE 1024
|
||||||
|
|
||||||
typedef float Matrix4x4[16];
|
|
||||||
|
|
||||||
/* This gives us an easy way to switch
|
/* This gives us an easy way to switch
|
||||||
* internal matrix order if necessary */
|
* internal matrix order if necessary */
|
||||||
|
@ -341,7 +340,7 @@ typedef struct {
|
||||||
float finalColour[4]; //16 bytes (to 40)
|
float finalColour[4]; //16 bytes (to 40)
|
||||||
} EyeSpaceData;
|
} EyeSpaceData;
|
||||||
|
|
||||||
extern void _glPerformLighting(Vertex* vertices, EyeSpaceData *es, const int32_t count);
|
extern void _glPerformLighting(Vertex* vertices, EyeSpaceData *es, const uint32_t count);
|
||||||
|
|
||||||
unsigned char _glIsClippingEnabled();
|
unsigned char _glIsClippingEnabled();
|
||||||
void _glEnableClipping(unsigned char v);
|
void _glEnableClipping(unsigned char v);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user