mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
DS: Try to avoid loading unnecessary textures into VRAM, slightly optimise matrix loading
This commit is contained in:
parent
8c4e42a43b
commit
3e2b0ea9d4
@ -12,7 +12,7 @@
|
||||
#include "Options.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#ifdef CC_BUILD_ANIMATIONS
|
||||
#ifndef CC_DISABLE_ANIMATIONS
|
||||
static void Animations_Update(int loc, struct Bitmap* bmp, int stride);
|
||||
|
||||
#ifdef CC_BUILD_LOWMEM
|
||||
|
13
src/Core.h
13
src/Core.h
@ -158,8 +158,6 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_FREETYPE
|
||||
#define CC_BUILD_RESOURCES
|
||||
#define CC_BUILD_PLUGINS
|
||||
#define CC_BUILD_ANIMATIONS
|
||||
#define CC_BUILD_HELDBLOCK
|
||||
#define CC_BUILD_FILESYSTEM
|
||||
#define CC_BUILD_ADVLIGHTING
|
||||
/*#define CC_BUILD_GL11*/
|
||||
@ -402,7 +400,8 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_TOUCH
|
||||
#define CC_BUILD_SMALLSTACK
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_BUILD_LOW_VRAM /* Only ~640 kb of VRAM */
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#elif defined __WIIU__
|
||||
#define CC_BUILD_WIIU
|
||||
@ -432,8 +431,8 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_NOSOUNDS
|
||||
#undef CC_BUILD_RESOURCES
|
||||
#undef CC_BUILD_NETWORKING
|
||||
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
|
||||
#undef CC_BUILD_HELDBLOCK /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#elif defined OS2
|
||||
@ -455,8 +454,8 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_TINYSTACK
|
||||
#undef CC_BUILD_RESOURCES
|
||||
#undef CC_BUILD_NETWORKING
|
||||
#undef CC_BUILD_ANIMATIONS /* Very costly in FPU less system */
|
||||
#undef CC_BUILD_HELDBLOCK /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#endif
|
||||
|
@ -916,10 +916,12 @@ static void OnInit(void) {
|
||||
EnvRenderer_Legacy = flags & ENV_LEGACY;
|
||||
EnvRenderer_Minimal = flags & ENV_MINIMAL;
|
||||
|
||||
#ifndef CC_BUILD_LOW_VRAM
|
||||
TextureEntry_Register(&clouds_entry);
|
||||
TextureEntry_Register(&skybox_entry);
|
||||
TextureEntry_Register(&snow_entry);
|
||||
TextureEntry_Register(&rain_entry);
|
||||
#endif
|
||||
|
||||
Event_Register_(&TextureEvents.PackChanged, NULL, OnTexturePackChanged);
|
||||
Event_Register_(&TextureEvents.AtlasChanged, NULL, OnTerrainAtlasChanged);
|
||||
|
@ -401,22 +401,24 @@ static int matrix_modes[] = { GL_PROJECTION, GL_MODELVIEW, GL_TEXTURE };
|
||||
static int lastMatrix;
|
||||
|
||||
void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
|
||||
if (type != lastMatrix) { lastMatrix = type; glMatrixMode(matrix_modes[type]); }
|
||||
if (type != lastMatrix) {
|
||||
lastMatrix = type;
|
||||
MATRIX_CONTROL = matrix_modes[type];
|
||||
}
|
||||
|
||||
// loads 4x4 identity matrix
|
||||
if (matrix == &Matrix_Identity) {
|
||||
glLoadIdentity();
|
||||
MATRIX_IDENTITY = 0;
|
||||
return;
|
||||
// TODO still scale?
|
||||
}
|
||||
|
||||
m4x4 m;
|
||||
// loads 4x4 matrix from memory
|
||||
const float* src = (const float*)matrix;
|
||||
|
||||
for (int i = 0; i < 4 * 4; i++)
|
||||
{
|
||||
m.m[i] = floattof32(src[i]);
|
||||
MATRIX_LOAD4x4 = floattof32(src[i]);
|
||||
}
|
||||
glLoadMatrix4x4(&m);
|
||||
|
||||
// Vertex commands are signed 16 bit values, with 12 bits fractional
|
||||
// aka only from -8.0 to 8.0
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "Options.h"
|
||||
|
||||
cc_bool HeldBlockRenderer_Show;
|
||||
#ifdef CC_BUILD_HELDBLOCK
|
||||
#ifndef CC_DISABLE_HELDBLOCK
|
||||
static BlockID held_block;
|
||||
static struct Entity held_entity;
|
||||
static struct Matrix held_blockProj;
|
||||
|
@ -122,8 +122,9 @@ void Platform_EncodePath(cc_filepath* dst, const cc_string* path) {
|
||||
cc_result Directory_Create(const cc_filepath* path) {
|
||||
if (!fat_available) return 0;
|
||||
|
||||
Platform_Log1("mkdir %c", path->buffer);
|
||||
return mkdir(path->buffer, 0) == -1 ? errno : 0;
|
||||
int ret = mkdir(path->buffer, 0) == -1 ? errno : 0;
|
||||
Platform_Log2("mkdir %c = %i", path->buffer, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int File_Exists(const cc_filepath* path) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user