2011-04-27 11:58:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Blender Foundation.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NODES_H__
|
|
|
|
#define __NODES_H__
|
|
|
|
|
|
|
|
#include "graph.h"
|
|
|
|
|
|
|
|
#include "util_string.h"
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class ImageManager;
|
|
|
|
class Shadr;
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
/* Texture Mapping */
|
|
|
|
|
|
|
|
class TextureMapping {
|
|
|
|
public:
|
|
|
|
TextureMapping();
|
|
|
|
Transform compute_transform();
|
|
|
|
bool skip();
|
|
|
|
void compile(SVMCompiler& compiler, int offset_in, int offset_out);
|
|
|
|
|
|
|
|
float3 translation;
|
|
|
|
float3 rotation;
|
|
|
|
float3 scale;
|
|
|
|
|
2011-11-04 20:58:00 +00:00
|
|
|
enum Mapping { NONE=0, X=1, Y=2, Z=3 };
|
2011-10-12 22:42:13 +00:00
|
|
|
Mapping x_mapping, y_mapping, z_mapping;
|
|
|
|
|
|
|
|
enum Projection { FLAT, CUBE, TUBE, SPHERE };
|
|
|
|
Projection projection;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Nodes */
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class TextureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
TextureNode(const char *name) : ShaderNode(name) {}
|
|
|
|
TextureMapping tex_mapping;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ImageTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode)
|
|
|
|
~ImageTextureNode();
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
|
|
|
|
ImageManager *image_manager;
|
|
|
|
int slot;
|
|
|
|
string filename;
|
2011-05-13 14:32:08 +00:00
|
|
|
ustring color_space;
|
|
|
|
|
|
|
|
static ShaderEnum color_space_enum;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class EnvironmentTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode)
|
|
|
|
~EnvironmentTextureNode();
|
|
|
|
ShaderNode *clone() const;
|
|
|
|
|
|
|
|
ImageManager *image_manager;
|
|
|
|
int slot;
|
|
|
|
string filename;
|
2011-05-13 14:32:08 +00:00
|
|
|
ustring color_space;
|
|
|
|
|
|
|
|
static ShaderEnum color_space_enum;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class SkyTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SkyTextureNode)
|
|
|
|
|
|
|
|
float3 sun_direction;
|
|
|
|
float turbidity;
|
|
|
|
};
|
|
|
|
|
|
|
|
class OutputNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(OutputNode)
|
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class GradientTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(GradientTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
ustring type;
|
|
|
|
static ShaderEnum type_enum;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class NoiseTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(NoiseTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class VoronoiTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VoronoiTextureNode)
|
|
|
|
|
|
|
|
ustring coloring;
|
|
|
|
|
|
|
|
static ShaderEnum coloring_enum;
|
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MusgraveTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MusgraveTextureNode)
|
|
|
|
|
|
|
|
ustring type;
|
|
|
|
|
|
|
|
static ShaderEnum type_enum;
|
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class WaveTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(WaveTextureNode)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
ustring type;
|
|
|
|
static ShaderEnum type_enum;
|
|
|
|
};
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
class MagicTextureNode : public TextureNode {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MagicTextureNode)
|
|
|
|
|
|
|
|
int depth;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MappingNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MappingNode)
|
|
|
|
|
2011-10-12 22:42:13 +00:00
|
|
|
TextureMapping tex_mapping;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ConvertNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
ConvertNode(ShaderSocketType from, ShaderSocketType to);
|
|
|
|
SHADER_NODE_BASE_CLASS(ConvertNode)
|
|
|
|
|
|
|
|
ShaderSocketType from, to;
|
|
|
|
};
|
|
|
|
|
2011-12-18 15:34:06 +00:00
|
|
|
class ProxyNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
ProxyNode(ShaderSocketType from, ShaderSocketType to);
|
|
|
|
SHADER_NODE_BASE_CLASS(ProxyNode)
|
|
|
|
|
|
|
|
ShaderSocketType from, to;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class BsdfNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BsdfNode)
|
|
|
|
|
|
|
|
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2);
|
|
|
|
|
|
|
|
ClosureType closure;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WardBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(WardBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class DiffuseBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(DiffuseBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class TranslucentBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TranslucentBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class TransparentBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TransparentBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class VelvetBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VelvetBsdfNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class GlossyBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlossyBsdfNode)
|
|
|
|
|
|
|
|
ustring distribution;
|
|
|
|
static ShaderEnum distribution_enum;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GlassBsdfNode : public BsdfNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GlassBsdfNode)
|
|
|
|
|
|
|
|
ustring distribution;
|
|
|
|
static ShaderEnum distribution_enum;
|
|
|
|
};
|
|
|
|
|
|
|
|
class EmissionNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(EmissionNode)
|
|
|
|
|
|
|
|
bool total_power;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BackgroundNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BackgroundNode)
|
|
|
|
};
|
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
class HoldoutNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HoldoutNode)
|
|
|
|
};
|
|
|
|
|
2011-09-27 20:03:16 +00:00
|
|
|
class VolumeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VolumeNode)
|
|
|
|
|
|
|
|
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2);
|
|
|
|
|
|
|
|
ClosureType closure;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TransparentVolumeNode : public VolumeNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TransparentVolumeNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class IsotropicVolumeNode : public VolumeNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(IsotropicVolumeNode)
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class GeometryNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GeometryNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class TextureCoordinateNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(TextureCoordinateNode)
|
|
|
|
void attributes(AttributeRequestSet *attributes);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LightPathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(LightPathNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class ValueNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ValueNode)
|
|
|
|
|
|
|
|
float value;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ColorNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(ColorNode)
|
|
|
|
|
|
|
|
float3 value;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AddClosureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AddClosureNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
class MixClosureNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixClosureNode)
|
|
|
|
};
|
|
|
|
|
2011-12-03 23:05:35 +00:00
|
|
|
class InvertNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(InvertNode)
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MixNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MixNode)
|
|
|
|
|
|
|
|
ustring type;
|
|
|
|
static ShaderEnum type_enum;
|
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class CombineRGBNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CombineRGBNode)
|
|
|
|
};
|
|
|
|
|
2011-12-16 20:35:06 +00:00
|
|
|
class GammaNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(GammaNode)
|
|
|
|
};
|
|
|
|
|
2011-12-01 21:46:10 +00:00
|
|
|
class SeparateRGBNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(SeparateRGBNode)
|
|
|
|
};
|
|
|
|
|
2011-12-02 16:57:37 +00:00
|
|
|
class HSVNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(HSVNode)
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class AttributeNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(AttributeNode)
|
|
|
|
void attributes(AttributeRequestSet *attributes);
|
|
|
|
|
|
|
|
ustring attribute;
|
|
|
|
};
|
|
|
|
|
2011-12-02 20:36:13 +00:00
|
|
|
class CameraNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(CameraNode)
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class FresnelNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(FresnelNode)
|
|
|
|
};
|
|
|
|
|
2011-11-06 21:05:58 +00:00
|
|
|
class LayerWeightNode : public ShaderNode {
|
2011-09-16 13:14:02 +00:00
|
|
|
public:
|
2011-11-06 21:05:58 +00:00
|
|
|
SHADER_NODE_CLASS(LayerWeightNode)
|
2011-09-16 13:14:02 +00:00
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class MathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(MathNode)
|
|
|
|
|
|
|
|
ustring type;
|
|
|
|
static ShaderEnum type_enum;
|
|
|
|
};
|
|
|
|
|
2011-12-16 18:15:07 +00:00
|
|
|
class NormalNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(NormalNode)
|
|
|
|
|
|
|
|
float3 direction;
|
|
|
|
};
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class VectorMathNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(VectorMathNode)
|
|
|
|
|
|
|
|
ustring type;
|
|
|
|
static ShaderEnum type_enum;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BumpNode : public ShaderNode {
|
|
|
|
public:
|
|
|
|
SHADER_NODE_CLASS(BumpNode)
|
|
|
|
};
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* __NODES_H__ */
|
|
|
|
|