From 3ec3df2e66e591d483444ebe3d2ea76a9c5fddbf Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 12 Aug 2001 19:48:15 +0000 Subject: Added noise overlay (for marine image enhancer). --- src/opengl.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/opengl.c') diff --git a/src/opengl.c b/src/opengl.c index 4da2b6c..0a2e563 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -27,6 +27,7 @@ extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr; extern unsigned char GammaValues[256]; extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; extern int SpecialFXImageNumber; +extern int StaticImageNumber; static D3DTexture *CurrTextureHandle; @@ -603,6 +604,69 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER glEnd(); } +void DrawNoiseOverlay(int tr) +{ + GLfloat x[4], y[4], s[4], t[4], u, v; + int r, g, b; + D3DTexture *tex; + int size; + + r = 255; + g = 255; + b = 255; + + size = 256; + + tex = ImageHeaderArray[StaticImageNumber].D3DTexture; + + CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING); + // CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON); + CheckBoundTextureIsCorrect(tex->id); + // CheckDepthFuncIsCorrect(GL_ALWAYS); + glDepthFunc(GL_ALWAYS); + + u = FastRandom()&255; + v = FastRandom()&255; + + x[0] = -1.0f; + y[0] = -1.0f; + s[0] = u / 256.0f; + t[0] = v / 256.0f; + x[1] = 1.0f; + y[1] = -1.0f; + s[1] = (u + size) / 256.0f; + t[1] = v / 256.0f; + x[2] = 1.0f; + y[2] = 1.0f; + s[2] = (u + size) / 256.0f; + t[2] = (v + size) / 256.0f; + x[3] = -1.0f; + y[3] = 1.0f; + s[3] = u / 256.0f; + t[3] = (v + size) / 256.0f; + + SelectPolygonBeginType(3); /* triangles */ + glColor4ub(r, g, b, tr); + + glTexCoord2f(s[0], t[0]); + glVertex3f(x[0], y[0], 1.0f); + glTexCoord2f(s[1], t[1]); + glVertex3f(x[1], y[1], 1.0f); + glTexCoord2f(s[3], t[3]); + glVertex3f(x[3], y[3], 1.0f); + + glTexCoord2f(s[1], t[1]); + glVertex3f(x[1], y[1], 1.0f); + glTexCoord2f(s[2], t[2]); + glVertex3f(x[2], y[2], 1.0f); + glTexCoord2f(s[3], t[3]); + glVertex3f(x[3], y[3], 1.0f); + + glEnd(); + + glDepthFunc(GL_LEQUAL); +} + void D3D_PredatorScreenInversionOverlay() { CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR); -- cgit v1.3