DEADSOFTWARE

Merge glLight changes. Thanks, Rikku2000!
authora1batross <a1ba.omarov@gmail.com>
Wed, 16 Nov 2016 23:10:29 +0000 (02:10 +0300)
committera1batross <a1ba.omarov@gmail.com>
Wed, 16 Nov 2016 23:10:29 +0000 (02:10 +0300)
GL/gl.h
GL/gl_entries.in
GL/glesinterface.h
eglwrap.cpp
funcnames.h
nanoWrap.cpp

diff --git a/GL/gl.h b/GL/gl.h
index edf91028a413b84a2045ba1421d86f481d599f57..d027d132846c2d456e365bd6713356ae343dcd89 100644 (file)
--- a/GL/gl.h
+++ b/GL/gl.h
@@ -665,6 +665,15 @@ void glTexParameterx( GLenum target, GLenum pname, GLfixed param );
 void glGenTextures( GLsizei n, GLuint *textures );
 void glFrontFace( GLenum mode );
 
+// Rikku2000: Light
+void glLightf( GLenum light, GLenum pname, GLfloat param );
+void glLightfv( GLenum light, GLenum pname, const GLfloat *params );
+void glLightModelf( GLenum pname, GLfloat param );
+void glLightModelfv( GLenum pname, const GLfloat *params );
+void glMaterialf( GLenum face, GLenum pname, GLfloat param );
+void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
+void glColorMaterial( GLenum face, GLenum mode );
+
 //nicknekit: for xash3d
 
 void glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
