68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
#include "config.h"
|
|
|
|
#include <azur/gint/render.h>
|
|
#include "MyAzurShaders.h"
|
|
#include <cstdlib>
|
|
#include <cstdio>
|
|
|
|
#include <gint/rtc.h>
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t AZRP_SHADER_TILESMAP = -1;
|
|
|
|
|
|
__attribute__((constructor))
|
|
static void register_shader(void)
|
|
{
|
|
extern azrp_shader_t azrp_shader_tilesmap;
|
|
AZRP_SHADER_TILESMAP = azrp_register_shader(azrp_shader_tilesmap);
|
|
}
|
|
|
|
|
|
void azrp_shader_tilesmap_configure(void)
|
|
{
|
|
azrp_set_uniforms(AZRP_SHADER_TILESMAP, (void *)azrp_width);
|
|
}
|
|
|
|
struct command {
|
|
uint8_t shader_id;
|
|
uint8_t current_frag;
|
|
int shifttile;
|
|
int *tilemap;
|
|
bopti_image_t *image;
|
|
int tileset_size;
|
|
};
|
|
|
|
void azrp_tilesmap( int shifttile, int *tilemap, bopti_image_t *image, int tileset_size );
|
|
{
|
|
prof_enter(azrp_perf_cmdgen);
|
|
|
|
struct command cmd;
|
|
cmd.shader_id = AZRP_SHADER_TILESMAP;
|
|
cmd.current_frag = 0;
|
|
cmd.shifttile = shifttile;
|
|
cmd.tilemap = tilemap;
|
|
cmd.image = image;
|
|
cmd.tileset_size = tileset_size;
|
|
|
|
azrp_queue_command(&cmd, sizeof cmd, 0, azrp_frag_count);
|
|
prof_leave(azrp_perf_cmdgen);
|
|
}
|
|
|
|
|
|
void azrp_shader_tilesmap( void *uniforms, void *comnd, void *fragment )
|
|
{
|
|
struct command *cmd = (struct command *) comnd;
|
|
uint16_t *frag = (uint16_t *) fragment;
|
|
|
|
int currentile = cmd->tilemap[cmd->current_frag*25];
|
|
|
|
for(int u=0; u<=25;u++)
|
|
|
|
|
|
|
|
cmd->current_frag++;
|
|
} |