Alpha textures

This commit is contained in:
2026-02-05 23:28:26 -06:00
parent 1af5f238e4
commit 0d56859d94
5 changed files with 286 additions and 109 deletions

View File

@@ -193,22 +193,33 @@ errorret_t displayUpdate(void) {
);
errorChain(sceneRender());
color_t colors[4 * 4] = {
COLOR_RED_4B, COLOR_GREEN_4B, COLOR_BLUE_4B, COLOR_YELLOW_4B,
COLOR_CYAN_4B, COLOR_MAGENTA_4B, COLOR_WHITE_4B, COLOR_BLACK_4B,
COLOR_ORANGE_4B, COLOR_PURPLE_4B, COLOR_GRAY_4B, COLOR_BROWN_4B,
COLOR_PINK_4B, COLOR_LIME_4B, COLOR_NAVY_4B, COLOR_TEAL_4B
texture_t texture;
// color_t colors[4 * 4] = {
// COLOR_RED_4B, COLOR_GREEN_4B, COLOR_BLUE_4B, COLOR_YELLOW_4B,
// COLOR_CYAN_4B, COLOR_MAGENTA_4B, COLOR_WHITE_4B, COLOR_BLACK_4B,
// COLOR_ORANGE_4B, COLOR_PURPLE_4B, COLOR_GRAY_4B, COLOR_BROWN_4B,
// COLOR_PINK_4B, COLOR_LIME_4B, COLOR_NAVY_4B, COLOR_TEAL_4B
// };
// texturedata_t data = {
// .rgba = { .colors = colors }
// };
// textureInit(&texture, 4, 4, TEXTURE_FORMAT_RGBA, data);
uint8_t alphaData[8 * 4] = {
255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 255, 0, 0, 255, 0, 0,
255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 0, 255, 255, 0, 0, 0,
};
texturedata_t data = {
.rgba = { .colors = colors }
.alpha = { .data = alphaData }
};
textureInit(&texture, 8, 4, TEXTURE_FORMAT_ALPHA, data);
camera_t camera;
cameraInit(&camera);
texture_t texture;
textureInit(&texture, 4, 4, TEXTURE_FORMAT_RGBA, data);
cameraPushMatrix(&camera);
spriteBatchClear();
spriteBatchPush(
@@ -221,7 +232,6 @@ errorret_t displayUpdate(void) {
);
spriteBatchFlush();
cameraPopMatrix();
textureDispose(&texture);
// Render UI
// uiRender();
@@ -245,6 +255,7 @@ errorret_t displayUpdate(void) {
// if(DISPLAY.screenMode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
#endif
textureDispose(&texture);
// For now, we just return an OK error.
errorOk();