[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45070] branches/ge_candy:
Matthew Smith
mjdietel at gmail.com
Wed Mar 21 21:21:40 CET 2012
Revision: 45070
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45070
Author: mokazon
Date: 2012-03-21 20:21:32 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Modified Paths:
--------------
branches/ge_candy/release/scripts/startup/bl_ui/properties_material.py
branches/ge_candy/source/blender/editors/interface/interface.c
branches/ge_candy/source/blender/gpu/GPU_material.h
branches/ge_candy/source/blender/gpu/intern/gpu_material.c
branches/ge_candy/source/blender/gpu/intern/gpu_shader_material.glsl
branches/ge_candy/source/blender/gpu/intern/gpu_shader_material.glsl.c
Modified: branches/ge_candy/release/scripts/startup/bl_ui/properties_material.py
===================================================================
--- branches/ge_candy/release/scripts/startup/bl_ui/properties_material.py 2012-03-21 19:13:17 UTC (rev 45069)
+++ branches/ge_candy/release/scripts/startup/bl_ui/properties_material.py 2012-03-21 20:21:32 UTC (rev 45070)
@@ -15,7 +15,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
-
+#test
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel
@@ -475,7 +475,7 @@
class MATERIAL_PT_sss(MaterialButtonsPanel, Panel):
bl_label = "Subsurface Scattering"
bl_options = {'DEFAULT_CLOSED'}
- COMPAT_ENGINES = {'BLENDER_RENDER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER','BLENDER_GAME'}
@classmethod
def poll(cls, context):
@@ -505,25 +505,28 @@
sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_active = True
split = layout.split()
+ if context.scene.render.engine != 'BLENDER_GAME':
+ col = split.column()
+ col.prop(sss, "ior")
+ col.prop(sss, "scale")
+ col.prop(sss, "color", text="")
+ col.prop(sss, "radius", text="RGB Radius", expand=True)
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Blend:")
+ sub.prop(sss, "color_factor", text="Color")
+ sub.prop(sss, "texture_factor", text="Texture")
+ sub.label(text="Scattering Weight:")
+ sub.prop(sss, "front")
+ sub.prop(sss, "back")
+ col.separator()
+ col.prop(sss, "error_threshold", text="Error")
+ else:
+ col = split.column()
+ col.prop(sss, "scale")
+ col.prop(sss, "color", text="")
+ col.prop(sss, "radius", text="RGB Radius", expand=True)
- col = split.column()
- col.prop(sss, "ior")
- col.prop(sss, "scale")
- col.prop(sss, "color", text="")
- col.prop(sss, "radius", text="RGB Radius", expand=True)
-
- col = split.column()
- sub = col.column(align=True)
- sub.label(text="Blend:")
- sub.prop(sss, "color_factor", text="Color")
- sub.prop(sss, "texture_factor", text="Texture")
- sub.label(text="Scattering Weight:")
- sub.prop(sss, "front")
- sub.prop(sss, "back")
- col.separator()
- col.prop(sss, "error_threshold", text="Error")
-
-
class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
bl_label = "Halo"
COMPAT_ENGINES = {'BLENDER_RENDER'}
Modified: branches/ge_candy/source/blender/editors/interface/interface.c
===================================================================
--- branches/ge_candy/source/blender/editors/interface/interface.c 2012-03-21 19:13:17 UTC (rev 45069)
+++ branches/ge_candy/source/blender/editors/interface/interface.c 2012-03-21 20:21:32 UTC (rev 45070)
@@ -498,7 +498,7 @@
return prec;
}
-static void ui_draw_linkline(uiLinkLine *line)
+static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines)
{
rcti rect;
@@ -509,8 +509,10 @@
rect.xmax= (line->to->x1+line->to->x2)/2.0f;
rect.ymax= (line->to->y1+line->to->y2)/2.0f;
- if(line->flag & UI_SELECT)
+ if(line->flag & UI_SELECT)
glColor3ub(100,100,100);
+ else if(hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
+ UI_ThemeColor(TH_TEXT_HI);
else
glColor3ub(0,0,0);
@@ -521,18 +523,47 @@
{
uiBut *but;
uiLinkLine *line;
-
+
+ // Draw the inactive lines (lines with neither button being hovered over).
+ // As we go, remember if we see any active or selected lines.
+ int foundSelectLine = 0;
+ int foundActiveLine = 0;
but= block->buttons.first;
while(but) {
if(but->type==LINK && but->link) {
line= but->link->lines.first;
while(line) {
- ui_draw_linkline(line);
+ if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE))
+ ui_draw_linkline(line, 0);
+ else
+ foundActiveLine = 1;
+
+ if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT))
+ foundSelectLine = 1;
+
line= line->next;
}
}
but= but->next;
}
+
+ // Draw any active lines (lines with either button being hovered over).
+ // Do this last so they appear on top of inactive lines.
+ if (foundActiveLine)
+ {
+ but= block->buttons.first;
+ while(but) {
+ if(but->type==LINK && but->link) {
+ line= but->link->lines.first;
+ while(line) {
+ if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))
+ ui_draw_linkline(line, !foundSelectLine);
+ line= line->next;
+ }
+ }
+ but= but->next;
+ }
+ }
}
/* ************** BLOCK ENDING FUNCTION ************* */
Modified: branches/ge_candy/source/blender/gpu/GPU_material.h
===================================================================
--- branches/ge_candy/source/blender/gpu/GPU_material.h 2012-03-21 19:13:17 UTC (rev 45069)
+++ branches/ge_candy/source/blender/gpu/GPU_material.h 2012-03-21 20:21:32 UTC (rev 45070)
@@ -173,6 +173,7 @@
GPU_DYNAMIC_SAMPLER_2DBUFFER = 12,
GPU_DYNAMIC_SAMPLER_2DIMAGE = 13,
GPU_DYNAMIC_SAMPLER_2DSHADOW = 14,
+ GPU_DYNAMIC_LAMP_DYNMAT = 15,
} GPUDynamicType;
typedef enum GPUDataType {
Modified: branches/ge_candy/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/ge_candy/source/blender/gpu/intern/gpu_material.c 2012-03-21 19:13:17 UTC (rev 45069)
+++ branches/ge_candy/source/blender/gpu/intern/gpu_material.c 2012-03-21 20:21:32 UTC (rev 45070)
@@ -71,6 +71,7 @@
typedef enum DynMatProperty {
DYN_LAMP_CO = 1,
DYN_LAMP_VEC = 2,
+ DYN_LAMP_MAT = 3,
DYN_LAMP_IMAT = 4,
DYN_LAMP_PERSMAT = 8,
} DynMatProperty;
@@ -114,9 +115,10 @@
float dynco[3], dynvec[3];
float obmat[4][4];
float imat[4][4];
+ float dynmat[4][4];
float dynimat[4][4];
- float spotsi, spotbl, k;
+ float spotsi, spotbl, k, area_size, area_sizey;
float dist, att1, att2;
float bias, d, clipend;
@@ -322,6 +324,8 @@
if(material->dynproperty & DYN_LAMP_IMAT)
mult_m4_m4m4(lamp->dynimat, lamp->imat, viewinv);
+ if(material->dynproperty & DYN_LAMP_MAT)
+ mult_m4_m4m4(lamp->dynmat, viewmat, lamp->obmat);
if(material->dynproperty & DYN_LAMP_PERSMAT)
mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv);
}
@@ -504,7 +508,7 @@
/* blending method */
ramp_blend(mat, fac, incol, col, type, outcol);
}
-
+
static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
{
Material *ma= shi->mat;
@@ -625,7 +629,6 @@
if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
return;
-
vn= shi->vn;
view= shi->view;
@@ -644,11 +647,9 @@
}
else {
if(lamp->type == LA_AREA) {
- float area[4][4]= {{0.0f}}, areasize= 0.0f;
-
- mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_CO;
- GPU_link(mat, "shade_inp_area", GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), vn, GPU_uniform((float*)area),
- GPU_uniform(&areasize), GPU_uniform(&lamp->k), &inp);
+ mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_CO|DYN_LAMP_MAT;
+ GPU_link(mat, "shade_inp_area", GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), vn, GPU_dynamic_uniform((float*)lamp->dynmat, GPU_DYNAMIC_LAMP_DYNMAT, lamp->ob),
+ GPU_uniform(&lamp->area_size),GPU_uniform(&lamp->area_sizey),GPU_uniform(&lamp->dist), GPU_uniform(&lamp->k), &inp);
}
is= inp; /* Lambert */
@@ -718,8 +719,14 @@
else
GPU_link(mat, "set_value", GPU_uniform(&one), &shadfac);
+ if(ma->sss_flag)
+ {
+ GPU_link(mat, "set_sss", GPU_uniform(&lamp->energy), GPU_uniform(&lamp->col), GPU_uniform(&ma->sss_scale), GPU_uniform(&ma->sss_radius), shi->rgb, i, view, lv, vn, GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), &shr->combined);
+ GPU_link(mat, "shade_add", shr->combined, shr->diff, &shr->diff);
+ }
+
if(GPU_link_changed(shi->refl) || ma->ref != 0.0f) {
- if(!(lamp->mode & LA_NO_DIFF)) {
+ if(!(lamp->mode & LA_NO_DIFF) && !(ma->sss_flag)) {
GPUNodeLink *rgb;
GPU_link(mat, "shade_mul_value", i, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &rgb);
add_to_diffuse(mat, ma, shi, is, rgb, &shr->diff);
@@ -736,7 +743,7 @@
}
else {
if(ma->spec_shader==MA_SPEC_PHONG)
- GPU_link(mat, "shade_phong_spec", vn, lv, view, shi->har, &specfac);
+ GPU_link(mat, "shade_phong_spec", GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), vn, GPU_dynamic_uniform((float*)lamp->dynmat, GPU_DYNAMIC_LAMP_DYNMAT, lamp->ob), GPU_uniform(&lamp->area_size),GPU_uniform(&lamp->area_sizey), shi->har, &specfac);
else if(ma->spec_shader==MA_SPEC_COOKTORR)
GPU_link(mat, "shade_cooktorr_spec", vn, lv, view, shi->har, &specfac);
else if(ma->spec_shader==MA_SPEC_BLINN)
@@ -761,7 +768,7 @@
GPU_link(mat, "shade_add_spec", t, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), shi->specrgb, &outcol);
GPU_link(mat, "shade_add_clamped", shr->spec, outcol, &shr->spec);
}
- }
+ }
}
add_user_list(&mat->lamps, lamp);
@@ -1021,7 +1028,7 @@
}
if(tex->type==TEX_IMAGE)
- if(gpu_do_color_management(mat))
+ if(gpu_do_color_management(mat) && !(ma->sss_flag))
GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol);
if(mtex->mapto & MAP_COL) {
@@ -1309,7 +1316,7 @@
GPU_link(mat, "set_value", GPU_uniform(&ma->amb), &shi->amb);
GPU_link(mat, "shade_view", GPU_builtin(GPU_VIEW_POSITION), &shi->view);
GPU_link(mat, "vcol_attribute", GPU_attribute(CD_MCOL, ""), &shi->vcol);
- if(gpu_do_color_management(mat))
+ if(gpu_do_color_management(mat) && !(ma->sss_flag))
GPU_link(mat, "srgb_to_linearrgb", shi->vcol, &shi->vcol);
GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref);
}
@@ -1317,11 +1324,11 @@
void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
{
GPUMaterial *mat= shi->gpumat;
- GPUNodeLink *emit, *ulinfac, *ulogfac, *mistfac;
+ GPUNodeLink *emit, *ulinfac, *ulogfac, *mistfac, *is;
Material *ma= shi->mat;
World *world= mat->scene->world;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list