Fix dolphin color-less
This commit is contained in:
@@ -85,10 +85,14 @@ errorret_t displayInitDolphin(void) {
|
||||
// Describe mesh vertex format.
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_INDEX16);
|
||||
#if MESH_ENABLE_COLOR
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX16);
|
||||
#endif
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX16);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
#if MESH_ENABLE_COLOR
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
#endif
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
|
||||
errorOk();
|
||||
|
||||
@@ -43,9 +43,14 @@ errorret_t meshDrawDolphin(
|
||||
|
||||
// Matches vertex format described in displaydolphin.c
|
||||
assertTrue(sizeof(color_t) == 4, "color_t must be exactly 4 bytes");
|
||||
#if MESH_ENABLE_COLOR
|
||||
assertTrue(offsetof(meshvertex_t, color) == 0, "color offset wrong");
|
||||
assertTrue(offsetof(meshvertex_t, uv) == 4, "uv offset wrong");
|
||||
assertTrue(offsetof(meshvertex_t, pos) == 12, "pos offset wrong");
|
||||
#else
|
||||
assertTrue(offsetof(meshvertex_t, uv) == 0, "uv offset wrong");
|
||||
assertTrue(offsetof(meshvertex_t, pos) == 8, "pos offset wrong");
|
||||
#endif
|
||||
|
||||
DCFlushRange(
|
||||
(void*)&mesh->vertices[vertexOffset],
|
||||
@@ -57,7 +62,12 @@ errorret_t meshDrawDolphin(
|
||||
|
||||
const uint8_t stride = (uint8_t)sizeof(meshvertex_t);
|
||||
GX_SetArray(GX_VA_POS, (void*)&mesh->vertices[vertexOffset].pos[0], stride);
|
||||
GX_SetArray(GX_VA_CLR0, (void*)&mesh->vertices[vertexOffset].color.r, stride);
|
||||
#if MESH_ENABLE_COLOR
|
||||
GX_SetArray(
|
||||
GX_VA_CLR0,
|
||||
(void*)&mesh->vertices[vertexOffset].color.r, stride
|
||||
);
|
||||
#endif
|
||||
GX_SetArray(GX_VA_TEX0, (void*)&mesh->vertices[vertexOffset].uv[0], stride);
|
||||
|
||||
GX_InvVtxCache();
|
||||
@@ -65,7 +75,9 @@ errorret_t meshDrawDolphin(
|
||||
GX_Begin(mesh->primitiveType, GX_VTXFMT0, (uint16_t)vertexCount);
|
||||
for(uint16_t i = 0; i < (uint16_t)vertexCount; ++i) {
|
||||
GX_Position1x16(i);
|
||||
#if MESH_ENABLE_COLOR
|
||||
GX_Color1x16(i);
|
||||
#endif
|
||||
GX_TexCoord1x16(i);
|
||||
}
|
||||
GX_End();
|
||||
|
||||
@@ -311,6 +311,7 @@ errorret_t shaderSetColorGL(
|
||||
// errorChain(errorGLCheck());
|
||||
// glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
|
||||
// errorChain(errorGLCheck());
|
||||
|
||||
#else
|
||||
GLint location;
|
||||
errorChain(shaderParamGetLocationGL(shader, name, &location));
|
||||
|
||||
Reference in New Issue
Block a user