diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-17 15:07:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-17 15:07:00 +0300 |
commit | 3af98b4c04b33791254a4abe0a03ed65007d5e9a (patch) | |
tree | c07a9c722b94b1cdc0648c98cefff4ea61cf6c39 /source | |
parent | 1bfe359802a105f5075e9e17c29cd832add619fd (diff) | |
parent | 6c3d8fbeb399c394831137b511c02df642fade92 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/cycles/blender/CMakeLists.txt
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/physics/physics_ops.c
Diffstat (limited to 'source')
17 files changed, 197 insertions, 40 deletions
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 839673c192b..3bc09c0173b 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1205,6 +1205,18 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_vert_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } + if ((map_vert_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any faces, " + "None of the 'Face' mappings can be used in this case"); + continue; + } if (ELEM(0, num_verts_dst, num_verts_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any vertices, cannot transfer vertex data"); @@ -1253,6 +1265,12 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_edge_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any faces, " + "None of the 'Face' mappings can be used in this case"); + continue; + } if (ELEM(0, num_edges_dst, num_edges_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any edges, cannot transfer edge data"); @@ -1312,9 +1330,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_loop_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } if (ELEM(0, num_loops_dst, num_loops_src)) { BKE_report(reports, RPT_ERROR, - "Source or destination meshes do not have any polygons, cannot transfer loop data"); + "Source or destination meshes do not have any faces, cannot transfer corner data"); continue; } @@ -1370,9 +1394,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_poly_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } if (ELEM(0, num_polys_dst, num_polys_src)) { BKE_report(reports, RPT_ERROR, - "Source or destination meshes do not have any polygons, cannot transfer poly data"); + "Source or destination meshes do not have any faces, cannot transfer face data"); continue; } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 4bed9e6476a..7c6dceeb821 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1552,7 +1552,6 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) struct RigidBodyOb *BKE_rigidbody_copy_object(Object *ob) { return NULL; } struct RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob) { return NULL; } -void BKE_rigidbody_relink_constraint(RigidBodyCon *rbc) {} void BKE_rigidbody_validate_sim_world(Scene *scene, RigidBodyWorld *rbw, bool rebuild) {} void BKE_rigidbody_calc_volume(Object *ob, float *r_vol) { if (r_vol) *r_vol = 0.0f; } void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3]) { zero_v3(r_center); } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 181f85e0909..d09d441d71b 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -1623,7 +1623,17 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i int cfra, int dflag, const char spacetype) { bGPdata *gpd_source = NULL; - + ToolSettings *ts; + bGPDbrush *brush; + if (scene) { + ts = scene->toolsettings; + brush = BKE_gpencil_brush_getactive(ts); + /* if no brushes, create default set */ + if (brush == NULL) { + BKE_gpencil_brush_init_presets(ts); + brush = BKE_gpencil_brush_getactive(ts); + } + } if (scene) { if (spacetype == SPACE_VIEW3D) { gpd_source = (scene->gpd ? scene->gpd : NULL); @@ -1634,8 +1644,6 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i } if (gpd_source) { - ToolSettings *ts = scene->toolsettings; - bGPDbrush *brush = BKE_gpencil_brush_getactive(ts); if (brush != NULL) { gp_draw_data(brush, ts->gp_sculpt.alpha, gpd_source, offsx, offsy, winx, winy, cfra, dflag); @@ -1646,8 +1654,6 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i /* scene/clip data has already been drawn, only object/track data is drawn here * if gpd_source == gpd, we don't have any object/track data and we can skip */ if (gpd_source == NULL || (gpd_source && gpd_source != gpd)) { - ToolSettings *ts = scene->toolsettings; - bGPDbrush *brush = BKE_gpencil_brush_getactive(ts); if (brush != NULL) { gp_draw_data(brush, ts->gp_sculpt.alpha, gpd, offsx, offsy, winx, winy, cfra, dflag); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ce67c24f096..241ac99edde 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -50,6 +50,7 @@ #include "BLI_math.h" #include "BLI_listbase.h" #include "BLI_linklist.h" +#include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_string_utf8.h" #include "BLI_string_cursor_utf8.h" @@ -6681,6 +6682,36 @@ void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa) UI_popup_menu_end(C, pup); } +static void ui_but_menu_add_path_operators(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop) +{ + const PropertySubType subtype = RNA_property_subtype(prop); + wmOperatorType *ot = WM_operatortype_find("WM_OT_path_open", true); + char filepath[FILE_MAX]; + char dir[FILE_MAXDIR]; + char file[FILE_MAXFILE]; + PointerRNA props_ptr; + + BLI_assert(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)); + UNUSED_VARS_NDEBUG(subtype); + + RNA_property_string_get(ptr, prop, filepath); + BLI_split_dirfile(filepath, dir, file, sizeof(dir), sizeof(file)); + + if (file[0]) { + BLI_assert(subtype == PROP_FILEPATH); + + props_ptr = uiItemFullO_ptr( + layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open File Externally"), + ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_string_set(&props_ptr, "filepath", filepath); + } + + props_ptr = uiItemFullO_ptr( + layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Location Externally"), + ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_string_set(&props_ptr, "filepath", dir); +} + static bool ui_but_menu(bContext *C, uiBut *but) { uiPopupMenu *pup; @@ -6709,6 +6740,8 @@ static bool ui_but_menu(bContext *C, uiBut *but) if (but->rnapoin.data && but->rnaprop) { PointerRNA *ptr = &but->rnapoin; PropertyRNA *prop = but->rnaprop; + const PropertyType type = RNA_property_type(prop); + const PropertySubType subtype = RNA_property_subtype(prop); bool is_anim = RNA_property_animateable(ptr, prop); bool is_editable = RNA_property_editable(ptr, prop); /*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */ @@ -6879,6 +6912,11 @@ static bool ui_but_menu(bContext *C, uiBut *but) ICON_NONE, "UI_OT_copy_data_path_button"); uiItemS(layout); + + if (type == PROP_STRING && ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)) { + ui_but_menu_add_path_operators(layout, ptr, prop); + uiItemS(layout); + } } /* Operator buttons */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 342c7182453..80d091c0fdb 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1235,8 +1235,15 @@ static void ui_item_rna_size( } } - if (!w) - w = ui_text_icon_width(layout, name, icon, 0); + if (!w) { + if (type == PROP_ENUM && icon_only) { + w = ui_text_icon_width(layout, "", ICON_BLANK1, 0); + w += 0.6f * UI_UNIT_X; + } + else { + w = ui_text_icon_width(layout, name, icon, 0); + } + } h = UI_UNIT_Y; /* increase height for arrays */ @@ -1254,7 +1261,7 @@ static void ui_item_rna_size( else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { if (type == PROP_BOOLEAN && name[0]) w += UI_UNIT_X / 5; - else if (type == PROP_ENUM) + else if (type == PROP_ENUM && !icon_only) w += UI_UNIT_X / 4; else if (type == PROP_FLOAT || type == PROP_INT) w += UI_UNIT_X * 3; diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index c9814d189a4..534ca22178e 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -369,7 +369,9 @@ struct UMArrayData { UndoMesh *um; const UndoMesh *um_ref; /* can be NULL */ }; -static void um_arraystore_compact_cb(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void um_arraystore_compact_cb(TaskPool *__restrict UNUSED(pool), + void *taskdata, + int UNUSED(threadid)) { struct UMArrayData *um_data = taskdata; um_arraystore_compact_with_info(um_data->um, um_data->um_ref); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 80515e32487..6f45013ce42 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -565,22 +565,20 @@ typedef struct ViewOpsData { static void calctrackballvec(const rcti *rect, int mx, int my, float vec[3]) { - float x, y, radius, d, z, t; - - radius = TRACKBALLSIZE; + const float radius = TRACKBALLSIZE; + const float t = radius / (float)M_SQRT2; + float x, y, z, d; /* normalize x and y */ x = BLI_rcti_cent_x(rect) - mx; x /= (float)(BLI_rcti_size_x(rect) / 4); y = BLI_rcti_cent_y(rect) - my; y /= (float)(BLI_rcti_size_y(rect) / 2); - d = sqrtf(x * x + y * y); - if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */ + if (d < t) { /* Inside sphere */ z = sqrtf(radius * radius - d * d); } else { /* On hyperbola */ - t = radius / (float)M_SQRT2; z = t * t / d; } @@ -4778,13 +4776,10 @@ static int manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH; if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH; - /* only no modifier or shift */ - if (event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH; - /* note; otherwise opengl won't work */ view3d_operator_needs_opengl(C); - if (0 == BIF_do_manipulator(C, event, op)) + if (BIF_do_manipulator(C, event, op) == 0) return OPERATOR_PASS_THROUGH; return OPERATOR_FINISHED; @@ -4805,6 +4800,9 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) /* properties to pass to transform */ Transform_Properties(ot, P_CONSTRAINT); + + RNA_def_boolean(ot->srna, "use_planar_constraint", false, "Planar Constraint", "Limit the transformation to the " + "two axes that have not been clicked (translate/scale only)"); } static int enable_manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index cfeb8af280e..0fa6841fe27 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -240,13 +240,15 @@ void view3d_keymap(wmKeyConfig *keyconf) /* only for region 3D window */ keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0); - kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0); + /* Shift+LMB behavior first, so it has priority over KM_ANY item below. */ + kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "release_confirm", true); - /* - * Doesn't work with KM_SHIFT, have to use KM_ANY and filter in invoke - * */ - // WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); - + RNA_boolean_set(kmi->ptr, "use_planar_constraint", true); + /* Using KM_ANY here to allow holding modifiers before starting to transform. */ + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0); + RNA_boolean_set(kmi->ptr, "release_confirm", true); + RNA_boolean_set(kmi->ptr, "use_planar_constraint", false); + WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index adaa487a9a3..f6fa464bb93 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1834,7 +1834,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) ARegion *ar = CTX_wm_region(C); int constraint_axis[3] = {0, 0, 0}; int val; - int shift = event->shift; + const bool use_planar = RNA_boolean_get(op->ptr, "use_planar_constraint"); if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0; if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0; @@ -1855,7 +1855,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) case MAN_TRANS_C: break; case MAN_TRANS_X: - if (shift) { + if (use_planar) { constraint_axis[1] = 1; constraint_axis[2] = 1; } @@ -1863,7 +1863,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) constraint_axis[0] = 1; break; case MAN_TRANS_Y: - if (shift) { + if (use_planar) { constraint_axis[0] = 1; constraint_axis[2] = 1; } @@ -1871,7 +1871,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) constraint_axis[1] = 1; break; case MAN_TRANS_Z: - if (shift) { + if (use_planar) { constraint_axis[0] = 1; constraint_axis[1] = 1; } @@ -1885,7 +1885,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) else if (drawflags & MAN_SCALE_C) { switch (drawflags) { case MAN_SCALE_X: - if (shift) { + if (use_planar) { constraint_axis[1] = 1; constraint_axis[2] = 1; } @@ -1893,7 +1893,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) constraint_axis[0] = 1; break; case MAN_SCALE_Y: - if (shift) { + if (use_planar) { constraint_axis[0] = 1; constraint_axis[2] = 1; } @@ -1901,7 +1901,7 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmOperator *op) constraint_axis[1] = 1; break; case MAN_SCALE_Z: - if (shift) { + if (use_planar) { constraint_axis[0] = 1; constraint_axis[1] = 1; } diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 96085a79eff..181d01e04fc 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -169,7 +169,7 @@ void DNA_sdna_free(SDNA *sdna) } MEM_freeN((void *)sdna->names); - MEM_freeN(sdna->types); + MEM_freeN((void *)sdna->types); MEM_freeN(sdna->structs); #ifdef WITH_DNA_GHASH diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c index ef2ce99c924..d5e11795fc0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -51,17 +51,37 @@ static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), bNodeE return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION)); } +static void node_shader_exec_fresnel(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) +{ + ShadeInput *shi = ((ShaderCallData *)data)->shi; + float eta = max_ff(in[0]->vec[0], 0.00001); + + float n[3]; + if (in[1]->hasinput) { + copy_v3_v3(n, in[1]->vec); + } + else { + copy_v3_v3(n, shi->vn); + } + + if(shi->use_world_space_shading) + mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); + + out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? 1/eta : eta); +} + /* node type definition */ void register_node_type_sh_fresnel(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_fresnel_in, sh_node_fresnel_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); node_type_gpu(&ntype, node_shader_gpu_fresnel); + node_type_exec(&ntype, NULL, NULL, node_shader_exec_fresnel); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c index 8cbc587e339..90e2625b961 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -45,23 +45,53 @@ static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *UNUSED(node), b { if (!in[1].link) in[1].link = GPU_builtin(GPU_VIEW_NORMAL); - else + else if (GPU_material_use_world_space_shading(mat)) { GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); + } return GPU_stack_link(mat, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION)); } +static void node_shader_exec_layer_weight(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) +{ + ShadeInput *shi = ((ShaderCallData *)data)->shi; + float blend = in[0]->vec[0]; + float eta = max_ff(1 - blend, 0.00001); + + float n[3]; + if (in[1]->hasinput) { + copy_v3_v3(n, in[1]->vec); + } + else { + copy_v3_v3(n, shi->vn); + } + + if (shi->use_world_space_shading) + mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); + + out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, shi->flippednor ? eta : 1/eta); + + float facing = fabs(dot_v3v3(shi->view, n)); + if (blend != 0.5) { + CLAMP(blend, 0.0, 0.99999); + blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend); + facing = pow(facing, blend); + } + out[1]->vec[0] = 1.0 - facing; +} + /* node type definition */ void register_node_type_sh_layer_weight(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); + node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_layer_weight_in, sh_node_layer_weight_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); node_type_gpu(&ntype, node_shader_gpu_layer_weight); + node_type_exec(&ntype, NULL, NULL, node_shader_exec_layer_weight); nodeRegisterType(&ntype); } diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 73867de6b2e..ae389fdfd2e 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -218,6 +218,8 @@ int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], float RE_lamp_get_data(struct ShadeInput *shi, struct Object *lamp_obj, float col[4], float lv[3], float *dist, float shadow[4]); void RE_instance_get_particle_info(struct ObjectInstanceRen *obi, float *index, float *age, float *lifetime, float co[3], float *size, float vel[3], float angvel[3]); +float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta); + /* shaded view and bake */ struct Render; struct Image; diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 27867eadbb4..13f16ce0bd7 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -99,7 +99,7 @@ ListBase *get_lights(struct ShadeInput *shi); float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); -float fresnel_fac(const float view[3], const float vn[3], float fresnel, float fac); +float fresnel_fac(const float view[3], const float vn[3], float fresnel, float fac); /* rayshade.c */ extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 3d6462e09a0..c4de95e863e 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -2151,3 +2151,24 @@ const float (*RE_render_current_get_matrix(int matrix_id))[4] } return NULL; } + +float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) +{ + /* compute fresnel reflectance without explicitly computing + * the refracted direction */ + float c = fabs(dot_v3v3(incoming, normal)); + float g = eta * eta - 1.0 + c * c; + float result; + + if (g > 0.0) { + g = sqrtf(g); + float A = (g - c) / (g + c); + float B = (c * (g + c) - 1.0) / (c * (g - c) + 1.0); + result = 0.5 * A * A * (1.0 + B * B); + } + else { + result = 1.0; /* TIR (no refracted component) */ + } + + return result; +}
\ No newline at end of file diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 15d230f7a0c..6b885f6d8dd 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -670,6 +670,7 @@ void RE_point_density_sample(struct Scene *scene, struct PointDensity *pd, int r void RE_point_density_free(struct PointDensity *pd) RET_NONE; void RE_instance_get_particle_info(struct ObjectInstanceRen *obi, float *index, float *age, float *lifetime, float co[3], float *size, float vel[3], float angvel[3]) RET_NONE void RE_FreeAllPersistentData(void) RET_NONE +float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) RET_NONE /* python */ struct wmOperatorType *WM_operatortype_find(const char *idname, bool quiet) RET_NULL diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 9991bf42a9f..7e8c534d7d5 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -734,6 +734,7 @@ ImageRender::ImageRender (KX_Scene *scene, KX_GameObject *observer, KX_GameObjec m_done(false), m_scene(scene), m_offscreen(NULL), + m_sync(NULL), m_observer(observer), m_mirror(mirror), m_clip(100.f) |