this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rename near and far camera clipping planes to avoid collisions with keywords on some platforms. Fixes #105. Thanks Serenitor!

+24 -24
+6 -6
include/SDL_gpu.h
··· 305 305 float x, y, z; 306 306 float angle; 307 307 float zoom; 308 - float near, far; // z clipping planes 308 + float z_near, z_far; // z clipping planes 309 309 } GPU_Camera; 310 310 311 311 ··· 1283 1283 DECLSPEC void SDLCALL GPU_MatrixIdentity(float* result); 1284 1284 1285 1285 /*! Multiplies an orthographic projection matrix into the given matrix. */ 1286 - DECLSPEC void SDLCALL GPU_MatrixOrtho(float* result, float left, float right, float bottom, float top, float near, float far); 1286 + DECLSPEC void SDLCALL GPU_MatrixOrtho(float* result, float left, float right, float bottom, float top, float z_near, float z_far); 1287 1287 1288 1288 /*! Multiplies a perspective projection matrix into the given matrix. */ 1289 - DECLSPEC void SDLCALL GPU_MatrixFrustum(float* result, float left, float right, float bottom, float top, float near, float far); 1289 + DECLSPEC void SDLCALL GPU_MatrixFrustum(float* result, float left, float right, float bottom, float top, float z_near, float z_far); 1290 1290 1291 1291 /*! Multiplies a perspective projection matrix into the given matrix. */ 1292 - DECLSPEC void SDLCALL GPU_MatrixPerspective(float* result, float fovy, float aspect, float zNear, float zFar); 1292 + DECLSPEC void SDLCALL GPU_MatrixPerspective(float* result, float fovy, float aspect, float z_near, float z_far); 1293 1293 1294 1294 /*! Multiplies a view matrix into the given matrix. */ 1295 1295 DECLSPEC void SDLCALL GPU_MatrixLookAt(float* matrix, float eye_x, float eye_y, float eye_z, float target_x, float target_y, float target_z, float up_x, float up_y, float up_z); ··· 1351 1351 DECLSPEC void SDLCALL GPU_LoadMatrix(const float* matrix4x4); 1352 1352 1353 1353 /*! Multiplies an orthographic projection matrix into the current matrix. */ 1354 - DECLSPEC void SDLCALL GPU_Ortho(float left, float right, float bottom, float top, float near, float far); 1354 + DECLSPEC void SDLCALL GPU_Ortho(float left, float right, float bottom, float top, float z_near, float z_far); 1355 1355 1356 1356 /*! Multiplies a perspective projection matrix into the current matrix. */ 1357 - DECLSPEC void SDLCALL GPU_Frustum(float left, float right, float bottom, float top, float near, float far); 1357 + DECLSPEC void SDLCALL GPU_Frustum(float left, float right, float bottom, float top, float z_near, float z_far); 1358 1358 1359 1359 /*! Adds a translation into the current matrix. */ 1360 1360 DECLSPEC void SDLCALL GPU_Translate(float x, float y, float z);
+16 -16
src/SDL_gpu_matrix.c
··· 165 165 } 166 166 167 167 168 - void GPU_MatrixOrtho(float* result, float left, float right, float bottom, float top, float near, float far) 168 + void GPU_MatrixOrtho(float* result, float left, float right, float bottom, float top, float z_near, float z_far) 169 169 { 170 170 if(result == NULL) 171 171 return; ··· 176 176 FILL_MATRIX_4x4(A, 177 177 2/(right - left), 0, 0, -(right + left)/(right - left), 178 178 0, 2/(top - bottom), 0, -(top + bottom)/(top - bottom), 179 - 0, 0, -2/(far - near), -(far + near)/(far - near), 179 + 0, 0, -2/(z_far - z_near), -(z_far + z_near)/(z_far - z_near), 180 180 0, 0, 0, 1 181 181 ); 182 182 #else ··· 184 184 FILL_MATRIX_4x4(A, 185 185 2 / (right - left), 0, 0, 0, 186 186 0, 2 / (top - bottom), 0, 0, 187 - 0, 0, -2 / (far - near), 0, 188 - -(right + left) / (right - left), -(top + bottom) / (top - bottom), -(far + near) / (far - near), 1 187 + 0, 0, -2 / (z_far - z_near), 0, 188 + -(right + left) / (right - left), -(top + bottom) / (top - bottom), -(z_far + z_near) / (z_far - z_near), 1 189 189 ); 190 190 #endif 191 191 ··· 194 194 } 195 195 196 196 197 - void GPU_MatrixFrustum(float* result, float left, float right, float bottom, float top, float near, float far) 197 + void GPU_MatrixFrustum(float* result, float left, float right, float bottom, float top, float z_near, float z_far) 198 198 { 199 199 if(result == NULL) 200 200 return; ··· 202 202 { 203 203 float A[16]; 204 204 FILL_MATRIX_4x4(A, 205 - 2 * near / (right - left), 0, 0, 0, 206 - 0, 2 * near / (top - bottom), 0, 0, 207 - (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 208 - 0, 0, -(2 * far * near) / (far - near), 0 205 + 2 * z_near / (right - left), 0, 0, 0, 206 + 0, 2 * z_near / (top - bottom), 0, 0, 207 + (right + left) / (right - left), (top + bottom) / (top - bottom), -(z_far + z_near) / (z_far - z_near), -1, 208 + 0, 0, -(2 * z_far * z_near) / (z_far - z_near), 0 209 209 ); 210 210 211 211 GPU_MultiplyAndAssign(result, A); 212 212 } 213 213 } 214 214 215 - void GPU_MatrixPerspective(float* result, float fovy, float aspect, float zNear, float zFar) 215 + void GPU_MatrixPerspective(float* result, float fovy, float aspect, float z_near, float z_far) 216 216 { 217 217 float fW, fH; 218 218 ··· 220 220 fovy = -fovy; 221 221 aspect = -aspect; 222 222 223 - fH = tanf(fovy / 360 * M_PI) * zNear; 223 + fH = tanf(fovy / 360 * M_PI) * z_near; 224 224 fW = fH * aspect; 225 - GPU_MatrixFrustum(result, -fW, fW, -fH, fH, zNear, zFar); 225 + GPU_MatrixFrustum(result, -fW, fW, -fH, fH, z_near, z_far); 226 226 } 227 227 228 228 void GPU_MatrixLookAt(float* matrix, float eye_x, float eye_y, float eye_z, float target_x, float target_y, float target_z, float up_x, float up_y, float up_z) ··· 545 545 GPU_MatrixCopy(result, A); 546 546 } 547 547 548 - void GPU_Ortho(float left, float right, float bottom, float top, float near, float far) 548 + void GPU_Ortho(float left, float right, float bottom, float top, float z_near, float z_far) 549 549 { 550 550 GPU_FlushBlitBuffer(); 551 - GPU_MatrixOrtho(GPU_GetCurrentMatrix(), left, right, bottom, top, near, far); 551 + GPU_MatrixOrtho(GPU_GetCurrentMatrix(), left, right, bottom, top, z_near, z_far); 552 552 } 553 553 554 - void GPU_Frustum(float left, float right, float bottom, float top, float near, float far) 554 + void GPU_Frustum(float left, float right, float bottom, float top, float z_near, float z_far) 555 555 { 556 556 GPU_FlushBlitBuffer(); 557 - GPU_MatrixFrustum(GPU_GetCurrentMatrix(), left, right, bottom, top, near, far); 557 + GPU_MatrixFrustum(GPU_GetCurrentMatrix(), left, right, bottom, top, z_near, z_far); 558 558 } 559 559 560 560 void GPU_Translate(float x, float y, float z)
+2 -2
src/renderer_GL_common.inl
··· 1139 1139 1140 1140 // Now multiply in the projection part 1141 1141 if(!invert ^ GPU_GetCoordinateMode()) 1142 - GPU_MatrixOrtho(result, target->camera.x, target->w + target->camera.x, target->h + target->camera.y, target->camera.y, target->camera.near, target->camera.far); 1142 + GPU_MatrixOrtho(result, target->camera.x, target->w + target->camera.x, target->h + target->camera.y, target->camera.y, target->camera.z_near, target->camera.z_far); 1143 1143 else 1144 - GPU_MatrixOrtho(result, target->camera.x, target->w + target->camera.x, target->camera.y, target->h + target->camera.y, target->camera.near, target->camera.far); // Special inverted orthographic projection because tex coords are inverted already for render-to-texture 1144 + GPU_MatrixOrtho(result, target->camera.x, target->w + target->camera.x, target->camera.y, target->h + target->camera.y, target->camera.z_near, target->camera.z_far); // Special inverted orthographic projection because tex coords are inverted already for render-to-texture 1145 1145 1146 1146 // First the modelview part 1147 1147 offsetX = target->w/2.0f;