New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fire effect shows bottom edges of grid #615
Comments
Similar, very faint effect in blob display, best seen with CO2 and HYGN. |
Blob display just blobifies whatever is in normal displays. Anyway I see the bug, I haven't looked into it at all though due to lack of time. |
Ah didn't realise blob display had fire effect. It is indeed exclusive to fire. |
This is a result of at least an easy-to-fix bug (the two inner loops should run up to and including So, what about this? diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl
index 4d7b0be4..861b5a0b 100644
--- a/src/graphics/RasterDrawMethods.inl
+++ b/src/graphics/RasterDrawMethods.inl
@@ -134,10 +134,11 @@ void PIXELMETHODS_CLASS::addpixel(int x, int y, int r, int g, int b, int a)
pixel t;
if (x<0 || y<0 || x>=VIDXRES || y>=VIDYRES)
return;
+ a += 1;
t = vid[y*(VIDXRES)+x];
- r = (a*r + 255*PIXR(t)) >> 8;
- g = (a*g + 255*PIXG(t)) >> 8;
- b = (a*b + 255*PIXB(t)) >> 8;
+ r = (a*r + 256*PIXR(t)) >> 8;
+ g = (a*g + 256*PIXG(t)) >> 8;
+ b = (a*b + 256*PIXB(t)) >> 8;
if (r>255)
r = 255;
if (g>255)
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index 1b79994c..516a52e3 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -1119,8 +1119,8 @@ void Renderer::prepare_alpha(int size, float intensity)
memset(temp, 0, sizeof(temp));
for (x=0; x<CELL; x++)
for (y=0; y<CELL; y++)
- for (i=-CELL; i<CELL; i++)
- for (j=-CELL; j<CELL; j++)
+ for (i=-CELL; i<=CELL; i++)
+ for (j=-CELL; j<=CELL; j++)
temp[y+CELL+j][x+CELL+i] += expf(-0.1f*(i*i+j*j));
for (x=0; x<CELL*3; x++)
for (y=0; y<CELL*3; y++) EDIT: Nvm the ghost grid is still visible, I blame the |
Would it be possible to just get rid of the approximation and see what performance hit it entails? (Probably very little. It'd take longer to get a value from L3 cache than to do a division.) |
I think my approach for getting around the problematic approximation (see above) is nice, I just didn't feel like hunting all of them down. Maybe later, or maybe someone else will. |
Seems reproducible with any gas, but BOYL works very well.
Fill a large area with gas, make sure "fire display" is active, and you'll note vertical and horizontal lines running along the bottom and right sides of the 4x4 pressure/wall grid (i.e. one above and to the left of what the grid display shows).
The text was updated successfully, but these errors were encountered: