Mesh working, lua broken
This commit is contained in:
@@ -22,39 +22,44 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <gccore.h>
|
||||
|
||||
display_t DISPLAY = { 0 };
|
||||
|
||||
static vu8 readyForCopy;
|
||||
PADStatus pads[4];
|
||||
Mtx view;
|
||||
Mtx44 projection;
|
||||
#define FIFO_SIZE (256*1024)
|
||||
#if DOLPHIN
|
||||
static vu8 readyForCopy;
|
||||
#define FIFO_SIZE (256*1024)
|
||||
static void copy_buffers(u32 count __attribute__ ((unused)))
|
||||
{
|
||||
if (readyForCopy==GX_TRUE) {
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
GX_CopyDisp(DISPLAY.frameBuffer,GX_TRUE);
|
||||
GX_Flush();
|
||||
readyForCopy = GX_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
float_t vertices[] ATTRIBUTE_ALIGN(32) = {
|
||||
0, 15, 0,
|
||||
-15, -15, 0,
|
||||
15, -15, 0};
|
||||
meshvertex_t vertices[3] = {
|
||||
{
|
||||
.color = COLOR_RED_4B,
|
||||
.uv = { 0.5f, 1.0f },
|
||||
.pos = { 0.0f, 15.0f, 0.0f }
|
||||
},
|
||||
|
||||
{
|
||||
.color = COLOR_GREEN_4B,
|
||||
.uv = { 0.0f, 0.0f },
|
||||
.pos = { -15.0f, -15.0f, 0.0f }
|
||||
},
|
||||
|
||||
u8 colors[] ATTRIBUTE_ALIGN(32) = {
|
||||
255, 0, 0, 255,
|
||||
0, 255, 0, 255,
|
||||
0, 0, 255, 255
|
||||
{
|
||||
.color = COLOR_BLUE_4B,
|
||||
.uv = { 1.0f, 0.0f },
|
||||
.pos = { 15.0f, -15.0f, 0.0f }
|
||||
}
|
||||
};
|
||||
|
||||
static void copy_buffers(u32 count __attribute__ ((unused)))
|
||||
{
|
||||
if (readyForCopy==GX_TRUE) {
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
GX_CopyDisp(DISPLAY.frameBuffer,GX_TRUE);
|
||||
GX_Flush();
|
||||
readyForCopy = GX_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
errorret_t displayInit(void) {
|
||||
#if DISPLAY_SDL2
|
||||
uint32_t flags = SDL_INIT_VIDEO;
|
||||
@@ -149,29 +154,12 @@ errorret_t displayInit(void) {
|
||||
|
||||
//?
|
||||
GX_CopyDisp(DISPLAY.frameBuffer, GX_TRUE);
|
||||
|
||||
// Set up view and projection matrices
|
||||
guPerspective(projection, 60, 1.33F, 10.0F, 300.0F);
|
||||
GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);
|
||||
|
||||
// Prepare Vertex descriptor
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GX_SetArray(GX_VA_POS, vertices, 3*sizeof(float_t));
|
||||
GX_SetArray(GX_VA_CLR0, colors, 4*sizeof(u8));
|
||||
GX_SetNumChans(1);
|
||||
GX_SetNumTexGens(0);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
#endif
|
||||
|
||||
quadInit();
|
||||
frameBufferInitBackbuffer();
|
||||
spriteBatchInit();
|
||||
errorChain(textInit());
|
||||
// errorChain(textInit());
|
||||
screenInit();
|
||||
|
||||
errorOk();
|
||||
@@ -225,39 +213,8 @@ errorret_t displayUpdate(void) {
|
||||
);
|
||||
errorChain(sceneRender());
|
||||
|
||||
GX_InvVtxCache();
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
// This seems to setup camera
|
||||
// guVector camera = {0.0F, 0.0F, 0.0F};
|
||||
// guVector up = {0.0F, 1.0F, 0.0F};
|
||||
// guVector look = {0.0F, 0.0F, -1.0F};
|
||||
// guLookAt(view, &camera, &up, &look);
|
||||
// Mtx modelView;
|
||||
// guMtxIdentity(modelView);
|
||||
// guMtxTransApply(modelView, modelView, 0.0F, 0.0F, -50.0F);
|
||||
// guMtxConcat(view,modelView,modelView);
|
||||
// // This seems to load the matrix into the GX pipeline?
|
||||
// GX_LoadPosMtxImm(modelView, GX_PNMTX0);
|
||||
|
||||
camera_t camera;
|
||||
cameraInitPerspective(&camera);
|
||||
camera.lookat.position[0] = 32;
|
||||
camera.lookat.position[1] = 32;
|
||||
camera.lookat.position[2] = 32;
|
||||
cameraPushMatrix(&camera);
|
||||
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, 3);
|
||||
GX_Position1x8(0);
|
||||
GX_Color1x8(0);
|
||||
GX_Position1x8(1);
|
||||
GX_Color1x8(1);
|
||||
GX_Position1x8(2);
|
||||
GX_Color1x8(2);
|
||||
GX_End();
|
||||
cameraPopMatrix();
|
||||
|
||||
// Render UI
|
||||
uiRender();
|
||||
// uiRender();
|
||||
|
||||
// Finish up
|
||||
screenUnbind();
|
||||
|
||||
Reference in New Issue
Block a user