Loading...
Searching...
No Matches
main.c File Reference

SuperFX 3D — auto-rotating wireframe cube (2-axis rotation) More...

#include <snes.h>
#include <snes/superfx.h>

Functions

void buildEdges (void)
 Build edge buffer from projected vertices.
 
void gsuSetProgram (void)
 
int main (void)
 
void rotateVertex (u16 idx)
 Rotate one vertex, store projected screen coords (clamped)
 
void writeEdgesToSRAM (void)
 

Variables

static const u8 ce []
 
static const u16 cube_pal []
 
static const s16 cvx [] = {-25, 25, 25,-25,-25, 25, 25,-25}
 
static const s16 cvy [] = {-25,-25, 25, 25,-25,-25, 25, 25}
 
static const s16 cvz [] = {-25,-25,-25,-25, 25, 25, 25, 25}
 
u8 edge_buffer [48]
 
s16 g_cax
 
s16 g_cay
 
u8 g_px [8]
 
u8 g_py [8]
 
s16 g_sax
 
s16 g_say
 
static const s8 sin_tab [256]
 

Detailed Description

SuperFX 3D — auto-rotating wireframe cube (2-axis rotation)

Function Documentation

◆ buildEdges()

void buildEdges ( void  )

Build edge buffer from projected vertices.

◆ gsuSetProgram()

void gsuSetProgram ( void  )
extern

◆ main()

int main ( void  )

◆ rotateVertex()

void rotateVertex ( u16  idx)

Rotate one vertex, store projected screen coords (clamped)

◆ writeEdgesToSRAM()

void writeEdgesToSRAM ( void  )
extern

Variable Documentation

◆ ce

const u8 ce[]
static
Initial value:
= {
0,1, 1,2, 2,3, 3,0, 4,5, 5,6, 6,7, 7,4, 0,4, 1,5, 2,6, 3,7,
}

◆ cube_pal

const u16 cube_pal[]
static
Initial value:
= {
RGB(0,0,4), RGB(0,0,10), RGB(0,0,16), RGB(0,0,24),
RGB(0,10,31), RGB(0,20,31), RGB(0,31,31), RGB(0,31,16),
RGB(16,31,0), RGB(31,31,0), RGB(31,16,0), RGB(31,0,0),
RGB(31,0,16), RGB(31,0,31), RGB(20,20,20), RGB(31,31,31),
}
#define RGB(r, g, b)
Create RGB color value.
Definition video.h:76

◆ cvx

const s16 cvx[] = {-25, 25, 25,-25,-25, 25, 25,-25}
static

◆ cvy

const s16 cvy[] = {-25,-25, 25, 25,-25,-25, 25, 25}
static

◆ cvz

const s16 cvz[] = {-25,-25,-25,-25, 25, 25, 25, 25}
static

◆ edge_buffer

u8 edge_buffer[48]
extern

◆ g_cax

s16 g_cax

◆ g_cay

s16 g_cay

◆ g_px

u8 g_px[8]

◆ g_py

u8 g_py[8]

◆ g_sax

s16 g_sax

◆ g_say

s16 g_say

◆ sin_tab

const s8 sin_tab[256]
static
Initial value:
= {
0, 3, 6, 9, 12, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46,
49, 51, 54, 57, 60, 63, 65, 68, 71, 73, 76, 78, 81, 83, 85, 88,
90, 92, 94, 96, 98, 100, 102, 104, 106, 107, 109, 111, 112, 113, 115, 116,
117, 118, 120, 121, 122, 122, 123, 124, 125, 125, 126, 126, 126, 127, 127, 127,
127, 127, 127, 127, 126, 126, 126, 125, 125, 124, 123, 122, 122, 121, 120, 118,
117, 116, 115, 113, 112, 111, 109, 107, 106, 104, 102, 100, 98, 96, 94, 92,
90, 88, 85, 83, 81, 78, 76, 73, 71, 68, 65, 63, 60, 57, 54, 51,
49, 46, 43, 40, 37, 34, 31, 28, 25, 22, 19, 16, 12, 9, 6, 3,
0, -3, -6, -9, -12, -16, -19, -22, -25, -28, -31, -34, -37, -40, -43, -46,
-49, -51, -54, -57, -60, -63, -65, -68, -71, -73, -76, -78, -81, -83, -85, -88,
-90, -92, -94, -96, -98,-100,-102,-104,-106,-107,-109,-111,-112,-113,-115,-116,
-117,-118,-120,-121,-122,-122,-123,-124,-125,-125,-126,-126,-126,-127,-127,-127,
-127,-127,-127,-127,-126,-126,-126,-125,-125,-124,-123,-122,-122,-121,-120,-118,
-117,-116,-115,-113,-112,-111,-109,-107,-106,-104,-102,-100, -98, -96, -94, -92,
-90, -88, -85, -83, -81, -78, -76, -73, -71, -68, -65, -63, -60, -57, -54, -51,
-49, -46, -43, -40, -37, -34, -31, -28, -25, -22, -19, -16, -12, -9, -6, -3,
}