diff options
Diffstat (limited to 'intern/cycles/render/nodes.h')
-rw-r--r-- | intern/cycles/render/nodes.h | 478 |
1 files changed, 203 insertions, 275 deletions
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 8b17e455f7a..41894dce86a 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -18,6 +18,7 @@ #define __NODES_H__ #include "graph.h" +#include "node.h" #include "util_string.h" @@ -35,6 +36,7 @@ public: Transform compute_transform(); bool skip(); void compile(SVMCompiler& compiler, int offset_in, int offset_out); + int compile(SVMCompiler& compiler, ShaderInput *vector_in); void compile(OSLCompiler &compiler); int compile_begin(SVMCompiler& compiler, ShaderInput *vector_in); @@ -49,48 +51,26 @@ public: enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 }; Type type; - static NodeEnum type_enum; enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 }; Mapping x_mapping, y_mapping, z_mapping; - static NodeEnum mapping_enum; enum Projection { FLAT, CUBE, TUBE, SPHERE }; Projection projection; - static NodeEnum projection_enum; - - bool equals(const TextureMapping& other) { - return translation == other.translation && - rotation == other.rotation && - scale == other.scale && - use_minmax == other.use_minmax && - min == other.min && - max == other.max && - type == other.type && - x_mapping == other.x_mapping && - y_mapping == other.y_mapping && - z_mapping == other.z_mapping && - projection == other.projection; - } }; /* Nodes */ class TextureNode : public ShaderNode { public: - explicit TextureNode(const char *name_) : ShaderNode(name_) {} + explicit TextureNode(const NodeType *node_type) : ShaderNode(node_type) {} TextureMapping tex_mapping; - - virtual bool equals(const ShaderNode *other) { - return ShaderNode::equals(other) && - tex_mapping.equals(((const TextureNode*)other)->tex_mapping); - } }; /* Any node which uses image manager's slot should be a subclass of this one. */ class ImageSlotTextureNode : public TextureNode { public: - explicit ImageSlotTextureNode(const char *name_) : TextureNode(name_) { + explicit ImageSlotTextureNode(const NodeType *node_type) : TextureNode(node_type) { special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT; } int slot; @@ -107,7 +87,7 @@ public: int is_float; bool is_linear; bool use_alpha; - string filename; + ustring filename; void *builtin_data; NodeImageColorSpace color_space; NodeImageProjection projection; @@ -115,22 +95,14 @@ public: ExtensionType extension; float projection_blend; bool animated; + float3 vector; - static NodeEnum color_space_enum; - static NodeEnum projection_enum; - - virtual bool equals(const ShaderNode *other) { - const ImageTextureNode *image_node = (const ImageTextureNode*)other; + virtual bool equals(const ShaderNode& other) + { + const ImageTextureNode& image_node = (const ImageTextureNode&)other; return ImageSlotTextureNode::equals(other) && - use_alpha == image_node->use_alpha && - filename == image_node->filename && - builtin_data == image_node->builtin_data && - color_space == image_node->color_space && - projection == image_node->projection && - interpolation == image_node->interpolation && - extension == image_node->extension && - projection_blend == image_node->projection_blend && - animated == image_node->animated; + builtin_data == image_node.builtin_data && + animated == image_node.animated; } }; @@ -146,26 +118,20 @@ public: int is_float; bool is_linear; bool use_alpha; - string filename; + ustring filename; void *builtin_data; NodeImageColorSpace color_space; NodeEnvironmentProjection projection; InterpolationType interpolation; bool animated; + float3 vector; - static NodeEnum color_space_enum; - static NodeEnum projection_enum; - - virtual bool equals(const ShaderNode *other) { - const EnvironmentTextureNode *env_node = (const EnvironmentTextureNode*)other; + virtual bool equals(const ShaderNode& other) + { + const EnvironmentTextureNode& env_node = (const EnvironmentTextureNode&)other; return ImageSlotTextureNode::equals(other) && - use_alpha == env_node->use_alpha && - filename == env_node->filename && - builtin_data == env_node->builtin_data && - color_space == env_node->color_space && - projection == env_node->projection && - interpolation == env_node->interpolation && - animated == env_node->animated; + builtin_data == env_node.builtin_data && + animated == env_node.animated; } }; @@ -179,25 +145,20 @@ public: float3 sun_direction; float turbidity; float ground_albedo; - - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const SkyTextureNode *sky_node = (const SkyTextureNode*)other; - return TextureNode::equals(other) && - sun_direction == sky_node->sun_direction && - turbidity == sky_node->turbidity && - ground_albedo == sky_node->ground_albedo && - type == sky_node->type; - } + float3 vector; }; class OutputNode : public ShaderNode { public: SHADER_NODE_CLASS(OutputNode) + void* surface; + void* volume; + float displacement; + float3 normal; + /* Don't allow output node de-duplication. */ - virtual bool equals(const ShaderNode * /*other*/) { return false; } + virtual bool equals(const ShaderNode& /*other*/) { return false; } }; class GradientTextureNode : public TextureNode { @@ -207,18 +168,15 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeGradientType type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const GradientTextureNode *gradient_node = (const GradientTextureNode*)other; - return TextureNode::equals(other) && - type == gradient_node->type; - } + float3 vector; }; class NoiseTextureNode : public TextureNode { public: SHADER_NODE_CLASS(NoiseTextureNode) + + float scale, detail, distortion; + float3 vector; }; class VoronoiTextureNode : public TextureNode { @@ -228,13 +186,8 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeVoronoiColoring coloring; - static NodeEnum coloring_enum; - - virtual bool equals(const ShaderNode *other) { - const VoronoiTextureNode *voronoi_node = (const VoronoiTextureNode*)other; - return TextureNode::equals(other) && - coloring == voronoi_node->coloring; - } + float scale; + float3 vector; }; class MusgraveTextureNode : public TextureNode { @@ -244,13 +197,8 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeMusgraveType type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const MusgraveTextureNode *musgrave_node = (const MusgraveTextureNode*)other; - return TextureNode::equals(other) && - type == musgrave_node->type; - } + float scale, detail, dimension, lacunarity, offset, gain; + float3 vector; }; class WaveTextureNode : public TextureNode { @@ -261,15 +209,9 @@ public: NodeWaveType type; NodeWaveProfile profile; - static NodeEnum type_enum; - static NodeEnum profile_enum; - - virtual bool equals(const ShaderNode *other) { - const WaveTextureNode *wave_node = (const WaveTextureNode*)other; - return TextureNode::equals(other) && - type == wave_node->type && - profile == wave_node->profile; - } + + float scale, distortion, detail, detail_scale; + float3 vector; }; class MagicTextureNode : public TextureNode { @@ -279,18 +221,17 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } int depth; - - virtual bool equals(const ShaderNode *other) { - const MagicTextureNode *magic_node = (const MagicTextureNode*)other; - return TextureNode::equals(other) && - depth == magic_node->depth; - } + float3 vector; + float scale, distortion; }; class CheckerTextureNode : public TextureNode { public: SHADER_NODE_CLASS(CheckerTextureNode) + float3 vector, color1, color2; + float scale; + virtual int get_group() { return NODE_GROUP_LEVEL_2; } }; @@ -301,16 +242,11 @@ public: float offset, squash; int offset_frequency, squash_frequency; - virtual int get_group() { return NODE_GROUP_LEVEL_2; } + float3 color1, color2, mortar; + float scale, mortar_size, bias, brick_width, row_height; + float3 vector; - virtual bool equals(const ShaderNode *other) { - const BrickTextureNode *brick_node = (const BrickTextureNode*)other; - return TextureNode::equals(other) && - offset == brick_node->offset && - squash == brick_node->squash && - offset_frequency == brick_node->offset_frequency && - squash_frequency == brick_node->squash_frequency; - } + virtual int get_group() { return NODE_GROUP_LEVEL_2; } }; class PointDensityTextureNode : public ShaderNode { @@ -324,25 +260,20 @@ public: bool has_spatial_varying() { return true; } bool has_object_dependency() { return true; } - ImageManager *image_manager; - int slot; - string filename; + ustring filename; NodeTexVoxelSpace space; - void *builtin_data; InterpolationType interpolation; - Transform tfm; + float3 vector; - static NodeEnum space_enum; + ImageManager *image_manager; + int slot; + void *builtin_data; - virtual bool equals(const ShaderNode *other) { - const PointDensityTextureNode *point_dendity_node = (const PointDensityTextureNode*)other; + virtual bool equals(const ShaderNode& other) { + const PointDensityTextureNode& point_dendity_node = (const PointDensityTextureNode&)other; return ShaderNode::equals(other) && - filename == point_dendity_node->filename && - space == point_dendity_node->space && - builtin_data == point_dendity_node->builtin_data && - interpolation == point_dendity_node->interpolation && - tfm == point_dendity_node->tfm; + builtin_data == point_dendity_node.builtin_data; } }; @@ -351,20 +282,16 @@ public: SHADER_NODE_CLASS(MappingNode) virtual int get_group() { return NODE_GROUP_LEVEL_2; } + float3 vector; TextureMapping tex_mapping; - - virtual bool equals(const ShaderNode *other) { - const MappingNode *mapping_node = (const MappingNode*)other; - return ShaderNode::equals(other) && - tex_mapping.equals(mapping_node->tex_mapping); - } }; class RGBToBWNode : public ShaderNode { public: SHADER_NODE_CLASS(RGBToBWNode) - bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + + float3 color; }; class ConvertNode : public ShaderNode { @@ -376,28 +303,39 @@ public: SocketType::Type from, to; - virtual bool equals(const ShaderNode *other) - { - const ConvertNode *convert_node = (const ConvertNode*)other; - return ShaderNode::equals(other) && - from == convert_node->from && - to == convert_node->to; - } + union { + float value_float; + int value_int; + float3 value_color; + float3 value_vector; + float3 value_point; + float3 value_normal; + }; + ustring value_string; + +private: + static const int MAX_TYPE = 12; + static bool register_types(); + static Node* create(const NodeType *type); + static const NodeType *node_types[MAX_TYPE][MAX_TYPE]; + static bool initialized; }; class BsdfNode : public ShaderNode { public: - explicit BsdfNode(bool scattering = false); + explicit BsdfNode(const NodeType *node_type); SHADER_NODE_BASE_CLASS(BsdfNode); bool has_spatial_varying() { return true; } void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL); virtual ClosureType get_closure_type() { return closure; } + float3 color; + float3 normal; + float surface_mix_weight; ClosureType closure; - bool scattering; - virtual bool equals(const ShaderNode * /*other*/) + virtual bool equals(const ShaderNode& /*other*/) { /* TODO(sergey): With some care BSDF nodes can be de-duplicated. */ return false; @@ -408,8 +346,9 @@ class AnisotropicBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(AnisotropicBsdfNode) + float3 tangent; + float roughness, anisotropy, rotation; ClosureType distribution; - static NodeEnum distribution_enum; void attributes(Shader *shader, AttributeRequestSet *attributes); }; @@ -417,6 +356,8 @@ public: class DiffuseBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(DiffuseBsdfNode) + + float roughness; }; class TranslucentBsdfNode : public BsdfNode { @@ -434,6 +375,8 @@ public: class VelvetBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(VelvetBsdfNode) + + float sigma; }; class GlossyBsdfNode : public BsdfNode { @@ -443,8 +386,8 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class GlassBsdfNode : public BsdfNode { @@ -454,8 +397,8 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness, IOR; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class RefractionBsdfNode : public BsdfNode { @@ -465,16 +408,16 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness, IOR; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class ToonBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(ToonBsdfNode) + float smooth, size; ClosureType component; - static NodeEnum component_enum; }; class SubsurfaceScatteringNode : public BsdfNode { @@ -483,8 +426,11 @@ public: bool has_surface_bssrdf() { return true; } bool has_bssrdf_bump(); + float scale; + float3 radius; + float sharpness; + float texture_blur; ClosureType falloff; - static NodeEnum falloff_enum; }; class EmissionNode : public ShaderNode { @@ -494,6 +440,10 @@ public: virtual ClosureType get_closure_type() { return CLOSURE_EMISSION_ID; } bool has_surface_emission() { return true; } + + float3 color; + float strength; + float surface_mix_weight; }; class BackgroundNode : public ShaderNode { @@ -501,6 +451,10 @@ public: SHADER_NODE_CLASS(BackgroundNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); virtual ClosureType get_closure_type() { return CLOSURE_BACKGROUND_ID; } + + float3 color; + float strength; + float surface_mix_weight; }; class HoldoutNode : public ShaderNode { @@ -508,6 +462,9 @@ public: SHADER_NODE_CLASS(HoldoutNode) virtual int get_group() { return NODE_GROUP_LEVEL_1; } virtual ClosureType get_closure_type() { return CLOSURE_HOLDOUT_ID; } + + float surface_mix_weight; + float volume_mix_weight; }; class AmbientOcclusionNode : public ShaderNode { @@ -517,11 +474,16 @@ public: bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } virtual ClosureType get_closure_type() { return CLOSURE_AMBIENT_OCCLUSION_ID; } + + float3 normal_osl; + float3 color; + float surface_mix_weight; }; class VolumeNode : public ShaderNode { public: - SHADER_NODE_CLASS(VolumeNode) + VolumeNode(const NodeType *node_type); + SHADER_NODE_BASE_CLASS(VolumeNode) void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2); virtual int get_group() { return NODE_GROUP_LEVEL_1; } @@ -530,9 +492,12 @@ public: } virtual ClosureType get_closure_type() { return closure; } + float3 color; + float density; + float volume_mix_weight; ClosureType closure; - virtual bool equals(const ShaderNode * /*other*/) + virtual bool equals(const ShaderNode& /*other*/) { /* TODO(sergey): With some care Volume nodes can be de-duplicated. */ return false; @@ -547,6 +512,8 @@ public: class ScatterVolumeNode : public VolumeNode { public: SHADER_NODE_CLASS(ScatterVolumeNode) + + float anisotropy; }; class HairBsdfNode : public BsdfNode { @@ -554,8 +521,10 @@ public: SHADER_NODE_CLASS(HairBsdfNode) ClosureType component; - static NodeEnum component_enum; - + float offset; + float roughness_u; + float roughness_v; + float3 tangent; }; class GeometryNode : public ShaderNode { @@ -563,6 +532,8 @@ public: SHADER_NODE_CLASS(GeometryNode) void attributes(Shader *shader, AttributeRequestSet *attributes); bool has_spatial_varying() { return true; } + + float3 normal_osl; }; class TextureCoordinateNode : public ShaderNode { @@ -572,17 +543,10 @@ public: bool has_spatial_varying() { return true; } bool has_object_dependency() { return use_transform; } + float3 normal_osl; bool from_dupli; bool use_transform; Transform ob_tfm; - - virtual bool equals(const ShaderNode *other) { - const TextureCoordinateNode *texco_node = (const TextureCoordinateNode*)other; - return ShaderNode::equals(other) && - from_dupli == texco_node->from_dupli && - use_transform == texco_node->use_transform && - ob_tfm == texco_node->ob_tfm; - } }; class UVMapNode : public ShaderNode { @@ -594,13 +558,6 @@ public: ustring attribute; bool from_dupli; - - virtual bool equals(const ShaderNode *other) { - const UVMapNode *uv_map_node = (const UVMapNode*)other; - return ShaderNode::equals(other) && - attribute == uv_map_node->attribute && - from_dupli == uv_map_node->from_dupli; - } }; class LightPathNode : public ShaderNode { @@ -614,6 +571,9 @@ public: SHADER_NODE_CLASS(LightFalloffNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_2; } + + float strength; + float smooth; }; class ObjectInfoNode : public ShaderNode { @@ -648,12 +608,6 @@ public: bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); float value; - - virtual bool equals(const ShaderNode *other) { - const ValueNode *value_node = (const ValueNode*)other; - return ShaderNode::equals(other) && - value == value_node->value; - } }; class ColorNode : public ShaderNode { @@ -663,12 +617,6 @@ public: bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); float3 value; - - virtual bool equals(const ShaderNode *other) { - const ColorNode *color_node = (const ColorNode*)other; - return ShaderNode::equals(other) && - value == color_node->value; - } }; class AddClosureNode : public ShaderNode { @@ -680,11 +628,16 @@ class MixClosureNode : public ShaderNode { public: SHADER_NODE_CLASS(MixClosureNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + + float fac; }; class MixClosureWeightNode : public ShaderNode { public: SHADER_NODE_CLASS(MixClosureWeightNode); + + float weight; + float fac; }; class InvertNode : public ShaderNode { @@ -692,6 +645,9 @@ public: SHADER_NODE_CLASS(InvertNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float fac; + float3 color; }; class MixNode : public ShaderNode { @@ -701,80 +657,90 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_3; } - bool use_clamp; - NodeMix type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const MixNode *mix_node = (const MixNode*)other; - return ShaderNode::equals(other) && - use_clamp == mix_node->use_clamp && - type == mix_node->type; - } + bool use_clamp; + float3 color1; + float3 color2; + float fac; }; class CombineRGBNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineRGBNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float r, g, b; }; class CombineHSVNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineHSVNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float h, s, v; }; class CombineXYZNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineXYZNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float x, y, z; }; class GammaNode : public ShaderNode { public: SHADER_NODE_CLASS(GammaNode) - bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 color; + float gamma; }; class BrightContrastNode : public ShaderNode { public: SHADER_NODE_CLASS(BrightContrastNode) virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 color; + float bright; + float contrast; }; class SeparateRGBNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateRGBNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 color; }; class SeparateHSVNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateHSVNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 color; }; class SeparateXYZNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateXYZNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 vector; }; class HSVNode : public ShaderNode { public: SHADER_NODE_CLASS(HSVNode) + + float hue; + float saturation; + float value; + float fac; + float3 color; }; class AttributeNode : public ShaderNode { @@ -784,12 +750,6 @@ public: bool has_spatial_varying() { return true; } ustring attribute; - - virtual bool equals(const ShaderNode *other) { - const AttributeNode *color_node = (const AttributeNode*)other; - return ShaderNode::equals(other) && - attribute == color_node->attribute; - } }; class CameraNode : public ShaderNode { @@ -803,6 +763,9 @@ public: SHADER_NODE_CLASS(FresnelNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 normal; + float IOR; }; class LayerWeightNode : public ShaderNode { @@ -810,6 +773,9 @@ public: SHADER_NODE_CLASS(LayerWeightNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 normal; + float blend; }; class WireframeNode : public ShaderNode { @@ -818,22 +784,25 @@ public: bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_3; } + float size; bool use_pixel_size; }; class WavelengthNode : public ShaderNode { public: SHADER_NODE_CLASS(WavelengthNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float wavelength; }; class BlackbodyNode : public ShaderNode { public: SHADER_NODE_CLASS(BlackbodyNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float temperature; }; class MathNode : public ShaderNode { @@ -842,18 +811,10 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_1; } bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - bool use_clamp; - + float value1; + float value2; NodeMath type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const MathNode *math_node = (const MathNode*)other; - return ShaderNode::equals(other) && - use_clamp == math_node->use_clamp && - type == math_node->type; - } + bool use_clamp; }; class NormalNode : public ShaderNode { @@ -862,13 +823,7 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } float3 direction; - - virtual bool equals(const ShaderNode *other) - { - const NormalNode *normal_node = (const NormalNode*)other; - return ShaderNode::equals(other) && - direction == normal_node->direction; - } + float3 normal; }; class VectorMathNode : public ShaderNode { @@ -877,15 +832,9 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_1; } bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + float3 vector1; + float3 vector2; NodeVectorMath type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const VectorMathNode *math_node = (const VectorMathNode*)other; - return ShaderNode::equals(other) && - type == math_node->type; - } }; class VectorTransformNode : public ShaderNode { @@ -897,17 +846,7 @@ public: NodeVectorTransformType type; NodeVectorTransformConvertSpace convert_from; NodeVectorTransformConvertSpace convert_to; - - static NodeEnum type_enum; - static NodeEnum convert_space_enum; - - virtual bool equals(const ShaderNode *other) { - const VectorTransformNode *vector_transform_node = (const VectorTransformNode*)other; - return ShaderNode::equals(other) && - type == vector_transform_node->type && - convert_from == vector_transform_node->convert_from && - convert_to == vector_transform_node->convert_to; - } + float3 vector; }; class BumpNode : public ShaderNode { @@ -920,12 +859,13 @@ public: } bool invert; - - virtual bool equals(const ShaderNode *other) { - const BumpNode *bump_node = (const BumpNode*)other; - return ShaderNode::equals(other) && - invert == bump_node->invert; - } + float height; + float sample_center; + float sample_x; + float sample_y; + float3 normal; + float strength; + float distance; }; class RGBCurvesNode : public ShaderNode { @@ -933,10 +873,10 @@ public: SHADER_NODE_CLASS(RGBCurvesNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } array<float3> curves; - float min_x, max_x; + float min_x, max_x, fac; + float3 color; }; class VectorCurvesNode : public ShaderNode { @@ -944,25 +884,27 @@ public: SHADER_NODE_CLASS(VectorCurvesNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } array<float3> curves; - float min_x, max_x; + float min_x, max_x, fac; + float3 vector; }; class RGBRampNode : public ShaderNode { public: SHADER_NODE_CLASS(RGBRampNode) + virtual int get_group() { return NODE_GROUP_LEVEL_1; } + array<float3> ramp; array<float> ramp_alpha; + float fac; bool interpolate; - virtual int get_group() { return NODE_GROUP_LEVEL_1; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } }; class SetNormalNode : public ShaderNode { public: SHADER_NODE_CLASS(SetNormalNode) + float3 direction; }; class OSLNode : public ShaderNode { @@ -970,11 +912,15 @@ public: static OSLNode *create(size_t num_inputs); ~OSLNode(); + char* input_default_value(); + void add_input(ustring name, SocketType::Type type); + void add_output(ustring name, SocketType::Type type); + SHADER_NODE_BASE_CLASS(OSLNode) /* ideally we could beter detect this, but we can't query this now */ bool has_spatial_varying() { return true; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } + virtual bool equals(const ShaderNode& /*other*/) { return false; } string filepath; string bytecode_hash; @@ -991,17 +937,10 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_3; } NodeNormalMapSpace space; - static NodeEnum space_enum; - ustring attribute; - - virtual bool equals(const ShaderNode *other) - { - const NormalMapNode *normal_map_node = (const NormalMapNode*)other; - return ShaderNode::equals(other) && - space == normal_map_node->space && - attribute == normal_map_node->attribute; - } + float strength; + float3 color; + float3 normal_osl; }; class TangentNode : public ShaderNode { @@ -1013,19 +952,8 @@ public: NodeTangentDirectionType direction_type; NodeTangentAxis axis; - static NodeEnum direction_type_enum; - static NodeEnum axis_enum; - ustring attribute; - - virtual bool equals(const ShaderNode *other) - { - const TangentNode *tangent_node = (const TangentNode*)other; - return ShaderNode::equals(other) && - direction_type == tangent_node->direction_type && - axis == tangent_node->axis && - attribute == tangent_node->attribute; - } + float3 normal_osl; }; CCL_NAMESPACE_END |