From dfc23c352890901dec3e69433d5efd270ba2cccc Mon Sep 17 00:00:00 2001 From: ehofman Date: Fri, 14 Jan 2005 13:36:38 +0000 Subject: [PATCH] Add a make_grayscale function and call it from make_normalmap automatically, removing the need to do it make_grayscale prior to calling make_normalmap. --- simgear/screen/texture.cxx | 28 ++++++++++++++++++++++++++-- simgear/screen/texture.hxx | 6 ++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/simgear/screen/texture.cxx b/simgear/screen/texture.cxx index 91550edb..f306bc76 100644 --- a/simgear/screen/texture.cxx +++ b/simgear/screen/texture.cxx @@ -795,7 +795,7 @@ SGTexture::ConvertUint(unsigned *array, unsigned int length) { void -SGTexture::make_monochrome(GLubyte r, GLubyte g, GLubyte b) { +SGTexture::make_monochrome(float contrast, GLubyte r, GLubyte g, GLubyte b) { if (num_colors >= 3) return; @@ -815,8 +815,32 @@ SGTexture::make_monochrome(GLubyte r, GLubyte g, GLubyte b) { } } + void -SGTexture::make_normalmap(float brightness) { +SGTexture::make_grayscale(float contrast) { + if (num_colors >= 3) + return; + + GLubyte *map = (GLubyte *)malloc (texture_width * texture_height); + for (int y=0; y