Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2012-12-30 07:11:52 +0400
committerThomas Dinges <blender@dingto.org>2012-12-30 07:11:52 +0400
commitf7e8ffdb857e349283585143084c5a6c8a8be042 (patch)
treeab13c508cd91adcfa661dce7ed75a7d1209360f4
parent398da25b1b51cc2966791ca2f672617bc3677980 (diff)
OSL Templates:
* Add 3 simple templates: ** empty_shader.osl: A basic shader declaration to start with ** wireframe.osl: Simple wireframe shader ** noise.osl: Simple noise shader, with 3 noise types.
-rw-r--r--release/scripts/templates_osl/empty_shader.osl6
-rw-r--r--release/scripts/templates_osl/noise.osl18
-rw-r--r--release/scripts/templates_osl/wireframe.osl10
-rw-r--r--source/blender/editors/space_text/text_format_osl.c2
4 files changed, 35 insertions, 1 deletions
diff --git a/release/scripts/templates_osl/empty_shader.osl b/release/scripts/templates_osl/empty_shader.osl
new file mode 100644
index 00000000000..8526e0f2e9b
--- /dev/null
+++ b/release/scripts/templates_osl/empty_shader.osl
@@ -0,0 +1,6 @@
+#include "stdosl.h"
+
+shader name()
+{
+
+} \ No newline at end of file
diff --git a/release/scripts/templates_osl/noise.osl b/release/scripts/templates_osl/noise.osl
new file mode 100644
index 00000000000..e152824b192
--- /dev/null
+++ b/release/scripts/templates_osl/noise.osl
@@ -0,0 +1,18 @@
+#include <stdosl.h>
+
+shader noise(
+ float Time = 1.0,
+ point Point = P,
+ output float Cell = 0.0,
+ output color Perlin = 0.8,
+ output color UPerlin = 0.8)
+{
+ /* Cell Noise */
+ Cell = noise("cell", Point);
+
+ /* Perlin 4D Noise*/
+ Perlin = noise("perlin", Point, Time);
+
+ /* UPerlin 4D Noise*/
+ UPerlin = noise("uperlin", Point, Time);
+} \ No newline at end of file
diff --git a/release/scripts/templates_osl/wireframe.osl b/release/scripts/templates_osl/wireframe.osl
new file mode 100644
index 00000000000..193dc7ee925
--- /dev/null
+++ b/release/scripts/templates_osl/wireframe.osl
@@ -0,0 +1,10 @@
+#include "stdosl.h"
+#include "oslutil.h"
+
+shader wireframe(
+ float Line_Width = 2.0,
+ int Raster = 1,
+ output float Wire = 0.0)
+{
+ Wire = wireframe("triangles", Line_Width, Raster);
+} \ No newline at end of file
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index a815fb2c34d..f313e9a5f2a 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -144,7 +144,7 @@ static int txtfmt_osl_find_specialvar(const char *string)
if (STR_LITERAL_STARTSWITH(string, "shader", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "surface", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "volume", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len;
+ else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */