Add resolution subdivision
This commit is contained in:
parent
ccbb9dfdc3
commit
e47704dbb0
3 changed files with 62 additions and 39 deletions
38
renderer.h
38
renderer.h
|
@ -19,8 +19,8 @@
|
|||
for far away areas with "something" we just draw some 2D rectangles.
|
||||
*/
|
||||
|
||||
#define S3L_RESOLUTION_X LCR_SETTING_RESOLUTION_X
|
||||
#define S3L_RESOLUTION_Y LCR_SETTING_RESOLUTION_Y
|
||||
#define S3L_RESOLUTION_X LCR_EFFECTIVE_RESOLUTION_X
|
||||
#define S3L_RESOLUTION_Y LCR_EFFECTIVE_RESOLUTION_Y
|
||||
#define S3L_PIXEL_FUNCTION _LCR_pixelFunc3D
|
||||
#define S3L_PERSPECTIVE_CORRECTION 2
|
||||
#define S3L_NEAR_CROSS_STRATEGY 1
|
||||
|
@ -160,14 +160,14 @@ void LCR_rendererSetGhostVisibility(uint8_t visible)
|
|||
void _LCR_rendererDrawFontPixel(int x, int y, uint16_t color)
|
||||
{
|
||||
#if LCR_FONT_PIXEL_SIZE == 1
|
||||
LCR_drawPixelXYSafe(x,y,color);
|
||||
LCR_gameDrawPixelXYSafe(x,y,color);
|
||||
#else
|
||||
if ((x >= 0) && (y >= 0) &&
|
||||
(x < LCR_EFFECTIVE_RESOLUTION_X - LCR_FONT_PIXEL_SIZE) &&
|
||||
(y < LCR_EFFECTIVE_RESOLUTION_Y - LCR_FONT_PIXEL_SIZE))
|
||||
for (int i = x; i < x + LCR_FONT_PIXEL_SIZE; ++i)
|
||||
for (int j = y; j < y + LCR_FONT_PIXEL_SIZE; ++j)
|
||||
LCR_drawPixelXYSafe(i,j,color);
|
||||
LCR_gameDrawPixelXYSafe(i,j,color);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
LCR_renderer.flatAndTransparent += pixel->triangleIndex % 4;
|
||||
}
|
||||
|
||||
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
|
||||
LCR_gameDrawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
|
||||
|
||||
#else // LCR_SETTING_POTATO_GRAPHICS
|
||||
// once we get a new triangle, we precompute things for it:
|
||||
|
@ -432,7 +432,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
if (LCR_renderer.flatAndTransparent)
|
||||
{
|
||||
if (pixel->x % 2 == pixel->y % 2)
|
||||
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
|
||||
LCR_gameDrawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
|
||||
else
|
||||
S3L_zBufferWrite(pixel->x,pixel->y,S3L_MAX_DEPTH);
|
||||
/* ^ Clear z-buffer if we didn't draw the pixel. Without this further
|
||||
|
@ -470,7 +470,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
LCR_renderer.texSubsampleCount--;
|
||||
#endif
|
||||
|
||||
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,_LCR_pixelColor);
|
||||
LCR_gameDrawPixelXYUnsafe(pixel->x,pixel->y,_LCR_pixelColor);
|
||||
#endif // LCR_SETTING_POTATO_GRAPHICS
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
|
|||
for (unsigned int i = 0; i < h; ++i)
|
||||
{
|
||||
for (unsigned int j = ((i % 2) == parity); j < w; j += 2)
|
||||
LCR_drawPixel(index + j,color);
|
||||
LCR_gameDrawPixel(index + j,color);
|
||||
|
||||
index += LCR_EFFECTIVE_RESOLUTION_X;
|
||||
}
|
||||
|
@ -1265,7 +1265,7 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
|
|||
{
|
||||
for (unsigned int j = 0; j < w; ++j)
|
||||
{
|
||||
LCR_drawPixel(index,color);
|
||||
LCR_gameDrawPixel(index,color);
|
||||
index++;
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
|
|||
{
|
||||
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
|
||||
{
|
||||
LCR_drawPixel(pixelIndex,topColor);
|
||||
LCR_gameDrawPixel(pixelIndex,topColor);
|
||||
pixelIndex++;
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
|
|||
|
||||
while (x < LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(startIndex + x,color);
|
||||
LCR_gameDrawPixel(startIndex + x,color);
|
||||
x += 2 * LCR_IMAGE_SIZE * LCR_SETTING_SKY_SIZE;
|
||||
}
|
||||
}
|
||||
|
@ -1431,7 +1431,7 @@ void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
|
|||
if (y >= 0)
|
||||
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
|
||||
{
|
||||
LCR_drawPixel(pixelIndex,topColor);
|
||||
LCR_gameDrawPixel(pixelIndex,topColor);
|
||||
pixelIndex++;
|
||||
}
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
|
|||
{
|
||||
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
|
||||
{
|
||||
LCR_drawPixel(pixelIndex,bottomColor);
|
||||
LCR_gameDrawPixel(pixelIndex,bottomColor);
|
||||
pixelIndex++;
|
||||
}
|
||||
|
||||
|
@ -1775,7 +1775,7 @@ void LCR_rendererBlitImage(uint8_t index, unsigned int x, unsigned int y,
|
|||
uint16_t color = LCR_getNextImagePixel();
|
||||
|
||||
if (color != transparentColor)
|
||||
LCR_drawPixel(i,color);
|
||||
LCR_gameDrawPixel(i,color);
|
||||
|
||||
i += scale;
|
||||
}
|
||||
|
@ -1795,7 +1795,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
|
||||
while (i < stripHeight * LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(i,0x4a8c
|
||||
LCR_gameDrawPixel(i,0x4a8c
|
||||
#if LCR_SETTING_POTATO_GRAPHICS
|
||||
);
|
||||
#else
|
||||
|
@ -1811,7 +1811,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
#if LCR_SETTING_POTATO_GRAPHICS
|
||||
while (i < stripHeight * LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(i,0x73ae);
|
||||
LCR_gameDrawPixel(i,0x73ae);
|
||||
++i;
|
||||
}
|
||||
#else
|
||||
|
@ -1822,7 +1822,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
|
||||
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
|
||||
{
|
||||
LCR_drawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit &&
|
||||
LCR_gameDrawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit &&
|
||||
(x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 + limit)
|
||||
? 0x73ae : 0x31a6) + ((x + y) % 8));
|
||||
i++;
|
||||
|
@ -1832,7 +1832,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
|
||||
while (i < LCR_EFFECTIVE_RESOLUTION_Y * LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(i,0xce9c
|
||||
LCR_gameDrawPixel(i,0xce9c
|
||||
#if LCR_SETTING_POTATO_GRAPHICS
|
||||
);
|
||||
#else
|
||||
|
@ -1862,7 +1862,7 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
for (int y = i - 10; y < i + LCR_rendererComputeTextHeight(3) + 10; ++y)
|
||||
for (int x = LCR_EFFECTIVE_RESOLUTION_X / 4;
|
||||
x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4; ++x)
|
||||
LCR_drawPixelXYSafe(x,y,0x5c1b + 4 * ((x & 0x10) == (y & 0x10)));
|
||||
LCR_gameDrawPixelXYSafe(x,y,0x5c1b + 4 * ((x & 0x10) == (y & 0x10)));
|
||||
|
||||
LCR_rendererDrawText(s,(LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(s,3)) / 2,i,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue