From 9b9921b765bca2dacc7ec0633dcf0ab1ab68be68 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 8 May 2016 00:18:32 +0200 Subject: Code refactor: nodify Cycles shader and lights. Differential Revision: https://developer.blender.org/D2016 --- intern/cycles/render/shader.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'intern/cycles/render/shader.cpp') diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 1453958a0aa..b140af66b5b 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -131,20 +131,36 @@ static void beckmann_table_build(vector& table) /* Shader */ +NODE_DEFINE(Shader) +{ + NodeType* type = NodeType::add("shader", create); + + SOCKET_BOOLEAN(use_mis, "Use MIS", true); + SOCKET_BOOLEAN(use_transparent_shadow, "Use Transparent Shadow", true); + SOCKET_BOOLEAN(heterogeneous_volume, "Heterogeneous Volume", true); + + static NodeEnum volume_sampling_method_enum; + volume_sampling_method_enum.insert("distance", VOLUME_SAMPLING_DISTANCE); + volume_sampling_method_enum.insert("equiangular", VOLUME_SAMPLING_EQUIANGULAR); + volume_sampling_method_enum.insert("multiple_importance", VOLUME_SAMPLING_MULTIPLE_IMPORTANCE); + SOCKET_ENUM(volume_sampling_method, "Volume Sampling Method", volume_sampling_method_enum, VOLUME_SAMPLING_DISTANCE); + + static NodeEnum volume_interpolation_method_enum; + volume_interpolation_method_enum.insert("linear", VOLUME_INTERPOLATION_LINEAR); + volume_interpolation_method_enum.insert("cubic", VOLUME_INTERPOLATION_CUBIC); + SOCKET_ENUM(volume_interpolation_method, "Volume Interpolation Method", volume_interpolation_method_enum, VOLUME_INTERPOLATION_LINEAR); + + return type; +} + Shader::Shader() +: Node(node_type) { - name = ""; pass_id = 0; graph = NULL; graph_bump = NULL; - use_mis = true; - use_transparent_shadow = true; - heterogeneous_volume = true; - volume_sampling_method = VOLUME_SAMPLING_DISTANCE; - volume_interpolation_method = VOLUME_INTERPOLATION_LINEAR; - has_surface = false; has_surface_transparent = false; has_surface_emission = false; -- cgit v1.2.3