index 250431c1dcfaf57e15b9e0c9f833e3dd3c435552..244acea8b446a210a9ed6e901e44fd1526a0e5d9 100644 (file)
@@ -186,6 +186,9 @@ GL_ENTRY( void, glOrtho, double left, double right, double bottom, double top, d
 GL_ENTRY( void, glDepthRange, double zNear, double zFar )
 #endif
 
+// Rikku2000: Light
+GL_ENTRY( void, glColorMaterial, GLenum face, GLenum mode )
+
 // fbo
 GL_ENTRY( void, glGenFramebuffersOES, GLsizei n, GLuint *framebuffers )
 GL_ENTRY( void, glGenRenderbuffersOES, GLsizei n, GLuint *renderbuffers )
index 8231fda870bb45aacf681f01954a2e7d57b1201c..710dfd33bbb54a959a8f2e2b39bddcb4b10cc8d1 100644 (file)
@@ -229,6 +229,10 @@ struct GlESInterface
        void( APIENTRY *glOrtho )( double left, double right, double bottom, double top, double zNear, double zFar ) S;
        void( APIENTRY *glDepthRange )( double zNear, double zFar ) S;
 #endif
+
+       // Rikku2000: Light
+       void( APIENTRY *glColorMaterial )( unsigned int face, unsigned int mode ) S;
+
        void( APIENTRY *glGenFramebuffers )( unsigned int n, unsigned int *framebuffers ) S;
        void( APIENTRY *glGenRenderbuffers )( unsigned int n, unsigned int *renderbuffers ) S;
        void( APIENTRY *glRenderbufferStorage )( unsigned int target, unsigned int internalformat, unsigned int width, unsigned int height ) S;
index a3870b758155cf8447e0c60c814800181cfbad52..208698ba71107e82b62ef3493891bed6a9a5788d 100644 (file)
@@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 #include "egl.h"
-#include "glesinterface.h"
 #include "gl.h"
+#include "glesinterface.h"
 
 #include <string.h>
 
index 8a88e2971297779b4ac7739fcf80258386411d46..cf26c5560729efee533139f1b74394ed3febb51c 100644 (file)
     "glOrtho",\r
     "glDepthRange",\r
 #endif\r
+\r
+// Rikku2000: Light\r
+       "glColorMaterial",\r
index e159046488ad94dbd24f21818ec451b63992eea3..8fc82906ff06e3413374b0022a1b409e76e2c62c 100644 (file)
@@ -44,7 +44,14 @@ struct nanoState
        GLboolean depth_test;
        GLboolean dither;
        GLboolean fog;
-       GLboolean lighti;
+       GLboolean light0;
+       GLboolean light1;
+       GLboolean light2;
+       GLboolean light3;
+       GLboolean light4;
+       GLboolean light5;
+       GLboolean light6;
+       GLboolean light7;
        GLboolean lighting;
        GLboolean line_smooth;
        GLboolean matrix_palette_oes;
@@ -87,6 +94,13 @@ static struct nanoState nanoglInitState =
         GL_FALSE,
         GL_FALSE,
         GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
+        GL_FALSE,
         GL_TRUE,
         GL_FALSE,
         GL_FALSE,
@@ -485,7 +499,7 @@ void glEnd( void )
                *ptrIndexArray++ = indexCount++;
                *ptrIndexArray++ = indexCount++;
                *ptrIndexArray++ = indexCount++;
-               int vcount = ( ( vertexCount - vertexMark ) - 3 );
+               int vcount       = ( ( vertexCount - vertexMark ) - 3 );
                for ( int count = 0; count < vcount; count++ )
                {
                        *ptrIndexArray++ = indexbase;
@@ -574,15 +588,86 @@ void glEnable( GLenum cap )
                break;
        }
        case GL_FOG:
-               //case GL_LIGHTi
+       {
+               if ( !nanoglState.fog )
                {
-                       if ( !nanoglState.fog )
-                       {
-                               nanoglState.fog = GL_TRUE;
-                               statechanged    = GL_TRUE;
-                       }
-                       break;
+                       nanoglState.fog = GL_TRUE;
+                       statechanged    = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT0:
+       {
+               if ( !nanoglState.light0 )
+               {
+                       nanoglState.light0 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT1:
+       {
+               if ( !nanoglState.light1 )
+               {
+                       nanoglState.light1 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT2:
+       {
+               if ( !nanoglState.light2 )
+               {
+                       nanoglState.light2 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT3:
+       {
+               if ( !nanoglState.light3 )
+               {
+                       nanoglState.light3 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT4:
+       {
+               if ( !nanoglState.light4 )
+               {
+                       nanoglState.light4 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT5:
+       {
+               if ( !nanoglState.light5 )
+               {
+                       nanoglState.light5 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT6:
+       {
+               if ( !nanoglState.light6 )
+               {
+                       nanoglState.light6 = GL_TRUE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT7:
+       {
+               if ( !nanoglState.light7 )
+               {
+                       nanoglState.light7 = GL_TRUE;
+                       statechanged       = GL_TRUE;
                }
+               break;
+       }
        case GL_LIGHTING:
        {
                if ( !nanoglState.lighting )
@@ -793,15 +878,86 @@ void glDisable( GLenum cap )
                break;
        }
        case GL_FOG:
-               //case GL_LIGHTi
+       {
+               if ( nanoglState.fog )
                {
-                       if ( nanoglState.fog )
-                       {
-                               nanoglState.fog = GL_FALSE;
-                               statechanged    = GL_TRUE;
-                       }
-                       break;
+                       nanoglState.fog = GL_FALSE;
+                       statechanged    = GL_TRUE;
                }
+               break;
+       }
+       case GL_LIGHT0:
+       {
+               if ( !nanoglState.light0 )
+               {
+                       nanoglState.light0 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT1:
+       {
+               if ( !nanoglState.light1 )
+               {
+                       nanoglState.light1 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT2:
+       {
+               if ( !nanoglState.light2 )
+               {
+                       nanoglState.light2 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT3:
+       {
+               if ( !nanoglState.light3 )
+               {
+                       nanoglState.light3 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT4:
+       {
+               if ( !nanoglState.light4 )
+               {
+                       nanoglState.light4 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT5:
+       {
+               if ( !nanoglState.light5 )
+               {
+                       nanoglState.light5 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT6:
+       {
+               if ( !nanoglState.light6 )
+               {
+                       nanoglState.light6 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
+       case GL_LIGHT7:
+       {
+               if ( !nanoglState.light7 )
+               {
+                       nanoglState.light7 = GL_FALSE;
+                       statechanged       = GL_TRUE;
+               }
+               break;
+       }
        case GL_LIGHTING:
        {
                if ( nanoglState.lighting )
@@ -1006,6 +1162,50 @@ void glOrtho( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat
 #endif
 }
 
+// Rikku2000: Light
+void glLightf( GLenum light, GLenum pname, GLfloat param )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glLightf( light, pname, param );
+}
+void glLightfv( GLenum light, GLenum pname, const GLfloat *params )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glLightfv( light, pname, params );
+}
+void glLightModelf( GLenum pname, GLfloat param )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glLightModelf( pname, param );
+}
+void glLightModelfv( GLenum pname, const GLfloat *params )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glLightModelfv( pname, params );
+}
+void glMaterialf( GLenum face, GLenum pname, GLfloat param )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glMaterialf( face, pname, param );
+}
+void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glMaterialfv( face, pname, params );
+}
+void glColorMaterial( GLenum face, GLenum mode )
+{
+       FlushOnStateChange( );
+
+       glEsImpl->glColorMaterial( face, mode );
+}
+
 void glMatrixMode( GLenum mode )
 {
        if ( nanoglState.matrixmode == mode )
@@ -1144,7 +1344,7 @@ void glVertex3f( GLfloat x, GLfloat y, GLfloat z )
        GLfloat *vert = (GLfloat *)ptrVertexAttribArray++;
        *vert++       = x;
        *vert++       = y;
-       *vert++ = z;
+       *vert++       = z;
 #if defined( __MULTITEXTURE_SUPPORT__ )
        memcpy( vert, &currentVertexAttrib.red, 5 * sizeof( GLfloat ) );
 #else