Disable paletted textures for now

This commit is contained in:
2026-03-28 15:40:30 -05:00
parent 87d2d9123e
commit 0e794f28b1
5 changed files with 71 additions and 149 deletions
+39 -39
View File
@@ -12,50 +12,50 @@
#include "util/endian.h"
errorret_t assetTextureLoad(assetentire_t entire) {
assertNotNull(entire.data, "Data pointer cannot be NULL.");
assertNotNull(entire.output, "Output pointer cannot be NULL.");
// assertNotNull(entire.data, "Data pointer cannot be NULL.");
// assertNotNull(entire.output, "Output pointer cannot be NULL.");
assettexture_t *assetData = (assettexture_t *)entire.data;
texture_t *texture = (texture_t *)entire.output;
// assettexture_t *assetData = (assettexture_t *)entire.data;
// texture_t *texture = (texture_t *)entire.output;
// Read header and version (first 4 bytes)
if(
assetData->header[0] != 'D' ||
assetData->header[1] != 'P' ||
assetData->header[2] != 'T'
) {
errorThrow("Invalid texture header");
}
// // Read header and version (first 4 bytes)
// if(
// assetData->header[0] != 'D' ||
// assetData->header[1] != 'P' ||
// assetData->header[2] != 'T'
// ) {
// errorThrow("Invalid texture header");
// }
// Version (can only be 1 atm)
if(assetData->version != 0x01) {
errorThrow("Unsupported texture version");
}
// // Version (can only be 1 atm)
// if(assetData->version != 0x01) {
// errorThrow("Unsupported texture version");
// }
// Fix endian
assetData->width = endianLittleToHost32(assetData->width);
assetData->height = endianLittleToHost32(assetData->height);
// // Fix endian
// assetData->width = endianLittleToHost32(assetData->width);
// assetData->height = endianLittleToHost32(assetData->height);
// Check dimensions.
if(
assetData->width == 0 || assetData->width > ASSET_TEXTURE_WIDTH_MAX ||
assetData->height == 0 || assetData->height > ASSET_TEXTURE_HEIGHT_MAX
) {
errorThrow("Invalid texture dimensions");
}
// // Check dimensions.
// if(
// assetData->width == 0 || assetData->width > ASSET_TEXTURE_WIDTH_MAX ||
// assetData->height == 0 || assetData->height > ASSET_TEXTURE_HEIGHT_MAX
// ) {
// errorThrow("Invalid texture dimensions");
// }
textureInit(
texture,
assetData->width,
assetData->height,
TEXTURE_FORMAT_PALETTE,
(texturedata_t){
.paletted = {
.indices = NULL,
.palette = NULL
}
}
);
// textureInit(
// texture,
// assetData->width,
// assetData->height,
// TEXTURE_FORMAT_PALETTE,
// (texturedata_t){
// .paletted = {
// .indices = NULL,
// .palette = NULL
// }
// }
// );
errorOk();
// errorOk();
}