Commit: f707ffdd3abddcf6ed5f8bf165bf5703d94d3d9a
Author: Antony Riakiotakis
Date:   Wed Mar 18 22:08:02 2015 +0100
Branches: temp_viewport_fx_merge
https://developer.blender.org/rBf707ffdd3abddcf6ed5f8bf165bf5703d94d3d9a

Even more missing stuffs

===================================================================

M       source/blender/gpu/CMakeLists.txt
A       source/blender/gpu/GPU_lighting.h
M       source/blender/gpu/intern/gpu_lighting.c
A       source/blender/gpu/intern/gpu_lighting.cpp
M       source/blender/gpu/intern/gpu_matrix.c

===================================================================

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index d5be4f3..2a43942 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -58,6 +58,7 @@ set(SRC
        intern/gpu_font.c
        intern/gpu_immediate.c
        intern/gpu_init_exit.c
+       intern/gpu_lighting.c
        intern/gpu_material.c
        intern/gpu_matrix.c
        intern/gpu_pixels.c
diff --git a/source/blender/gpu/GPU_lighting.h 
b/source/blender/gpu/GPU_lighting.h
new file mode 100644
index 0000000..3e3e691
--- /dev/null
+++ b/source/blender/gpu/GPU_lighting.h
@@ -0,0 +1,77 @@
+#ifndef _GPU_LIGHTING_H_
+#define _GPU_LIGHTING_H_
+
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file source/blender/gpu/GPU_lighting.h
+ *  \ingroup gpu
+ */
+
+#include "BLI_sys_types.h" /* for bool */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct GPUbasiclight {
+       float position[4];
+       float diffuse [4];
+       float specular[4];
+
+       float constant_attenuation;
+       float linear_attenuation;
+       float quadratic_attenuation;
+
+       float spot_direction[3];
+       float spot_cutoff;
+       float spot_exponent;
+} GPUbasiclight;
+
+void GPU_set_basic_material_shininess(int shininess);
+void GPU_set_basic_material_specular(const float specular[4]);
+
+/* Set lights and also applies appropriate transformations on
+   the positions and spot directions */
+void GPU_set_basic_lights(int light_count, const GPUbasiclight lights[]);
+
+int GPU_get_basic_lights(GPUbasiclight lights_out[]); /* Lights out! Get it? 
:-) */
+
+/* Set lights without transforming position or spot_direction.
+   Suitable for restoring a backup copy of previous light state.
+   Keeps position and spot position from getting transformed twice. */
+void GPU_restore_basic_lights(int light_count, const GPUbasiclight lights[]);
+
+/* A white directional light shining straight down with no attenuation or spot 
effects.
+   Same as the default legacy OpenGL light #0. */
+extern const GPUbasiclight GPU_DEFAULT_LIGHT;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GPU_LIGHTING_H_ */
\ No newline at end of file
diff --git a/source/blender/gpu/intern/gpu_lighting.c 
b/source/blender/gpu/intern/gpu_lighting.c
index 113d4f1..0f0a72f 100644
--- a/source/blender/gpu/intern/gpu_lighting.c
+++ b/source/blender/gpu/intern/gpu_lighting.c
@@ -33,17 +33,15 @@
 #define GPU_MANGLE_DEPRECATED 0 /* Allow use of deprecated OpenGL functions in 
this file */
 #endif
 
-/* my interface */
+#include "BLI_sys_types.h"
+
 #include "intern/gpu_private.h"
 
-/* my library */
 #include "GPU_extensions.h"
 #include "GPU_matrix.h"
-#include "GPU_safety.h"
+#include "GPU_debug.h"
 #include "GPU_common.h"
-
-/* internal */
-#include "intern/gpu_common_intern.h"
+#include "GPU_lighting.h"
 
 /* external */
 #include "BLI_math_vector.h"
@@ -164,19 +162,19 @@ void gpu_commit_material(void)
        const struct GPUcommon*         common   = gpu_get_common();
        const struct GPUbasicmaterial* material = &(LIGHTING.material);
 
-GPU_CHECK_NO_ERROR();
+GPU_ASSERT_NO_GL_ERRORS("");
        if (common) {
                glUniform4fv(common->material_specular,  1, material->specular);
-GPU_CHECK_NO_ERROR();
+GPU_ASSERT_NO_GL_ERRORS("");
                glUniform1f (common->material_shininess,    
(float)(material->shininess));
-GPU_CHECK_NO_ERROR();
+GPU_ASSERT_NO_GL_ERRORS("");
        }
 
 #if defined(WITH_GL_PROFILE_COMPAT)
        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR,  material->specular); // 
deprecated
        glMateriali (GL_FRONT_AND_BACK, GL_SHININESS, material->shininess); // 
deprecated
 #endif
-GPU_CHECK_NO_ERROR();
+GPU_ASSERT_NO_GL_ERRORS("");
 }
 
 
@@ -203,8 +201,8 @@ void GPU_set_basic_material_specular(const float 
specular[4])
 
 void GPU_restore_basic_lights(int light_count, const GPUbasiclight lights[])
 {
-       GPU_ASSERT(light_count >= 0);
-       GPU_ASSERT(light_count < GPU_MAX_COMMON_LIGHTS);
+       BLI_assert(light_count >= 0);
+       BLI_assert(light_count < GPU_MAX_COMMON_LIGHTS);
 
        memcpy(LIGHTING.light, lights, light_count*sizeof(GPUbasiclight));
 
diff --git a/source/blender/gpu/intern/gpu_lighting.c 
b/source/blender/gpu/intern/gpu_lighting.cpp
similarity index 99%
copy from source/blender/gpu/intern/gpu_lighting.c
copy to source/blender/gpu/intern/gpu_lighting.cpp
index 113d4f1..ae86c2a 100644
--- a/source/blender/gpu/intern/gpu_lighting.c
+++ b/source/blender/gpu/intern/gpu_lighting.cpp
@@ -34,7 +34,7 @@
 #endif
 
 /* my interface */
-#include "intern/gpu_private.h"
+#include "intern/gpu_lighting_intern.h"
 
 /* my library */
 #include "GPU_extensions.h"
diff --git a/source/blender/gpu/intern/gpu_matrix.c 
b/source/blender/gpu/intern/gpu_matrix.c
index 8856854..959da9f 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -82,9 +82,9 @@ static void checkmat(GLfloat *m)
 
        for(i = 0; i < 16; i++) {
 #if _MSC_VER
-               GPU_ASSERT(_finite(m[i]));
+               BLI_assert(_finite(m[i]));
 #else
-               GPU_ASSERT(!isinf(m[i]));
+               BLI_assert(!isinf(m[i]));
 #endif
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to