notaz.gp2x.de
/
mupen64plus-pandora.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GLES2N64: Added WIP fix for CBFD from mupen64plus-ae
[mupen64plus-pandora.git]
/
source
/
gles2n64
/
src
/
F3DCBFD.cpp
diff --git
a/source/gles2n64/src/F3DCBFD.cpp
b/source/gles2n64/src/F3DCBFD.cpp
old mode 100644
(file)
new mode 100755
(executable)
index
d96449b
..
71087d4
--- a/
source/gles2n64/src/F3DCBFD.cpp
+++ b/
source/gles2n64/src/F3DCBFD.cpp
@@
-22,7
+22,6
@@
u32 normal_address = 0;
void F3DCBFD_Vtx(u32 w0, u32 w1)
{
void F3DCBFD_Vtx(u32 w0, u32 w1)
{
-
s32 v0, n;
u32 address;
n = (w0 >> 12)&0xFF;
s32 v0, n;
u32 address;
n = (w0 >> 12)&0xFF;
@@
-37,14
+36,14
@@
void F3DCBFD_Vtx(u32 w0, u32 w1)
gSPFlushTriangles();
Vertex* vertex = (Vertex*)&RDRAM[address];
gSPFlushTriangles();
Vertex* vertex = (Vertex*)&RDRAM[address];
-
+ u32 v;
+
for (s32 i=0; i < n; i++)
{
for (s32 i=0; i < n; i++)
{
- u32 v;
#ifdef __TRIBUFFER_OPT
#ifdef __TRIBUFFER_OPT
- v = __indexmap_getnew(i, 1);
+ v = __indexmap_getnew(
v0 +
i, 1);
#else
#else
- v = i;
+ v =
v0 +
i;
#endif
OGL.triangles.vertices[v].x = vertex->x;
#endif
OGL.triangles.vertices[v].x = vertex->x;
@@
-57,19
+56,23
@@
void F3DCBFD_Vtx(u32 w0, u32 w1)
if (config.enableLighting && gSP.geometryMode & G_LIGHTING)
{
if (config.enableLighting && gSP.geometryMode & G_LIGHTING)
{
- OGL.triangles.vertices[v].nx = ((s8*)RDRAM)[(normal_address + (i<<
2
) + (v0<<1) + 0)^3];
- OGL.triangles.vertices[v].ny = ((s8*)RDRAM)[(normal_address + (i<<
2
) + (v0<<1) + 1)^3];
+ OGL.triangles.vertices[v].nx = ((s8*)RDRAM)[(normal_address + (i<<
1
) + (v0<<1) + 0)^3];
+ OGL.triangles.vertices[v].ny = ((s8*)RDRAM)[(normal_address + (i<<
1
) + (v0<<1) + 1)^3];
OGL.triangles.vertices[v].nz = (s8)(vertex->flag&0xff);
}
gSPProcessVertex(v);
OGL.triangles.vertices[v].nz = (s8)(vertex->flag&0xff);
}
gSPProcessVertex(v);
- if (config.enableLighting && gSP.geometryMode & G_LIGHTING)
+ u32 nonblack = 0;
+ nonblack += OGL.triangles.vertices[v].r;
+ nonblack += OGL.triangles.vertices[v].g;
+ nonblack += OGL.triangles.vertices[v].b;
+ if (config.enableLighting && (gSP.geometryMode & G_LIGHTING) && (nonblack != 0))
{
OGL.triangles.vertices[v].r = OGL.triangles.vertices[v].r * vertex->color.r * 0.0039215689f;
OGL.triangles.vertices[v].g = OGL.triangles.vertices[v].g * vertex->color.g * 0.0039215689f;
OGL.triangles.vertices[v].b = OGL.triangles.vertices[v].b * vertex->color.b * 0.0039215689f;
{
OGL.triangles.vertices[v].r = OGL.triangles.vertices[v].r * vertex->color.r * 0.0039215689f;
OGL.triangles.vertices[v].g = OGL.triangles.vertices[v].g * vertex->color.g * 0.0039215689f;
OGL.triangles.vertices[v].b = OGL.triangles.vertices[v].b * vertex->color.b * 0.0039215689f;
- OGL.triangles.vertices[v].a =
OGL.triangles.vertices[v].a *
vertex->color.a * 0.0039215689f;
+ OGL.triangles.vertices[v].a = vertex->color.a * 0.0039215689f;
}
else
{
}
else
{
@@
-90,7
+93,7
@@
void F3DCBFD_MoveWord(u32 w0, u32 w1)
switch (index)
{
case G_MW_NUMLIGHT:
switch (index)
{
case G_MW_NUMLIGHT:
- gSPNumLights(w1 / 48);
+
gSPNumLights(w1 / 48);
break;
case G_MW_CLIP:
break;
case G_MW_CLIP:
@@
-101,7
+104,7
@@
void F3DCBFD_MoveWord(u32 w0, u32 w1)
break;
case G_MW_SEGMENT:
break;
case G_MW_SEGMENT:
- gSPSegment(_SHIFTR(offset, 2, 4), w1);
+ gSPSegment(_SHIFTR(offset, 2, 4), w1
& 0x00FFFFFF
);
break;
case G_MW_FOG:
break;
case G_MW_FOG:
@@
-133,11
+136,14
@@
void F3DCBFD_MoveMem(u32 w0, u32 w1)
case F3DCBFD_MV_LIGHT:
{
case F3DCBFD_MV_LIGHT:
{
- u32 offset = _SHIFTR( w0, 8, 8 ) << 3;
- if (offset >= 48)
- {
- gSPLight( w1, (offset - 24) / 24);
- }
+ u32 offset = (w0 >> 5) & 0x3FFF;
+ u32 n = offset / 48;
+ if (n < 2) {
+ //LookAt
+ return;
+ }
+ n--;
+ gSPLight(w1, n);
break;
}
break;
}
@@
-151,7
+157,7
@@
void F3DCBFD_MoveMem(u32 w0, u32 w1)
void F3DCBFD_Tri4(u32 w0, u32 w1)
{
gSP4Triangles( _SHIFTR(w0, 23, 5), _SHIFTR(w0, 18, 5), (_SHIFTR(w0, 15, 3 ) << 2) | _SHIFTR(w1, 30, 2),
void F3DCBFD_Tri4(u32 w0, u32 w1)
{
gSP4Triangles( _SHIFTR(w0, 23, 5), _SHIFTR(w0, 18, 5), (_SHIFTR(w0, 15, 3 ) << 2) | _SHIFTR(w1, 30, 2),
- _SHIFTR(w0, 10, 5), _SHIFTR(w0, 5, 5), _SHIFTR(w
1
, 0, 5),
+ _SHIFTR(w0, 10, 5), _SHIFTR(w0, 5, 5), _SHIFTR(w
0
, 0, 5),
_SHIFTR(w1, 25, 5), _SHIFTR(w1, 20, 5), _SHIFTR(w1, 15, 5),
_SHIFTR(w1, 10, 5), _SHIFTR(w1, 5, 5), _SHIFTR(w1, 0, 5));
}
_SHIFTR(w1, 25, 5), _SHIFTR(w1, 20, 5), _SHIFTR(w1, 15, 5),
_SHIFTR(w1, 10, 5), _SHIFTR(w1, 5, 5), _SHIFTR(w1, 0, 5));
}