Remove unused Matrix_Orthographic method

This commit is contained in:
UnknownShadow200 2020-06-10 20:43:09 +10:00
parent bbfcfba18a
commit 8987e6b3e5
6 changed files with 15 additions and 20 deletions

View File

@ -55,8 +55,8 @@ cc_bool Game_ViewBobbing, Game_HideGui;
cc_bool Game_BreakableLiquids, Game_ScreenshotRequested; cc_bool Game_BreakableLiquids, Game_ScreenshotRequested;
float Game_RawHotbarScale, Game_RawChatScale, Game_RawInventoryScale; float Game_RawHotbarScale, Game_RawChatScale, Game_RawInventoryScale;
static struct ScheduledTask Game_Tasks[6]; static struct ScheduledTask tasks[6];
static int Game_TasksCount, entTaskI; static int tasksCount, entTaskI;
static char usernameBuffer[FILENAME_SIZE]; static char usernameBuffer[FILENAME_SIZE];
static char mppassBuffer[STRING_SIZE]; static char mppassBuffer[STRING_SIZE];
@ -79,11 +79,11 @@ int ScheduledTask_Add(double interval, ScheduledTaskCallback callback) {
task.Interval = interval; task.Interval = interval;
task.Callback = callback; task.Callback = callback;
if (Game_TasksCount == Array_Elems(Game_Tasks)) { if (tasksCount == Array_Elems(tasks)) {
Logger_Abort("ScheduledTask_Add - hit max count"); Logger_Abort("ScheduledTask_Add - hit max count");
} }
Game_Tasks[Game_TasksCount++] = task; tasks[tasksCount++] = task;
return Game_TasksCount - 1; return tasksCount - 1;
} }
@ -522,15 +522,15 @@ static void PerformScheduledTasks(double time) {
struct ScheduledTask task; struct ScheduledTask task;
int i; int i;
for (i = 0; i < Game_TasksCount; i++) { for (i = 0; i < tasksCount; i++) {
task = Game_Tasks[i]; task = tasks[i];
task.Accumulator += time; task.Accumulator += time;
while (task.Accumulator >= task.Interval) { while (task.Accumulator >= task.Interval) {
task.Callback(&task); task.Callback(&task);
task.Accumulator -= task.Interval; task.Accumulator -= task.Interval;
} }
Game_Tasks[i] = task; tasks[i] = task;
} }
} }
@ -598,7 +598,7 @@ static void Game_RenderFrame(double delta) {
} }
PerformScheduledTasks(delta); PerformScheduledTasks(delta);
entTask = Game_Tasks[entTaskI]; entTask = tasks[entTaskI];
t = (float)(entTask.Accumulator / entTask.Interval); t = (float)(entTask.Accumulator / entTask.Interval);
LocalPlayer_SetInterpPosition(t); LocalPlayer_SetInterpPosition(t);

View File

