changed: gcc8 base update
[opensg.git] / Examples / CSM / Shader / OldSHLSimpleProc / scene.osg
blob318907b2a724d86f19df2cb6ee93de734eb59ea6
1 #OSG V1.0 
3 Node
5   core ComponentTransform
6   {
7     translation -5 0 0 
8   }
9   children
10   [
11     Node
12     {
13       core MaterialGroup
14       {
15         material DEF Mat1 ChunkMaterial
16         {
17           chunks
18           [
19             MaterialChunk  
20             { 
21               diffuse      0.8 0.8 0.8 1.0
22               ambient      0.0 0.0 0.0 1.0
23               specular     0.0 0.0 0.0 1.0
24               shininess    0.4
25             }
26   
27             SHLChunk
28             {
29               vertexProgram "
31                 varying float Diffuse; 
32                 uniform mat4  OSGWorldMatrix;
33                 uniform mat4  OSGViewMatrix;
35                 void main(void)
36                 {
37                   // calculate vertex position in eye coordinates
38                   vec4 ecPosition = -normalize(gl_ModelViewMatrix * 
39                                                gl_Vertex);
41                   // compute the transformed normal
42                   vec3 tnorm      = normalize(gl_NormalMatrix * 
43                                               gl_Normal);
45                   // Calculate a diffuse light intensity
46                   Diffuse             = dot(ecPosition.xyz, 
47                                             tnorm     );
49                   mat4 vp = 
50                     gl_ProjectionMatrix * OSGViewMatrix * OSGWorldMatrix;
52                   // output final vertex information
53                   //gl_Position     = 
54                   //  gl_ModelViewProjectionMatrix * gl_Vertex;
55                   gl_Position     = vp * gl_Vertex;
56                 }
57               "
58               fragmentProgram "
59                 varying float Diffuse; 
60                 uniform float ColR;
61                 uniform float ColG;
62                 uniform float ColB;
64                 void main (void)
65                 {
66                   gl_FragColor = vec4(ColR * Diffuse, 
67                                       ColG * Diffuse, 
68                                       ColB * Diffuse, 
69                                       1.);
70                 }
71               "
73               parameters
74               [
75                 ShaderParameterInt
76                 {
77                   name "OSGViewMatrix"
78                 }
79                 ShaderParameterInt
80                 {
81                   name "OSGWorldMatrix"
82                 }
83                 ShaderParameterReal
84                 {
85                   name "ColR"
86                   value 1.0
87                 }
88                 ShaderParameterReal
89                 {
90                   name "ColG"
91                   value 0.6
92                 }
93                 ShaderParameterReal
94                 {
95                   name "ColB"
96                   value 0.6
97                 }
98               ]
99             }
100           ]
101         }
102       }
104       children
105       [
106         Node
107         {
108           core Inline
109           {
110             url "../../Models/teapot.wrl"
111           }
112         }
113       ]
114     }
115   ]
118 Node
120   core ComponentTransform
121   {
122     translation 5 0 0 
123   }
125   children
126   [
127     Node
128     {
129       core MaterialGroup
130       {
131         material USE Mat1
132       }
134       children
135       [
136         Node
137         {
138           core Inline
139           {
140             url "../../Models/teapot.wrl"
141           }
142         }
143       ]
144     }
145   ]