[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20642] branches/soc-2009-yukishiro: multiple brush paints and light env updates.
Jingyuan Huang
jingyuan.huang at gmail.com
Fri Jun 5 05:24:07 CEST 2009
Revision: 20642
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20642
Author: yukishiro
Date: 2009-06-05 05:24:06 +0200 (Fri, 05 Jun 2009)
Log Message:
-----------
multiple brush paints and light env updates. only compiles on linux now since there is dependency on lapack
Modified Paths:
--------------
branches/soc-2009-yukishiro/CMakeLists.txt
branches/soc-2009-yukishiro/config/linux2-config.py
branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
branches/soc-2009-yukishiro/source/blender/sh/CMakeLists.txt
branches/soc-2009-yukishiro/source/blender/sh/SConscript
branches/soc-2009-yukishiro/source/blender/sh/SH_api.h
branches/soc-2009-yukishiro/source/blender/sh/intern/solve.c
Added Paths:
-----------
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/Axb.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/compiler.h
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/Axb_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/lm_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/lmbc_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/lmblec_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/lmlec_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/core/misc_core.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/lm.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/lm.h
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/lmbc.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/lmblec.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/lmlec.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/misc.c
branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/misc.h
Modified: branches/soc-2009-yukishiro/CMakeLists.txt
===================================================================
--- branches/soc-2009-yukishiro/CMakeLists.txt 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/CMakeLists.txt 2009-06-05 03:24:06 UTC (rev 20642)
@@ -184,7 +184,7 @@
SET(ZLIB_LIB z)
- SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
+ SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl -llapack")
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp")
Modified: branches/soc-2009-yukishiro/config/linux2-config.py
===================================================================
--- branches/soc-2009-yukishiro/config/linux2-config.py 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/config/linux2-config.py 2009-06-05 03:24:06 UTC (rev 20642)
@@ -182,7 +182,7 @@
##FIX_STUBS_WARNINGS = -Wno-unused
-LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
+LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++', 'lapack']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
Modified: branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c 2009-06-05 03:24:06 UTC (rev 20642)
@@ -338,36 +338,40 @@
MShCoeffs *coeffs;
int totvert = 0, i, j, index;
int num_sh = 9; // (L+1) * (L+1)
- float (*I)[3];
+ float *I[3];
float *P;
- float (*C)[3];
+ float *C[3];
// get total number of verts
while (cur_ps) {
- totvert += ps->size;
+ totvert += cur_ps->size;
cur_ps = cur_ps->next;
}
// create arrays I, P, C
// TODO: find a solver that can solve r, g, b at the same time
P = MEM_callocN(sizeof(float) * totvert * num_sh, "P");
- I = MEM_callocN(sizeof(float[3]) * totvert, "I");
- C = MEM_callocN(sizeof(float[3]) * (num_sh > totvert ? num_sh : totvert), "C");
+ I[0] = MEM_callocN(sizeof(float) * totvert, "Ir");
+ I[1] = MEM_callocN(sizeof(float) * totvert, "Ig");
+ I[2] = MEM_callocN(sizeof(float) * totvert, "Ib");
+ C[0] = MEM_callocN(sizeof(float) * num_sh, "Cr");
+ C[1] = MEM_callocN(sizeof(float) * num_sh, "Cg");
+ C[2] = MEM_callocN(sizeof(float) * num_sh, "Cb");
cur_ps = ps;
index = 0;
while (cur_ps) {
- me = get_mesh(ps->ob);
+ me = get_mesh(cur_ps->ob);
coeffs= CustomData_get_layer(&me->vdata, CD_MSHCOEFFS);
// set P, I
- for (i = 0; i < ps->size; i++) {
+ for (i = 0; i < cur_ps->size; i++) {
for (j = 0; j < num_sh; j++) {
- P[index * num_sh + j] = coeffs[ps->v_index[i]].val[j];
+ P[index * num_sh + j] = coeffs[cur_ps->v_index[i]].val[j];
}
- I[index][0] = ps->r;
- I[index][1] = ps->g;
- I[index][2] = ps->b;
+ I[0][index] = cur_ps->r;
+ I[1][index] = cur_ps->g;
+ I[2][index] = cur_ps->b;
index++;
}
@@ -380,14 +384,18 @@
// get light coeffs
LightEnv* env = get_scene_lightenv(scene);
for (i = 0; i < num_sh; i++) {
- env->shcoeffs[i][0] = C[i][0];
- env->shcoeffs[i][1] = C[i][1];
- env->shcoeffs[i][2] = C[i][2];
+ env->shcoeffs[i][0] = C[0][i];
+ env->shcoeffs[i][1] = C[1][i];
+ env->shcoeffs[i][2] = C[2][i];
}
- MEM_freeN(I);
MEM_freeN(P);
- MEM_freeN(C);
+ MEM_freeN(I[0]);
+ MEM_freeN(I[1]);
+ MEM_freeN(I[2]);
+ MEM_freeN(C[0]);
+ MEM_freeN(C[1]);
+ MEM_freeN(C[2]);
}
static void lpaint_exit(bContext *C, wmOperator *op)
Modified: branches/soc-2009-yukishiro/source/blender/sh/CMakeLists.txt
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/CMakeLists.txt 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/source/blender/sh/CMakeLists.txt 2009-06-05 03:24:06 UTC (rev 20642)
@@ -24,11 +24,11 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC intern/*.c)
+FILE(GLOB SRC intern/*.c intern/levmar/*.c)
SET(INC
- intern/include ../../../intern/guardedalloc ../blenlib ../makesdna
- extern/include ../blenkernel ../blenloader ../imbuf
+ intern/levmar ../../../intern/guardedalloc ../blenlib ../makesdna
+ ../blenkernel ../blenloader ../imbuf
)
BLENDERLIB_NOLIST(bf_sh "${SRC}" "${INC}")
Modified: branches/soc-2009-yukishiro/source/blender/sh/SConscript
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/SConscript 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/source/blender/sh/SConscript 2009-06-05 03:24:06 UTC (rev 20642)
@@ -3,8 +3,10 @@
cflags=''
sources = env.Glob('intern/*.c')
+sources += env.Glob('intern/levmar/*.c')
-incs = '#/intern/guardedalloc ../blenlib ../makesdna'
+incs = 'intern/levmar'
+incs += ' #/intern/guardedalloc ../blenlib ../makesdna'
incs += ' extern/include ../blenkernel ../blenloader ../imbuf'
env.BlenderLib ( libname = 'bf_sh', sources = sources, includes = Split(incs), libtype='core', priority=145, compileflags=cflags )
Modified: branches/soc-2009-yukishiro/source/blender/sh/SH_api.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/SH_api.h 2009-06-05 00:51:36 UTC (rev 20641)
+++ branches/soc-2009-yukishiro/source/blender/sh/SH_api.h 2009-06-05 03:24:06 UTC (rev 20642)
@@ -44,6 +44,6 @@
void SH_from_disc(int L, float *n, float area, float *shresult);
float SH_eval(float *sh, float *v);
-void SH_solve(float *P, float (*I)[3], int totvert, int num_sh, float (*C)[3]);
+void SH_solve(float *P, float *I[3], int totvert, int num_sh, float *C[3]);
#endif //_SH_API_H
Added: branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/Axb.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/Axb.c (rev 0)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/Axb.c 2009-06-05 03:24:06 UTC (rev 20642)
@@ -0,0 +1,74 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Solution of linear systems involved in the Levenberg - Marquardt
+// minimization algorithm
+// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
+// Institute of Computer Science, Foundation for Research & Technology - Hellas
+// Heraklion, Crete, Greece.
+//
+// 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.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+/********************************************************************************
+ * LAPACK-based implementations for various linear system solvers. The same core
+ * code is used with appropriate #defines to derive single and double precision
+ * solver versions, see also Axb_core.c
+ ********************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "lm.h"
+#include "misc.h"
+
+#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
+#error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
+#endif
+
+
+#ifdef LM_DBL_PREC
+/* double precision definitions */
+#define LM_REAL double
+#define LM_PREFIX d
+#define LM_CNST(x) (x)
+#ifndef HAVE_LAPACK
+#include <float.h>
+#define LM_REAL_EPSILON DBL_EPSILON
+#endif
+
+#include "core/Axb_core.c"
+
+#undef LM_REAL
+#undef LM_PREFIX
+#undef LM_CNST
+#undef LM_REAL_EPSILON
+#endif /* LM_DBL_PREC */
+
+#ifdef LM_SNGL_PREC
+/* single precision (float) definitions */
+#define LM_REAL float
+#define LM_PREFIX s
+#define __SUBCNST(x) x##F
+#define LM_CNST(x) __SUBCNST(x) // force substitution
+#ifndef HAVE_LAPACK
+#define LM_REAL_EPSILON FLT_EPSILON
+#endif
+
+#include "core/Axb_core.c"
+
+#undef LM_REAL
+#undef LM_PREFIX
+#undef __SUBCNST
+#undef LM_CNST
+#undef LM_REAL_EPSILON
+#endif /* LM_SNGL_PREC */
Added: branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/compiler.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/compiler.h (rev 0)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/levmar/compiler.h 2009-06-05 03:24:06 UTC (rev 20642)
@@ -0,0 +1,41 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Levenberg - Marquardt non-linear minimization algorithm
+// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
+// Institute of Computer Science, Foundation for Research & Technology - Hellas
+// Heraklion, Crete, Greece.
+//
+// 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.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list