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.
This commit is contained in:
Thomas Dinges
2012-12-30 03:11:52 +00:00
parent 398da25b1b
commit f7e8ffdb85
4 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
#include "stdosl.h"
shader name()
{
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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 */