changed: gcc8 base update
[opensg.git] / Examples / CSM / Shader / SimpleSplit / scene.osg
blob7bc256350e9418aaf4d4aafaf557cbc8e76a2ec9
1 #OSG V1.0 
3 Node
5   core MaterialGroup
6   {
7     material ChunkMaterial
8     {
9       chunks
10       [
11         SimpleSHLChunk
12         {
13           variables ShaderProgramVariables
14           {
15             variables
16             [
17               ShaderVariableReal
18               {
19                 name "ColR"
20                 value 1.0
21               }
22               ShaderVariableReal
23               {
24                 name "ColG"
25                 value 0.6
26               }
27               ShaderVariableReal
28               {
29                 name "ColB"
30                 value 0.6
31               }
32               ShaderVariableReal
33               {
34                 name "ColB"
35                 value 0.0
36               }
37             ]
38           }
40           vertexShader 
41           [
42             ShaderProgram
43             {
44               shaderType GL_VERTEX_SHADER
46               program "
47                 float simpleLight(void)
48                 {
49                   // calculate vertex position in eye coordinates
50                   vec4 ecPosition = -normalize(gl_ModelViewMatrix * gl_Vertex);
52                   // compute the transformed normal
53                   vec3 tnorm      = normalize(gl_NormalMatrix * gl_Normal);
55                   // Calculate a diffuse light intensity
56                   return dot(ecPosition.xyz, tnorm);
57                 }
58               "
59             }
61             ShaderProgram
62             {
63               shaderType GL_VERTEX_SHADER
65               program "
67                 float simpleLight(void);
69                 varying float Diffuse; 
71                 void main(void)
72                 {
73                   Diffuse = simpleLight();
75                   // output final vertex information
76                   gl_Position     = gl_ModelViewProjectionMatrix * gl_Vertex;
77                 }
78               "
79             }
80           ]
82           fragmentShader 
83           [
84             ShaderProgram
85             {
86               shaderType GL_FRAGMENT_SHADER
88               program "
89                 varying float Diffuse; 
90                 uniform float ColR;
91                 uniform float ColG;
92                 uniform float ColB;
94                 void main (void)
95                 {
96                   gl_FragColor = vec4(ColR * Diffuse, 
97                                       ColG * Diffuse, 
98                                       ColB * Diffuse, 
99                                       1.);
100                 }
101               "
102             }
103           ]
104         }
105       ]
106     }
107   }
109   children
110   [
111     Node
112     {
113       core Inline
114       {
115         url "../../SimpleTeapot/object.wrl"
116       }
117     }
118   ]