[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47503] branches/soc-2012-swiss_cheese/ source/blender: Many changes and additions to the compatibility layer.
Jason Wilkins
Jason.A.Wilkins at gmail.com
Wed Jun 6 09:49:59 CEST 2012
Revision: 47503
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47503
Author: jwilkins
Date: 2012-06-06 07:49:57 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
Many changes and additions to the compatibility layer.
Specifying the current color has been separated into Color (for varying properties) and CurrentColor (for uniform properties).
GPU_primitives.h is a work in progress. It contains common geometric figures.
GPU_lighting.h is a start on a compatibility layer for lighting.
A small change is needed to font rendering (again) because of changes in the compatibility layer.
Modified Paths:
--------------
branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c
branches/soc-2012-swiss_cheese/source/blender/gpu/CMakeLists.txt
branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_compatibility.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate.c
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate_gl11.c
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate_inline.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate_internal.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate_vbo.c
Added Paths:
-----------
branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_lighting.h
branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_primitives.h
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_lighting.c
branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_primitives.c
Modified: branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c 2012-06-06 07:10:01 UTC (rev 47502)
+++ branches/soc-2012-swiss_cheese/source/blender/blenfont/intern/blf.c 2012-06-06 07:49:57 UTC (rev 47503)
@@ -556,12 +556,10 @@
if (font->flags & BLF_ROTATION)
glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
- /*if (font->shadow || font->blur)
- glGetFloatv(GL_CURRENT_COLOR, font->orig_col); */
+ if (font->shadow || font->blur)
+ gpuGetCurrentColor4fv(font->orig_col);
- /* XXX: Temporarily needed to interoperate with legacy GL */
- glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
- gpuColor4fv(font->orig_col);
+ gpuCurrentColor4fv(font->orig_col); // XXX: workaround
/* always bind the texture for the first glyph */
font->tex_bind_state = -1;
Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/CMakeLists.txt
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/CMakeLists.txt 2012-06-06 07:10:01 UTC (rev 47502)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/CMakeLists.txt 2012-06-06 07:49:57 UTC (rev 47503)
@@ -52,7 +52,9 @@
intern/gpu_immediate.c
intern/gpu_immediate_gl11.c
intern/gpu_immediate_vbo.c
+ intern/gpu_lighting.c
intern/gpu_material.c
+ intern/gpu_primitives.c
shaders/gpu_shader_material.glsl.c
shaders/gpu_shader_vertex.glsl.c
@@ -67,6 +69,8 @@
GPU_extensions.h
GPU_material.h
GPU_utility.h
+ GPU_lighting.h
+ GPU_primitives.h
intern/gpu_codegen.h
intern/gpu_deprecated.h
Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_compatibility.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_compatibility.h 2012-06-06 07:10:01 UTC (rev 47502)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_compatibility.h 2012-06-06 07:49:57 UTC (rev 47503)
@@ -33,9 +33,10 @@
#define __GPU_COMPATIBILITY_H__
#include "intern/gpu_immediate_inline.h"
+#include "GPU_lighting.h"
+#include "GPU_primitives.h" // XXX: temporary, these do not belong here
-
#ifndef GPU_MANGLE_DEPRECATED
#define GPU_MANGLE_DEPRECATED 1
#endif
Added: branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_lighting.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_lighting.h (rev 0)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_lighting.h 2012-06-06 07:49:57 UTC (rev 47503)
@@ -0,0 +1,58 @@
+/*
+ * ***** 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 GPU_lighting.h
+ * \ingroup gpu
+ */
+
+#ifndef __GPU_LIGHTING_H__
+#define __GPU_LIGHTING_H__
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+void gpuMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
+void gpuMateriali(GLenum face, GLenum pname, GLint param);
+
+void gpuEnableColorMaterial(void);
+void gpuDisableColorMaterial(void);
+
+void gpuGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* __GPU_UTILITY_H_ */
Added: branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_primitives.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_primitives.h (rev 0)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_primitives.h 2012-06-06 07:49:57 UTC (rev 47503)
@@ -0,0 +1,157 @@
+/*
+ * ***** 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 GPU_primitives.h
+ * \ingroup gpu
+ */
+
+#ifndef __GPU_PRIMITIVES_H__
+#define __GPU_PRIMITIVES_H__
+
+
+
+#include <GL/glew.h>
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+void gpuSingleLinef(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+void gpuSingleLinei(GLint x1, GLint y1, GLint x2, GLint y2);
+
+void gpuSingleRectf(GLenum mode, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+void gpuSingleRecti(GLenum mode, GLint x1, GLint y1, GLint x2, GLint y2);
+
+
+
+void gpuAppendArc(
+ GLfloat x,
+ GLfloat y,
+ GLfloat start,
+ GLfloat angle,
+ GLfloat xradius,
+ GLfloat yradius,
+ GLint nsegments);
+
+void gpuDrawArc(
+ GLfloat x,
+ GLfloat y,
+ GLfloat start,
+ GLfloat angle,
+ GLfloat xradius,
+ GLfloat yradius,
+ GLint nsegments);
+
+void gpuSingleArc(
+ GLfloat x,
+ GLfloat y,
+ GLfloat start,
+ GLfloat angle,
+ GLfloat xradius,
+ GLfloat yradius,
+ GLint nsegments);
+
+
+
+void gpuAppendFastCircleXZ(GLfloat radius);
+void gpuDrawFastCircleXZ(GLfloat radius);
+void gpuSingleFastCircleXZ(GLfloat radius);
+
+void gpuAppendFastCircleXY(GLfloat radius);
+void gpuDrawFastCircleXY(GLfloat radius);
+void gpuSingleFastCircleXY(GLfloat radius);
+
+
+void gpuAppendFastBall(
+ const GLfloat position[3],
+ float radius,
+ const GLfloat matrix[4][4]);
+
+void gpuDrawFastBall(
+ int mode,
+ const GLfloat position[3],
+ float radius,
+ const GLfloat matrix[4][4]);
+
+void gpuSingleFastBall(
+ int mode,
+ const GLfloat position[3],
+ float radius,
+ const GLfloat matrix[4][4]);
+
+
+
+void gpuAppendSpiral(
+ const GLfloat position[3],
+ float radius,
+ const GLfloat matrix[4][4],
+ int start);
+
+void gpuDrawSpiral(
+ const GLfloat position[3],
+ GLfloat radius,
+ GLfloat matrix[4][4],
+ int start);
+
+void gpuSingleSpiral(
+ const GLfloat position[3],
+ GLfloat radius,
+ GLfloat matrix[4][4],
+ int start);
+
+
+
+void gpuAppendDisk(GLfloat x, GLfloat y, GLfloat radius, GLint nsectors);
+void gpuDrawDisk(GLfloat x, GLfloat y, GLfloat radius, GLint nsectors);
+void gpuSingleDisk(GLfloat x, GLfloat y, GLfloat radius, GLint nsectors);
+
+
+
+void gpuBeginSprites(void);
+void gpuSprite3fv(const GLfloat v[3]);
+void gpuSprite3f(GLfloat x, GLfloat y, GLfloat z);
+void gpuSprite2f(GLfloat x, GLfloat y);
+void gpuSprite2fv(const GLfloat vec[2]);
+void gpuEndSprites(void);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#include "intern/gpu_primitives_inline.h"
+
+
+
+#endif /* __GPU_PRIMITIVES_H_ */
Modified: branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate.c 2012-06-06 07:10:01 UTC (rev 47502)
+++ branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_immediate.c 2012-06-06 07:49:57 UTC (rev 47503)
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
+#include <math.h>
#include <string.h>
@@ -126,7 +127,7 @@
GLint gpuImmediateLockCount(void)
{
- BLI_assert(GPU_IMMEDIATE);
+ GPU_ASSERT(GPU_IMMEDIATE);
if (!GPU_IMMEDIATE) {
return GL_FALSE;
@@ -162,30 +163,38 @@
-GPUimmediate * gpuNewImmediate(void)
+static void gpu_copy_vertex(void);
+
+
+
+GPUimmediate* gpuNewImmediate(void)
{
GPUimmediate *restrict immediate =
MEM_callocN(sizeof(GPUimmediate), "GPUimmediate");
- BLI_assert(immediate);
+ GPU_ASSERT(immediate);
immediate->format.vertexSize = 3;
- //if (GLEW_ARB_vertex_buffer_object) {
- // immediate->lockBuffer = gpu_lock_buffer_vbo;
- // immediate->beginBuffer = gpu_begin_buffer_vbo;
- // immediate->endBuffer = gpu_end_buffer_vbo;
- // immediate->unlockBuffer = gpu_unlock_buffer_vbo;
- // immediate->shutdownBuffer = gpu_shutdown_buffer_vbo;
+ immediate->copyVertex = gpu_copy_vertex;
+
+ // immediate->lockBuffer = gpu_lock_buffer_vbo;
+ // immediate->beginBuffer = gpu_begin_buffer_vbo;
+ // immediate->endBuffer = gpu_end_buffer_vbo;
+ // immediate->unlockBuffer = gpu_unlock_buffer_vbo;
+ // immediate->shutdownBuffer = gpu_shutdown_buffer_vbo;
+ // immediate->currentColor = gpu_current_color_vbo;
+ // immediate->getCurrentColor = gpu_get_current_color_vbo;
//}
//else {
- immediate->lockBuffer = gpu_lock_buffer_gl11;
- immediate->unlockBuffer = gpu_unlock_buffer_gl11;
- immediate->beginBuffer = gpu_begin_buffer_gl11;
- immediate->endBuffer = gpu_end_buffer_gl11;
- immediate->shutdownBuffer = gpu_shutdown_buffer_gl11;
+ immediate->lockBuffer = gpu_lock_buffer_gl11;
+ immediate->unlockBuffer = gpu_unlock_buffer_gl11;
+ immediate->beginBuffer = gpu_begin_buffer_gl11;
+ immediate->endBuffer = gpu_end_buffer_gl11;
+ immediate->shutdownBuffer = gpu_shutdown_buffer_gl11;
+ immediate->currentColor = gpu_current_color_gl11;
+ immediate->getCurrentColor = gpu_get_current_color_gl11;
//}
-
#if GPU_SAFETY
calc_last_texture(immediate);
#endif
@@ -204,26 +213,14 @@
void gpuDeleteImmediate(GPUimmediate *restrict immediate)
{
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list