@ -878,7 +878,7 @@ void Gfx_LoadIdentityMatrix(MatrixType type) {
#define d3d9_zN -10000.0f #define d3d9_zN -10000.0f
#define d3d9_zF 10000.0f #define d3d9_zF 10000.0f
void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) { void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) {
Matrix_OrthographicOffCenter(matrix, 0.0f, width, height, 0.0f, d3d9_zN, d3d9_zF); Matrix_Orthographic(matrix, 0.0f, width, 0.0f, height, d3d9_zN, d3d9_zF);
matrix->Row2.Z = 1.0f / (d3d9_zN - d3d9_zF); matrix->Row2.Z = 1.0f / (d3d9_zN - d3d9_zF);
matrix->Row3.Z = d3d9_zN / (d3d9_zN - d3d9_zF); matrix->Row3.Z = d3d9_zN / (d3d9_zN - d3d9_zF);
} }
@ -1212,7 +1212,7 @@ void Gfx_SetDepthWrite(cc_bool enabled) { glDepthMask(enabled); }
void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); } void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); }
void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) { void Gfx_CalcOrthoMatrix(float width, float height, struct Matrix* matrix) {
Matrix_OrthographicOffCenter(matrix, 0.0f, width, height, 0.0f, -10000.0f, 10000.0f); Matrix_Orthographic(matrix, 0.0f, width, 0.0f, height, -10000.0f, 10000.0f);
} }
void Gfx_CalcPerspectiveMatrix(float fov, float aspect, float zNear, float zFar, struct Matrix* matrix) { void Gfx_CalcPerspectiveMatrix(float fov, float aspect, float zNear, float zFar, struct Matrix* matrix) {
Matrix_PerspectiveFieldOfView(matrix, fov, aspect, zNear, zFar); Matrix_PerspectiveFieldOfView(matrix, fov, aspect, zNear, zFar);

View File

@ -314,8 +314,8 @@ static void LInput_TickCaret(void* widget) {
cc_bool caretShow; cc_bool caretShow;
Rect2D r; Rect2D r;
elapsed = (int)(DateTime_CurrentUTC_MS() - caretStart);
if (!caretStart) return; if (!caretStart) return;
elapsed = (int)(DateTime_CurrentUTC_MS() - caretStart);
caretShow = (elapsed % 1000) < 500; caretShow = (elapsed % 1000) < 500;
if (caretShow == lastCaretShow) return; if (caretShow == lastCaretShow) return;

View File

@ -166,11 +166,7 @@ void Matrix_Mul(struct Matrix* result, const struct Matrix* left, const struct M
result->Row3.W = (((lM41 * rM14) + (lM42 * rM24)) + (lM43 * rM34)) + (lM44 * rM44); result->Row3.W = (((lM41 * rM14) + (lM42 * rM24)) + (lM43 * rM34)) + (lM44 * rM44);
} }
void Matrix_Orthographic(struct Matrix* result, float width, float height, float zNear, float zFar) { void Matrix_Orthographic(struct Matrix* result, float left, float right, float top, float bottom, float zNear, float zFar) {
Matrix_OrthographicOffCenter(result, -width * 0.5f, width * 0.5f, -height * 0.5f, height * 0.5f, zNear, zFar);
}
void Matrix_OrthographicOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar) {
/* Transposed, source https://msdn.microsoft.com/en-us/library/dd373965(v=vs.85).aspx */ /* Transposed, source https://msdn.microsoft.com/en-us/library/dd373965(v=vs.85).aspx */
*result = Matrix_Identity; *result = Matrix_Identity;

View File

@ -121,8 +121,7 @@ CC_API void Matrix_Scale(struct Matrix* result, float x, float y, float z);
/* NOTE: result can be the same pointer as left or right. */ /* NOTE: result can be the same pointer as left or right. */
CC_API void Matrix_Mul(struct Matrix* result, const struct Matrix* left, const struct Matrix* right); CC_API void Matrix_Mul(struct Matrix* result, const struct Matrix* left, const struct Matrix* right);
void Matrix_Orthographic(struct Matrix* result, float width, float height, float zNear, float zFar); void Matrix_Orthographic(struct Matrix* result, float left, float right, float top, float bottom, float zNear, float zFar);
void Matrix_OrthographicOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar);
void Matrix_PerspectiveFieldOfView(struct Matrix* result, float fovy, float aspect, float zNear, float zFar); void Matrix_PerspectiveFieldOfView(struct Matrix* result, float fovy, float aspect, float zNear, float zFar);
void Matrix_PerspectiveOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar); void Matrix_PerspectiveOffCenter(struct Matrix* result, float left, float right, float bottom, float top, float zNear, float zFar);
void Matrix_LookRot(struct Matrix* result, Vec3 pos, Vec2 rot); void Matrix_LookRot(struct Matrix* result, Vec3 pos, Vec2 rot);

View File

@ -3667,7 +3667,7 @@ static const JNINativeMethod methods[18] = {
void Window_Init(void) { void Window_Init(void) {
JNIEnv* env; JNIEnv* env;
/* TODO: ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0); */ /* TODO: ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN, 0); */
JavaGetCurrentEnv(env); JavaGetCurrentEnv(env);
JavaRegisterNatives(env, methods); JavaRegisterNatives(env, methods);