Blender V2.61 - r43446
|
00001 /* 00002 * Copyright 2011, Blender Foundation. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef __NODES_H__ 00020 #define __NODES_H__ 00021 00022 #include "graph.h" 00023 00024 #include "util_string.h" 00025 00026 CCL_NAMESPACE_BEGIN 00027 00028 class ImageManager; 00029 class Shadr; 00030 00031 /* Texture Mapping */ 00032 00033 class TextureMapping { 00034 public: 00035 TextureMapping(); 00036 Transform compute_transform(); 00037 bool skip(); 00038 void compile(SVMCompiler& compiler, int offset_in, int offset_out); 00039 00040 float3 translation; 00041 float3 rotation; 00042 float3 scale; 00043 00044 enum Mapping { NONE=0, X=1, Y=2, Z=3 }; 00045 Mapping x_mapping, y_mapping, z_mapping; 00046 00047 enum Projection { FLAT, CUBE, TUBE, SPHERE }; 00048 Projection projection; 00049 }; 00050 00051 /* Nodes */ 00052 00053 class TextureNode : public ShaderNode { 00054 public: 00055 TextureNode(const char *name) : ShaderNode(name) {} 00056 TextureMapping tex_mapping; 00057 }; 00058 00059 class ImageTextureNode : public TextureNode { 00060 public: 00061 SHADER_NODE_NO_CLONE_CLASS(ImageTextureNode) 00062 ~ImageTextureNode(); 00063 ShaderNode *clone() const; 00064 00065 ImageManager *image_manager; 00066 int slot; 00067 string filename; 00068 ustring color_space; 00069 00070 static ShaderEnum color_space_enum; 00071 }; 00072 00073 class EnvironmentTextureNode : public TextureNode { 00074 public: 00075 SHADER_NODE_NO_CLONE_CLASS(EnvironmentTextureNode) 00076 ~EnvironmentTextureNode(); 00077 ShaderNode *clone() const; 00078 00079 ImageManager *image_manager; 00080 int slot; 00081 string filename; 00082 ustring color_space; 00083 00084 static ShaderEnum color_space_enum; 00085 }; 00086 00087 class SkyTextureNode : public TextureNode { 00088 public: 00089 SHADER_NODE_CLASS(SkyTextureNode) 00090 00091 float3 sun_direction; 00092 float turbidity; 00093 }; 00094 00095 class OutputNode : public ShaderNode { 00096 public: 00097 SHADER_NODE_CLASS(OutputNode) 00098 }; 00099 00100 class GradientTextureNode : public TextureNode { 00101 public: 00102 SHADER_NODE_CLASS(GradientTextureNode) 00103 00104 ustring type; 00105 static ShaderEnum type_enum; 00106 }; 00107 00108 class NoiseTextureNode : public TextureNode { 00109 public: 00110 SHADER_NODE_CLASS(NoiseTextureNode) 00111 }; 00112 00113 class VoronoiTextureNode : public TextureNode { 00114 public: 00115 SHADER_NODE_CLASS(VoronoiTextureNode) 00116 00117 ustring coloring; 00118 00119 static ShaderEnum coloring_enum; 00120 }; 00121 00122 class MusgraveTextureNode : public TextureNode { 00123 public: 00124 SHADER_NODE_CLASS(MusgraveTextureNode) 00125 00126 ustring type; 00127 00128 static ShaderEnum type_enum; 00129 }; 00130 00131 class WaveTextureNode : public TextureNode { 00132 public: 00133 SHADER_NODE_CLASS(WaveTextureNode) 00134 00135 ustring type; 00136 static ShaderEnum type_enum; 00137 }; 00138 00139 class MagicTextureNode : public TextureNode { 00140 public: 00141 SHADER_NODE_CLASS(MagicTextureNode) 00142 00143 int depth; 00144 }; 00145 00146 class CheckerTextureNode : public TextureNode { 00147 public: 00148 SHADER_NODE_CLASS(CheckerTextureNode) 00149 }; 00150 00151 class MappingNode : public ShaderNode { 00152 public: 00153 SHADER_NODE_CLASS(MappingNode) 00154 00155 TextureMapping tex_mapping; 00156 }; 00157 00158 class ConvertNode : public ShaderNode { 00159 public: 00160 ConvertNode(ShaderSocketType from, ShaderSocketType to); 00161 SHADER_NODE_BASE_CLASS(ConvertNode) 00162 00163 ShaderSocketType from, to; 00164 }; 00165 00166 class ProxyNode : public ShaderNode { 00167 public: 00168 ProxyNode(ShaderSocketType from, ShaderSocketType to); 00169 SHADER_NODE_BASE_CLASS(ProxyNode) 00170 00171 ShaderSocketType from, to; 00172 }; 00173 00174 class BsdfNode : public ShaderNode { 00175 public: 00176 SHADER_NODE_CLASS(BsdfNode) 00177 00178 void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2); 00179 00180 ClosureType closure; 00181 }; 00182 00183 class WardBsdfNode : public BsdfNode { 00184 public: 00185 SHADER_NODE_CLASS(WardBsdfNode) 00186 }; 00187 00188 class DiffuseBsdfNode : public BsdfNode { 00189 public: 00190 SHADER_NODE_CLASS(DiffuseBsdfNode) 00191 }; 00192 00193 class TranslucentBsdfNode : public BsdfNode { 00194 public: 00195 SHADER_NODE_CLASS(TranslucentBsdfNode) 00196 }; 00197 00198 class TransparentBsdfNode : public BsdfNode { 00199 public: 00200 SHADER_NODE_CLASS(TransparentBsdfNode) 00201 }; 00202 00203 class VelvetBsdfNode : public BsdfNode { 00204 public: 00205 SHADER_NODE_CLASS(VelvetBsdfNode) 00206 }; 00207 00208 class GlossyBsdfNode : public BsdfNode { 00209 public: 00210 SHADER_NODE_CLASS(GlossyBsdfNode) 00211 00212 ustring distribution; 00213 static ShaderEnum distribution_enum; 00214 }; 00215 00216 class GlassBsdfNode : public BsdfNode { 00217 public: 00218 SHADER_NODE_CLASS(GlassBsdfNode) 00219 00220 ustring distribution; 00221 static ShaderEnum distribution_enum; 00222 }; 00223 00224 class EmissionNode : public ShaderNode { 00225 public: 00226 SHADER_NODE_CLASS(EmissionNode) 00227 00228 bool total_power; 00229 }; 00230 00231 class BackgroundNode : public ShaderNode { 00232 public: 00233 SHADER_NODE_CLASS(BackgroundNode) 00234 }; 00235 00236 class HoldoutNode : public ShaderNode { 00237 public: 00238 SHADER_NODE_CLASS(HoldoutNode) 00239 }; 00240 00241 class VolumeNode : public ShaderNode { 00242 public: 00243 SHADER_NODE_CLASS(VolumeNode) 00244 00245 void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2); 00246 00247 ClosureType closure; 00248 }; 00249 00250 class TransparentVolumeNode : public VolumeNode { 00251 public: 00252 SHADER_NODE_CLASS(TransparentVolumeNode) 00253 }; 00254 00255 class IsotropicVolumeNode : public VolumeNode { 00256 public: 00257 SHADER_NODE_CLASS(IsotropicVolumeNode) 00258 }; 00259 00260 class GeometryNode : public ShaderNode { 00261 public: 00262 SHADER_NODE_CLASS(GeometryNode) 00263 }; 00264 00265 class TextureCoordinateNode : public ShaderNode { 00266 public: 00267 SHADER_NODE_CLASS(TextureCoordinateNode) 00268 void attributes(AttributeRequestSet *attributes); 00269 }; 00270 00271 class LightPathNode : public ShaderNode { 00272 public: 00273 SHADER_NODE_CLASS(LightPathNode) 00274 }; 00275 00276 class ValueNode : public ShaderNode { 00277 public: 00278 SHADER_NODE_CLASS(ValueNode) 00279 00280 float value; 00281 }; 00282 00283 class ColorNode : public ShaderNode { 00284 public: 00285 SHADER_NODE_CLASS(ColorNode) 00286 00287 float3 value; 00288 }; 00289 00290 class AddClosureNode : public ShaderNode { 00291 public: 00292 SHADER_NODE_CLASS(AddClosureNode) 00293 }; 00294 00295 class MixClosureNode : public ShaderNode { 00296 public: 00297 SHADER_NODE_CLASS(MixClosureNode) 00298 }; 00299 00300 class InvertNode : public ShaderNode { 00301 public: 00302 SHADER_NODE_CLASS(InvertNode) 00303 }; 00304 00305 class MixNode : public ShaderNode { 00306 public: 00307 SHADER_NODE_CLASS(MixNode) 00308 00309 ustring type; 00310 static ShaderEnum type_enum; 00311 }; 00312 00313 class CombineRGBNode : public ShaderNode { 00314 public: 00315 SHADER_NODE_CLASS(CombineRGBNode) 00316 }; 00317 00318 class GammaNode : public ShaderNode { 00319 public: 00320 SHADER_NODE_CLASS(GammaNode) 00321 }; 00322 00323 class SeparateRGBNode : public ShaderNode { 00324 public: 00325 SHADER_NODE_CLASS(SeparateRGBNode) 00326 }; 00327 00328 class HSVNode : public ShaderNode { 00329 public: 00330 SHADER_NODE_CLASS(HSVNode) 00331 }; 00332 00333 class AttributeNode : public ShaderNode { 00334 public: 00335 SHADER_NODE_CLASS(AttributeNode) 00336 void attributes(AttributeRequestSet *attributes); 00337 00338 ustring attribute; 00339 }; 00340 00341 class CameraNode : public ShaderNode { 00342 public: 00343 SHADER_NODE_CLASS(CameraNode) 00344 }; 00345 00346 class FresnelNode : public ShaderNode { 00347 public: 00348 SHADER_NODE_CLASS(FresnelNode) 00349 }; 00350 00351 class LayerWeightNode : public ShaderNode { 00352 public: 00353 SHADER_NODE_CLASS(LayerWeightNode) 00354 }; 00355 00356 class MathNode : public ShaderNode { 00357 public: 00358 SHADER_NODE_CLASS(MathNode) 00359 00360 ustring type; 00361 static ShaderEnum type_enum; 00362 }; 00363 00364 class NormalNode : public ShaderNode { 00365 public: 00366 SHADER_NODE_CLASS(NormalNode) 00367 00368 float3 direction; 00369 }; 00370 00371 class VectorMathNode : public ShaderNode { 00372 public: 00373 SHADER_NODE_CLASS(VectorMathNode) 00374 00375 ustring type; 00376 static ShaderEnum type_enum; 00377 }; 00378 00379 class BumpNode : public ShaderNode { 00380 public: 00381 SHADER_NODE_CLASS(BumpNode) 00382 }; 00383 00384 CCL_NAMESPACE_END 00385 00386 #endif /* __NODES_H__ */ 00387