[Bf-committers] Patch for Specularity

Kester Maddock bf-committers@blender.org
Thu, 02 Oct 2003 21:11:11 +1200


Applied to tuhopuu2/kesterji.

Martin wrote:

>Hi - I hope the excitement over 2.28C has died down a little, and that
>people are n the mood for a little light maintenance ...
>
>Sirdude asked me to send this patch for separate specular colour to him - I
>hope this is as good.
>
>Specular lighting in preview mode.
>-----------------------------------
>
>The mode Textured does not take into account the specularity of the
>material.  This is easily possible by adding to the function
>set_draw_settings_cached in drawmesh.c
>
>This sets the lighting model.  It should be done once per render (or at
>program startup).  It relies on GL Extension which was introduced in GL 1.2.
>Obviously Microsoft (being Microsoft) only strictly support the oldest
>possible version of GL (1.1), but most modern graphics cards do in fact fact
>support something a little more modern.
>
>However, I need to define GL_LIGHT_MODEL_COLOR_CONTROL_EXT and
>GL_SEPARATE_SPECULAR_COLOR_EXT somewhere, and don't really want them
>hardcoded in this file.
>
>They are included in SDL_opengl.h, but this breaks other things.  I hope
>someone can sort out a more elegant way of doing it that these hardcoded
>#defines.
>
>What I would like to see somewhere is a runtime initialisation to get the
>OpenGL exptension string, check that this extension is supported and set a
>flag somewhere.  I don't think it should be a compile-time option, as this
>means distributing BlenderPlayer executables might not work.
>
>This set the lighting model to use Separate Specular colour, otherwise
>textures replace the calculated specular colour.
>
>Place this call in RAS_openGLRasterizer.cpp, in Myinit_gl_stuff (line 64)
>
>glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT,
>GL_SEPARATE_SPECULAR_COLOR_EXT);
>
>Place this call in drawmesh.c, draw_settings_cached(), line 746 after
>glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); and this sets the
>specularity.
>
>glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, ma->har);
>
>In contrast with the renderer in Blender, values above about 20 cannot be
>seen.  This also causes BlenderPlayer to show objects with specular
>highlights.
>
>I'm afraid I don't have a good diff output for this, as I have been messing
>about quite a lot in this file.
>
>
>
>Martin
>
>
>
>
>
>_______________________________________________
>Bf-committers mailing list
>Bf-committers@blender.org
>http://www.blender.org/mailman/listinfo/bf-committers
>
>
>  
>