parent
28d40ffcf5
commit
b41c194c10
|
@ -4704,7 +4704,7 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
|||
case eng_3D_CLIPMTX_RESULT+60:
|
||||
{
|
||||
//LOG("4000640h..67Fh - CLIPMTX_RESULT - Read Current Clip Coordinates Matrix (R)");
|
||||
return gfx3d_GetClipMatrix ((adr-0x04000640)/4);
|
||||
return gfx3d_GetClipMatrix((adr-0x04000640)/4);
|
||||
}
|
||||
case eng_3D_VECMTX_RESULT:
|
||||
case eng_3D_VECMTX_RESULT+4:
|
||||
|
@ -4717,7 +4717,7 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
|||
case eng_3D_VECMTX_RESULT+32:
|
||||
{
|
||||
//LOG("4000680h..6A3h - VECMTX_RESULT - Read Current Directional Vector Matrix (R)");
|
||||
return gfx3d_GetDirectionalMatrix ((adr-0x04000680)/4);
|
||||
return gfx3d_GetDirectionalMatrix((adr-0x04000680)/4);
|
||||
}
|
||||
|
||||
case eng_3D_RAM_COUNT:
|
||||
|
|
|
@ -1054,7 +1054,7 @@ Render3DError OpenGLRenderer_3_2::BeginRender(const GFX3D &engine)
|
|||
// safe to use.
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, OGLRef.uboRenderStatesID);
|
||||
OGLRenderStates *state = (OGLRenderStates *)glMapBufferRange(GL_UNIFORM_BUFFER, 0, sizeof(OGLRenderStates), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
OGLRenderStates *state = (OGLRenderStates *)glMapBufferRange(GL_UNIFORM_BUFFER, 0, sizeof(OGLRenderStates), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
|
||||
state->framebufferSize.x = this->_framebufferWidth;
|
||||
state->framebufferSize.y = this->_framebufferHeight;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -122,14 +122,26 @@ inline u32 RGB15TO6665(u16 col, u8 alpha5)
|
|||
// 15-bit to 24-bit depth formula from http://nocash.emubase.de/gbatek.htm#ds3drearplane
|
||||
#define DS_DEPTH15TO24(depth) ( dsDepthExtend_15bit_to_24bit[(depth) & 0x7FFF] )
|
||||
|
||||
// POLYGON PRIMITIVE TYPES
|
||||
enum
|
||||
// MATRIX MODES
|
||||
enum MatrixMode
|
||||
{
|
||||
GFX3D_TRIANGLES = 0,
|
||||
GFX3D_QUADS = 1,
|
||||
GFX3D_TRIANGLE_STRIP = 2,
|
||||
GFX3D_QUAD_STRIP = 3,
|
||||
GFX3D_LINE = 4
|
||||
MATRIXMODE_PROJECTION = 0,
|
||||
MATRIXMODE_POSITION = 1,
|
||||
MATRIXMODE_POSITION_VECTOR = 2,
|
||||
MATRIXMODE_TEXTURE = 3
|
||||
};
|
||||
|
||||
// POLYGON PRIMITIVE TYPES
|
||||
enum PolygonPrimitiveType
|
||||
{
|
||||
GFX3D_TRIANGLES = 0,
|
||||
GFX3D_QUADS = 1,
|
||||
GFX3D_TRIANGLE_STRIP = 2,
|
||||
GFX3D_QUAD_STRIP = 3,
|
||||
GFX3D_TRIANGLES_LINE = 4,
|
||||
GFX3D_QUADS_LINE = 5,
|
||||
GFX3D_TRIANGLE_STRIP_LINE = 6,
|
||||
GFX3D_QUAD_STRIP_LINE = 7
|
||||
};
|
||||
|
||||
// POLYGON MODES
|
||||
|
@ -141,6 +153,13 @@ enum PolygonMode
|
|||
POLYGON_MODE_SHADOW = 3
|
||||
};
|
||||
|
||||
// POLYGON TYPES
|
||||
enum PolygonType
|
||||
{
|
||||
POLYGON_TYPE_TRIANGLE = 3,
|
||||
POLYGON_TYPE_QUAD = 4
|
||||
};
|
||||
|
||||
// POLYGON ATTRIBUTES - BIT LOCATIONS
|
||||
enum
|
||||
{
|
||||
|
@ -271,8 +290,8 @@ typedef struct
|
|||
} PolygonTexParams;
|
||||
|
||||
struct POLY {
|
||||
int type; //tri or quad
|
||||
u8 vtxFormat;
|
||||
PolygonType type; //tri or quad
|
||||
PolygonPrimitiveType vtxFormat;
|
||||
u16 vertIndexes[4]; //up to four verts can be referenced by this poly
|
||||
u32 polyAttr, texParam, texPalette; //the hardware rendering params
|
||||
u32 viewport;
|
||||
|
@ -283,8 +302,8 @@ struct POLY {
|
|||
vertIndexes[0] = a;
|
||||
vertIndexes[1] = b;
|
||||
vertIndexes[2] = c;
|
||||
if(d != -1) { vertIndexes[3] = d; type = 4; }
|
||||
else type = 3;
|
||||
if(d != -1) { vertIndexes[3] = d; type = POLYGON_TYPE_QUAD; }
|
||||
else type = POLYGON_TYPE_TRIANGLE;
|
||||
}
|
||||
|
||||
u8 getAttributeEnableLightFlags() const
|
||||
|
@ -580,7 +599,8 @@ struct INDEXLIST {
|
|||
|
||||
|
||||
struct VIEWPORT {
|
||||
int x, y, width, height;
|
||||
u8 x, y;
|
||||
u16 width, height;
|
||||
void decode(u32 v);
|
||||
};
|
||||
|
||||
|
@ -595,8 +615,8 @@ public:
|
|||
|
||||
struct TClippedPoly
|
||||
{
|
||||
int type; //otherwise known as "count" of verts
|
||||
POLY* poly;
|
||||
PolygonType type; //otherwise known as "count" of verts
|
||||
POLY *poly;
|
||||
VERT clipVerts[MAX_CLIPPED_VERTS];
|
||||
};
|
||||
|
||||
|
@ -721,7 +741,7 @@ extern CACHE_ALIGN u32 color_15bit_to_24bit_reverse[32768];
|
|||
extern CACHE_ALIGN u16 color_15bit_to_16bit_reverse[32768];
|
||||
extern CACHE_ALIGN u32 dsDepthExtend_15bit_to_24bit[32768];
|
||||
extern CACHE_ALIGN u8 mixTable555[32][32][32];
|
||||
extern CACHE_ALIGN const int material_5bit_to_31bit[32];
|
||||
extern CACHE_ALIGN const u32 material_5bit_to_31bit[32];
|
||||
extern CACHE_ALIGN const u8 material_5bit_to_8bit[32];
|
||||
extern CACHE_ALIGN const u8 material_3bit_to_5bit[8];
|
||||
extern CACHE_ALIGN const u8 material_3bit_to_6bit[8];
|
||||
|
@ -745,11 +765,11 @@ int gfx3d_GetNumPolys();
|
|||
int gfx3d_GetNumVertex();
|
||||
void gfx3d_UpdateToonTable(u8 offset, u16 val);
|
||||
void gfx3d_UpdateToonTable(u8 offset, u32 val);
|
||||
s32 gfx3d_GetClipMatrix (u32 index);
|
||||
s32 gfx3d_GetDirectionalMatrix (u32 index);
|
||||
s32 gfx3d_GetClipMatrix (const u32 index);
|
||||
s32 gfx3d_GetDirectionalMatrix(const u32 index);
|
||||
void gfx3d_glAlphaFunc(u32 v);
|
||||
u32 gfx3d_glGetPosRes(u32 index);
|
||||
u16 gfx3d_glGetVecRes(u32 index);
|
||||
u32 gfx3d_glGetPosRes(const size_t index);
|
||||
u16 gfx3d_glGetVecRes(const size_t index);
|
||||
void gfx3d_VBlankSignal();
|
||||
void gfx3d_VBlankEndSignal(bool skipFrame);
|
||||
void gfx3d_Control(u32 v);
|
||||
|
|
|
@ -157,9 +157,9 @@ void MatrixIdentity (s32 *matrix)
|
|||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1<<12;
|
||||
}
|
||||
|
||||
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix)
|
||||
s32 MatrixGetMultipliedIndex(const u32 index, s32 *matrix, s32 *rightMatrix)
|
||||
{
|
||||
int iMod = index%4, iDiv = (index>>2)<<2;
|
||||
const size_t iMod = index%4, iDiv = (index>>2)<<2;
|
||||
|
||||
s64 temp = ((s64)matrix[iMod ]*rightMatrix[iDiv ])+((s64)matrix[iMod+ 4]*rightMatrix[iDiv+1])+
|
||||
((s64)matrix[iMod+8]*rightMatrix[iDiv+2])+((s64)matrix[iMod+12]*rightMatrix[iDiv+3]);
|
||||
|
@ -271,21 +271,21 @@ void MatrixStackPopMatrix (s32 *mtxCurr, MatrixStack *stack, int size)
|
|||
MatrixCopy (mtxCurr, &stack->matrix[stack->position*16]);
|
||||
}
|
||||
|
||||
s32 * MatrixStackGetPos (MatrixStack *stack, int pos)
|
||||
s32* MatrixStackGetPos(MatrixStack *stack, const size_t pos)
|
||||
{
|
||||
assert(pos<31);
|
||||
return &stack->matrix[pos*16];
|
||||
}
|
||||
|
||||
s32 * MatrixStackGet (MatrixStack *stack)
|
||||
s32* MatrixStackGet (MatrixStack *stack)
|
||||
{
|
||||
return &stack->matrix[stack->position*16];
|
||||
}
|
||||
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const s32 *ptr)
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, const size_t pos, const s32 *ptr)
|
||||
{
|
||||
assert(pos<31);
|
||||
MatrixCopy (&stack->matrix[pos*16], ptr);
|
||||
MatrixCopy(&stack->matrix[pos*16], ptr);
|
||||
}
|
||||
|
||||
void Vector2Copy(float *dst, const float *src)
|
||||
|
|
|
@ -49,8 +49,8 @@ void MatrixInit (s32 *matrix);
|
|||
//without having to make new build types to exclude the assembly files.
|
||||
//a bit sloppy, but there aint much to it
|
||||
|
||||
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix);
|
||||
float MatrixGetMultipliedIndex (const u32 index, float *matrix, float *rightMatrix);
|
||||
s32 MatrixGetMultipliedIndex (const u32 index, s32 *matrix, s32 *rightMatrix);
|
||||
void MatrixSet (s32 *matrix, int x, int y, s32 value);
|
||||
void MatrixCopy (s32 * matrixDST, const s32 * matrixSRC);
|
||||
int MatrixCompare (const s32 * matrixDST, const float * matrixSRC);
|
||||
|
@ -60,9 +60,9 @@ void MatrixStackInit (MatrixStack *stack);
|
|||
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
|
||||
void MatrixStackPushMatrix (MatrixStack *stack, const s32 *ptr);
|
||||
void MatrixStackPopMatrix (s32 *mtxCurr, MatrixStack *stack, int size);
|
||||
s32* MatrixStackGetPos (MatrixStack *stack, int pos);
|
||||
s32* MatrixStackGetPos (MatrixStack *stack, const size_t pos);
|
||||
s32* MatrixStackGet (MatrixStack *stack);
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const s32 *ptr);
|
||||
void MatrixStackLoadMatrix (MatrixStack *stack, const size_t pos, const s32 *ptr);
|
||||
|
||||
void Vector2Copy(float *dst, const float *src);
|
||||
void Vector2Add(float *dst, const float *src);
|
||||
|
|
|
@ -515,7 +515,7 @@ public:
|
|||
|
||||
case POLYGON_MODE_DECAL:
|
||||
{
|
||||
if(sampler.enabled)
|
||||
if (sampler.enabled)
|
||||
{
|
||||
dst.r = decal_table[mainTexColor.a][mainTexColor.r][src.r];
|
||||
dst.g = decal_table[mainTexColor.a][mainTexColor.g][src.g];
|
||||
|
@ -533,7 +533,7 @@ public:
|
|||
{
|
||||
const FragmentColor toonColor = this->_softRender->toonColor32LUT[src.r >> 1];
|
||||
|
||||
if(gfx3d.renderState.shading == GFX3D_State::HIGHLIGHT)
|
||||
if (gfx3d.renderState.shading == GFX3D_State::HIGHLIGHT)
|
||||
{
|
||||
dst.r = modulate_table[mainTexColor.r][src.r];
|
||||
dst.g = modulate_table[mainTexColor.g][src.r];
|
||||
|
@ -1004,8 +1004,8 @@ public:
|
|||
|
||||
lastTexKey = NULL;
|
||||
|
||||
GFX3D_Clipper::TClippedPoly &firstClippedPoly = this->_softRender->clippedPolys[0];
|
||||
POLY &firstPoly = *firstClippedPoly.poly;
|
||||
const GFX3D_Clipper::TClippedPoly &firstClippedPoly = this->_softRender->clippedPolys[0];
|
||||
const POLY &firstPoly = *firstClippedPoly.poly;
|
||||
PolygonAttributes polyAttr = firstPoly.getAttributes();
|
||||
u32 lastPolyAttr = firstPoly.polyAttr;
|
||||
u32 lastTexParams = firstPoly.texParam;
|
||||
|
@ -1020,8 +1020,8 @@ public:
|
|||
polynum = i;
|
||||
|
||||
GFX3D_Clipper::TClippedPoly &clippedPoly = this->_softRender->clippedPolys[i];
|
||||
POLY &thePoly = *clippedPoly.poly;
|
||||
int type = clippedPoly.type;
|
||||
const POLY &thePoly = *clippedPoly.poly;
|
||||
const PolygonType type = clippedPoly.type;
|
||||
|
||||
if (lastPolyAttr != thePoly.polyAttr)
|
||||
{
|
||||
|
@ -1232,7 +1232,7 @@ Render3DError SoftRasterizerRenderer::InitTables()
|
|||
{
|
||||
static bool needTableInit = true;
|
||||
|
||||
if(needTableInit)
|
||||
if (needTableInit)
|
||||
{
|
||||
for (size_t i = 0; i < 64; i++)
|
||||
{
|
||||
|
@ -1265,7 +1265,8 @@ Render3DError SoftRasterizerRenderer::InitTables()
|
|||
return RENDER3DERROR_NOERR;
|
||||
}
|
||||
|
||||
size_t SoftRasterizerRenderer::performClipping(bool hirez, const VERTLIST *vertList, const POLYLIST *polyList, const INDEXLIST *indexList)
|
||||
template<bool useHiResInterpolate>
|
||||
size_t SoftRasterizerRenderer::performClipping(const VERTLIST *vertList, const POLYLIST *polyList, const INDEXLIST *indexList)
|
||||
{
|
||||
//submit all polys to clipper
|
||||
clipper.reset();
|
||||
|
@ -1276,15 +1277,12 @@ size_t SoftRasterizerRenderer::performClipping(bool hirez, const VERTLIST *vertL
|
|||
&vertList->list[poly.vertIndexes[0]],
|
||||
&vertList->list[poly.vertIndexes[1]],
|
||||
&vertList->list[poly.vertIndexes[2]],
|
||||
poly.type==4
|
||||
poly.type==POLYGON_TYPE_QUAD
|
||||
?&vertList->list[poly.vertIndexes[3]]
|
||||
:NULL
|
||||
};
|
||||
|
||||
if(hirez)
|
||||
clipper.clipPoly<true>(poly, clipVerts);
|
||||
else
|
||||
clipper.clipPoly<false>(poly, clipVerts);
|
||||
clipper.clipPoly<useHiResInterpolate>(poly, clipVerts);
|
||||
}
|
||||
|
||||
return clipper.clippedPolyCounter;
|
||||
|
@ -1347,7 +1345,7 @@ void SoftRasterizerRenderer::performCoordAdjustment()
|
|||
for (size_t i = 0; i < this->_clippedPolyCount; i++)
|
||||
{
|
||||
GFX3D_Clipper::TClippedPoly &clippedPoly = clippedPolys[i];
|
||||
int type = clippedPoly.type;
|
||||
const PolygonType type = clippedPoly.type;
|
||||
VERT *verts = &clippedPoly.clipVerts[0];
|
||||
|
||||
//here is a hack which needs to be removed.
|
||||
|
@ -1359,28 +1357,33 @@ void SoftRasterizerRenderer::performCoordAdjustment()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void SoftRasterizerRenderer::setupTextures()
|
||||
{
|
||||
TexCacheItem *lastTexKey = NULL;
|
||||
u32 lastTextureFormat = 0, lastTexturePalette = 0;
|
||||
bool needInitTexture = true;
|
||||
if (this->_clippedPolyCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const GFX3D_Clipper::TClippedPoly &firstClippedPoly = this->clippedPolys[0];
|
||||
const POLY &firstPoly = *firstClippedPoly.poly;
|
||||
u32 lastTexParams = firstPoly.texParam;
|
||||
u32 lastTexPalette = firstPoly.texPalette;
|
||||
TexCacheItem *lastTexKey = TexCache_SetTexture(TexFormat_15bpp, firstPoly.texParam, firstPoly.texPalette);
|
||||
|
||||
for (size_t i = 0; i < this->_clippedPolyCount; i++)
|
||||
{
|
||||
GFX3D_Clipper::TClippedPoly &clippedPoly = clippedPolys[i];
|
||||
POLY *thePoly = clippedPoly.poly;
|
||||
const GFX3D_Clipper::TClippedPoly &clippedPoly = clippedPolys[i];
|
||||
const POLY &thePoly = *clippedPoly.poly;
|
||||
|
||||
//make sure all the textures we'll need are cached
|
||||
//(otherwise on a multithreaded system there will be multiple writers--
|
||||
//this SHOULD be read-only, although some day the texcache may collect statistics or something
|
||||
//and then it won't be safe.
|
||||
if (needInitTexture || lastTextureFormat != thePoly->texParam || lastTexturePalette != thePoly->texPalette)
|
||||
if (lastTexParams != thePoly.texParam || lastTexPalette != thePoly.texPalette)
|
||||
{
|
||||
lastTexKey = TexCache_SetTexture(TexFormat_15bpp, thePoly->texParam, thePoly->texPalette);
|
||||
lastTextureFormat = thePoly->texParam;
|
||||
lastTexturePalette = thePoly->texPalette;
|
||||
needInitTexture = false;
|
||||
lastTexKey = TexCache_SetTexture(TexFormat_15bpp, thePoly.texParam, thePoly.texPalette);
|
||||
lastTexParams = thePoly.texParam;
|
||||
lastTexPalette = thePoly.texPalette;
|
||||
}
|
||||
|
||||
//printf("%08X %d\n",poly->texParam,rasterizerUnit[0].textures.currentNum);
|
||||
|
@ -1415,11 +1418,11 @@ void SoftRasterizerRenderer::performBackfaceTests()
|
|||
{
|
||||
for (size_t i = 0; i < this->_clippedPolyCount; i++)
|
||||
{
|
||||
GFX3D_Clipper::TClippedPoly &clippedPoly = clippedPolys[i];
|
||||
POLY *thePoly = clippedPoly.poly;
|
||||
int type = clippedPoly.type;
|
||||
VERT* verts = &clippedPoly.clipVerts[0];
|
||||
const PolygonAttributes polyAttr = thePoly->getAttributes();
|
||||
const GFX3D_Clipper::TClippedPoly &clippedPoly = clippedPolys[i];
|
||||
const POLY &thePoly = *clippedPoly.poly;
|
||||
const PolygonType type = clippedPoly.type;
|
||||
const VERT *verts = &clippedPoly.clipVerts[0];
|
||||
const PolygonAttributes polyAttr = thePoly.getAttributes();
|
||||
|
||||
//HACK: backface culling
|
||||
//this should be moved to gfx3d, but first we need to redo the way the lists are built
|
||||
|
@ -1434,11 +1437,11 @@ void SoftRasterizerRenderer::performBackfaceTests()
|
|||
//a better approach
|
||||
// we have to support somewhat non-convex polygons (see NSMB world map 1st screen).
|
||||
// this version should handle those cases better.
|
||||
size_t n = type - 1;
|
||||
const size_t n = type - 1;
|
||||
float facing = (verts[0].y + verts[n].y) * (verts[0].x - verts[n].x)
|
||||
+ (verts[1].y + verts[0].y) * (verts[1].x - verts[0].x)
|
||||
+ (verts[2].y + verts[1].y) * (verts[2].x - verts[1].x);
|
||||
for(int j = 2; j < n; j++)
|
||||
for (size_t j = 2; j < n; j++)
|
||||
facing += (verts[j+1].y + verts[j].y) * (verts[j+1].x - verts[j].x);
|
||||
|
||||
polyBackfacing[i] = (facing < 0);
|
||||
|
@ -1460,7 +1463,14 @@ Render3DError SoftRasterizerRenderer::BeginRender(const GFX3D &engine)
|
|||
// Keep the current render states for later use
|
||||
this->currentRenderState = (GFX3D_State *)&engine.renderState;
|
||||
|
||||
this->_clippedPolyCount = this->performClipping(CommonSettings.GFX3D_HighResolutionInterpolateColor, engine.vertlist, engine.polylist, &engine.indexlist);
|
||||
if (CommonSettings.GFX3D_HighResolutionInterpolateColor)
|
||||
{
|
||||
this->_clippedPolyCount = this->performClipping<true>(engine.vertlist, engine.polylist, &engine.indexlist);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->_clippedPolyCount = this->performClipping<false>(engine.vertlist, engine.polylist, &engine.indexlist);
|
||||
}
|
||||
|
||||
if (rasterizerCores >= 4)
|
||||
{
|
||||
|
@ -1553,15 +1563,15 @@ Render3DError SoftRasterizerRenderer::RenderEdgeMarking(const u16 *colorTable, c
|
|||
const FragmentAttributes dstAttributes = this->_framebufferAttributes[i];
|
||||
const u8 polyID = dstAttributes.opaquePolyID;
|
||||
|
||||
if(this->edgeMarkDisabled[polyID>>3]) continue;
|
||||
if(dstAttributes.isTranslucentPoly) continue;
|
||||
if (this->edgeMarkDisabled[polyID>>3]) continue;
|
||||
if (dstAttributes.isTranslucentPoly) continue;
|
||||
|
||||
// > is used instead of != to prevent double edges
|
||||
// between overlapping polys of different IDs.
|
||||
// also note that the edge generally goes on the outside, not the inside, (maybe needs to change later)
|
||||
// and that polys with the same edge color can make edges against each other.
|
||||
|
||||
FragmentColor edgeColor = this->edgeMarkTable[polyID>>3];
|
||||
const FragmentColor edgeColor = this->edgeMarkTable[polyID>>3];
|
||||
|
||||
#define PIXOFFSET(dx,dy) ((dx)+(this->_framebufferWidth*(dy)))
|
||||
#define ISEDGE(dx,dy) ((x+(dx) < this->_framebufferWidth) && (y+(dy) < this->_framebufferHeight) && polyID > this->_framebufferAttributes[i+PIXOFFSET(dx,dy)].opaquePolyID)
|
||||
|
@ -1706,12 +1716,12 @@ Render3DError SoftRasterizerRenderer::RenderFog(const u8 *densityTable, const u3
|
|||
{
|
||||
for (size_t i = 0; i < framebufferFragmentCount; i++)
|
||||
{
|
||||
const FragmentAttributes &destFragment = _framebufferAttributes[i];
|
||||
const FragmentAttributes &destFragment = this->_framebufferAttributes[i];
|
||||
const size_t fogIndex = destFragment.depth >> 9;
|
||||
assert(fogIndex < 32768);
|
||||
const u8 fog = (destFragment.isFogged) ? this->fogTable[fogIndex] : 0;
|
||||
|
||||
FragmentColor &destFragmentColor = _framebufferColor[i];
|
||||
FragmentColor &destFragmentColor = this->_framebufferColor[i];
|
||||
destFragmentColor.r = ((128-fog)*destFragmentColor.r + r*fog)>>7;
|
||||
destFragmentColor.g = ((128-fog)*destFragmentColor.g + g*fog)>>7;
|
||||
destFragmentColor.b = ((128-fog)*destFragmentColor.b + b*fog)>>7;
|
||||
|
@ -1722,12 +1732,12 @@ Render3DError SoftRasterizerRenderer::RenderFog(const u8 *densityTable, const u3
|
|||
{
|
||||
for (size_t i = 0; i < framebufferFragmentCount; i++)
|
||||
{
|
||||
const FragmentAttributes &destFragment = _framebufferAttributes[i];
|
||||
const FragmentAttributes &destFragment = this->_framebufferAttributes[i];
|
||||
const size_t fogIndex = destFragment.depth >> 9;
|
||||
assert(fogIndex < 32768);
|
||||
const u8 fog = (destFragment.isFogged) ? this->fogTable[fogIndex] : 0;
|
||||
|
||||
FragmentColor &destFragmentColor = _framebufferColor[i];
|
||||
FragmentColor &destFragmentColor = this->_framebufferColor[i];
|
||||
destFragmentColor.a = ((128-fog)*destFragmentColor.a + a*fog)>>7;
|
||||
}
|
||||
}
|
||||
|
@ -1741,7 +1751,7 @@ Render3DError SoftRasterizerRenderer::RenderEdgeMarkingAndFog(const SoftRasteriz
|
|||
{
|
||||
for (size_t x = 0; x < this->_framebufferWidth; x++, i++)
|
||||
{
|
||||
FragmentColor &dstColor = _framebufferColor[i];
|
||||
FragmentColor &dstColor = this->_framebufferColor[i];
|
||||
const FragmentAttributes dstAttributes = this->_framebufferAttributes[i];
|
||||
const u32 depth = dstAttributes.depth;
|
||||
const u8 polyID = dstAttributes.opaquePolyID;
|
||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
|||
// SoftRasterizer-specific methods
|
||||
virtual Render3DError InitTables();
|
||||
|
||||
size_t performClipping(bool hirez, const VERTLIST *vertList, const POLYLIST *polyList, const INDEXLIST *indexList);
|
||||
template<bool useHiResInterpolate> size_t performClipping(const VERTLIST *vertList, const POLYLIST *polyList, const INDEXLIST *indexList);
|
||||
|
||||
// Base rendering methods
|
||||
virtual Render3DError BeginRender(const GFX3D &engine);
|
||||
|
|
Loading…
Reference in New Issue