[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11246] branches/soc-2007-maike/source/ blender: +Defmaterial now works
Miguel Torres Lima
torreslima at gmail.com
Thu Jul 12 19:32:44 CEST 2007
Revision: 11246
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11246
Author: maike
Date: 2007-07-12 19:32:44 +0200 (Thu, 12 Jul 2007)
Log Message:
-----------
+Defmaterial now works
+Created colorband changes events
+Created colorband parallel structure and function prototypes
Modified Paths:
--------------
branches/soc-2007-maike/source/blender/include/BIF_glsl_material.h
branches/soc-2007-maike/source/blender/include/butspace.h
branches/soc-2007-maike/source/blender/src/butspace.c
branches/soc-2007-maike/source/blender/src/buttons_shading.c
branches/soc-2007-maike/source/blender/src/glsl_drawobject.c
branches/soc-2007-maike/source/blender/src/glsl_material.c
branches/soc-2007-maike/source/blender/src/glutil.c
Added Paths:
-----------
branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h
branches/soc-2007-maike/source/blender/src/glsl_colorband.c
Added: branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h
===================================================================
--- branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h (rev 0)
+++ branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h 2007-07-12 17:32:44 UTC (rev 11246)
@@ -0,0 +1,29 @@
+struct ColorBand;
+struct Material;
+
+/* -------------------------------------------------------- */
+
+struct GLSL_ColorBand_
+{
+ struct ColorBand *colorband;
+ short index;
+#ifdef __APPLE__
+ usigned long texid;
+#else
+ unsigned int texid;
+#endif
+
+ void (*free)(struct GLSL_ColorBand_ *colorband);
+};
+
+
+typedef struct GLSL_ColorBand_ *GLSL_ColorBand;
+
+
+/* -------------------------------------------------------- */
+
+void glsl_colorbands_state(struct Material *mat);
+void glsl_colorband_add(struct Material *mat);
+void glsl_colorband_del(struct Material *mat);
+void glsl_colorband_create_tex(struct Material *mat);
+void glsl_colorband_uniforms(struct Material *mat);
Modified: branches/soc-2007-maike/source/blender/include/BIF_glsl_material.h
===================================================================
--- branches/soc-2007-maike/source/blender/include/BIF_glsl_material.h 2007-07-12 15:32:15 UTC (rev 11245)
+++ branches/soc-2007-maike/source/blender/include/BIF_glsl_material.h 2007-07-12 17:32:44 UTC (rev 11246)
@@ -10,6 +10,7 @@
struct Material;
struct Object;
struct GHash;
+struct GLSL_ColorBand_;
/* ------------------------------------------------ */
@@ -26,6 +27,9 @@
void (*unlink)(struct GLSL_Material_ * material, struct Material *mat);
void (*free)(struct GLSL_Material_ * material, struct Material *mat);
+
+ struct GLSL_ColorBand_ *diff_ramp;
+ struct GLSL_ColorBand_ *spec_ramp;
};
Modified: branches/soc-2007-maike/source/blender/include/butspace.h
===================================================================
--- branches/soc-2007-maike/source/blender/include/butspace.h 2007-07-12 15:32:15 UTC (rev 11245)
+++ branches/soc-2007-maike/source/blender/include/butspace.h 2007-07-12 17:32:44 UTC (rev 11246)
@@ -226,6 +226,12 @@
#define B_MATDIFF 1230
#define B_MATSPEC 1231
+#define B_MAT_UNIFS 1232
+#define B_MAT_CB_ADD 1233
+#define B_MAT_CB_DEL 1234
+#define B_MAT_CB_REDR 1235
+#define B_MAT_CB_REWR 1236
+#define B_MAT_CB_UNIFS 1237
/* *********************** */
#define B_TEXBUTS 1400
Modified: branches/soc-2007-maike/source/blender/src/butspace.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/butspace.c 2007-07-12 15:32:15 UTC (rev 11245)
+++ branches/soc-2007-maike/source/blender/src/butspace.c 2007-07-12 17:32:44 UTC (rev 11246)
@@ -556,7 +556,27 @@
do_matbuts(event);
do_global_buttons(event);
}
-
+
+ else if(event == B_MAT_UNIFS){
+ do_matbuts(event);
+ }
+ else if(event == B_MAT_CB_ADD){
+ do_matbuts(event);
+ }
+ else if(event == B_MAT_CB_DEL){
+ do_matbuts(event);
+ }
+ else if(event == B_MAT_CB_REWR){
+ do_matbuts(event);
+ }
+ else if(event == B_MAT_CB_REDR){
+ do_matbuts(event);
+ }
+ else if(event == B_MAT_CB_UNIFS){
+ do_matbuts(event);
+ }
+
+
else if(event<=100) {
do_global_buttons(event);
}
Modified: branches/soc-2007-maike/source/blender/src/buttons_shading.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/buttons_shading.c 2007-07-12 15:32:15 UTC (rev 11245)
+++ branches/soc-2007-maike/source/blender/src/buttons_shading.c 2007-07-12 17:32:44 UTC (rev 11246)
@@ -103,6 +103,7 @@
#include "BIF_toets.h"
#include "BIF_glsl_light.h"
#include "BIF_glsl_material.h"
+#include "BIF_glsl_colorband.h"
#include "mydevice.h"
#include "blendef.h"
@@ -1436,31 +1437,60 @@
if(coba==NULL) return;
- bt= uiDefBut(block, BUT, redraw, "Add", 80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
- uiButSetFunc(bt, colorband_add_cb, coba, NULL);
- uiDefButS(block, NUM, redraw, "Cur:", 117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
- bt= uiDefBut(block, BUT, redraw, "Del", 199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
- uiButSetFunc(bt, colorband_del_cb, coba, NULL);
- uiDefButS(block, ROW, redraw, "E", 236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
- uiDefButS(block, ROW, redraw, "C", 252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
- uiDefButS(block, ROW, redraw, "L", 268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
- uiDefButS(block, ROW, redraw, "S", 284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
-
- uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
-
- cbd= coba->data + coba->cur;
-
- uiBlockBeginAlign(block);
- bt= uiDefButF(block, NUM, redraw, "Pos", xoffs,40+yoffs,110,20, &cbd->pos, 0.0, 1.0, 10, 0, "Sets the position of the active color");
- uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
- uiDefButF(block, COL, redraw, "", xoffs,20+yoffs,110,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
- uiDefButF(block, NUMSLI, redraw, "A ", xoffs,yoffs,110,20, &cbd->a, 0.0, 1.0, 10, 0, "Sets the alpha value for this position");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, redraw, "R ", 115+xoffs,40+yoffs,185,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Sets the red value for the active color");
- uiDefButF(block, NUMSLI, redraw, "G ", 115+xoffs,20+yoffs,185,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Sets the green value for the active color");
- uiDefButF(block, NUMSLI, redraw, "B ", 115+xoffs,yoffs,185,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Sets the blue value for the active color");
- uiBlockEndAlign(block);
+ if(redraw == B_TEXREDR_PRV){
+ bt= uiDefBut(block, BUT, redraw, "Add", 80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
+ uiButSetFunc(bt, colorband_add_cb, coba, NULL);
+ uiDefButS(block, NUM, redraw, "Cur:", 117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
+ bt= uiDefBut(block, BUT, redraw, "Del", 199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
+ uiButSetFunc(bt, colorband_del_cb, coba, NULL);
+ uiDefButS(block, ROW, redraw, "E", 236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
+ uiDefButS(block, ROW, redraw, "C", 252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
+ uiDefButS(block, ROW, redraw, "L", 268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
+ uiDefButS(block, ROW, redraw, "S", 284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
+
+ uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
+
+ cbd= coba->data + coba->cur;
+
+ uiBlockBeginAlign(block);
+ bt= uiDefButF(block, NUM, redraw, "Pos", xoffs,40+yoffs,110,20, &cbd->pos, 0.0, 1.0, 10, 0, "Sets the position of the active color");
+ uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
+ uiDefButF(block, COL, redraw, "", xoffs,20+yoffs,110,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
+ uiDefButF(block, NUMSLI, redraw, "A ", xoffs,yoffs,110,20, &cbd->a, 0.0, 1.0, 10, 0, "Sets the alpha value for this position");
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUMSLI, redraw, "R ", 115+xoffs,40+yoffs,185,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Sets the red value for the active color");
+ uiDefButF(block, NUMSLI, redraw, "G ", 115+xoffs,20+yoffs,185,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Sets the green value for the active color");
+ uiDefButF(block, NUMSLI, redraw, "B ", 115+xoffs,yoffs,185,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Sets the blue value for the active color");
+ uiBlockEndAlign(block);
+ }
+ else{
+ bt= uiDefBut(block, BUT, B_MAT_CB_REDR, "Add", 80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
+ uiButSetFunc(bt, colorband_add_cb, coba, NULL);
+ uiDefButS(block, NUM, redraw, "Cur:", 117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
+ bt= uiDefBut(block, BUT, B_MAT_CB_REDR, "Del", 199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
+ uiButSetFunc(bt, colorband_del_cb, coba, NULL);
+ uiDefButS(block, ROW, B_MAT_CB_REWR, "E", 236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
+ uiDefButS(block, ROW, B_MAT_CB_REWR, "C", 252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
+ uiDefButS(block, ROW, B_MAT_CB_REWR, "L", 268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
+ uiDefButS(block, ROW, B_MAT_CB_REWR, "S", 284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
+
+ uiDefBut(block, BUT_COLORBAND, B_MAT_CB_REDR, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
+
+ cbd= coba->data + coba->cur;
+
+ uiBlockBeginAlign(block);
+ bt= uiDefButF(block, NUM, B_MAT_CB_REDR, "Pos", xoffs,40+yoffs,110,20, &cbd->pos, 0.0, 1.0, 10, 0, "Sets the position of the active color");
+ uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
+ uiDefButF(block, COL, B_MAT_CB_REDR, "", xoffs,20+yoffs,110,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
+ uiDefButF(block, NUMSLI, B_MAT_CB_REDR, "A ", xoffs,yoffs,110,20, &cbd->a, 0.0, 1.0, 10, 0, "Sets the alpha value for this position");
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUMSLI, B_MAT_CB_REDR, "R ", 115+xoffs,40+yoffs,185,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Sets the red value for the active color");
+ uiDefButF(block, NUMSLI, B_MAT_CB_REDR, "G ", 115+xoffs,20+yoffs,185,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Sets the green value for the active color");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list