d5f74e42 |
1 | // Created on: 2013-10-10 |
2 | // Created by: Denis BOGOLEPOV |
3 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
12381341 |
16 | // This files includes definition of common uniform variables in OCCT GLSL programs |
30f0ad28 |
17 | |
12381341 |
18 | #define THE_MAX_LIGHTS 8 |
19 | #define THE_MAX_CLIP_PLANES 8 |
30f0ad28 |
20 | |
12381341 |
21 | // Vertex attributes |
12381341 |
22 | #ifdef VERTEX_SHADER |
7d3e64ef |
23 | attribute vec4 occVertex; |
24 | attribute vec3 occNormal; |
25 | attribute vec4 occTexCoord; |
8625ef7e |
26 | attribute vec4 occVertColor; |
30f0ad28 |
27 | #endif |
28 | |
12381341 |
29 | // Matrix state |
30 | uniform mat4 occWorldViewMatrix; //!< World-view matrix |
31 | uniform mat4 occProjectionMatrix; //!< Projection matrix |
32 | uniform mat4 occModelWorldMatrix; //!< Model-world matrix |
33 | |
34 | uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix |
35 | uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix |
36 | uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix |
37 | |
38 | uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix |
39 | uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix |
40 | uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix |
41 | |
42 | uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix |
43 | uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix |
44 | uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix |
45 | |
46 | // light type enumeration |
47 | const int OccLightType_Direct = 1; //!< directional light source |
48 | const int OccLightType_Point = 2; //!< isotropic point light source |
49 | const int OccLightType_Spot = 3; //!< spot light source |
50 | |
51 | // Light sources |
52 | uniform vec4 occLightAmbient; //!< Cumulative ambient color |
53 | uniform int occLightSourcesCount; //!< Total number of light sources |
54 | int occLight_Type (in int theId); //!< Type of light source |
55 | int occLight_IsHeadlight (in int theId); //!< Is light a headlight? |
56 | vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source |
57 | vec4 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intencity) |
58 | vec4 occLight_Position (in int theId); //!< Position of specified light source |
59 | vec4 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source |
60 | float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source |
61 | float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source |
62 | float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians) |
63 | float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1) |
64 | |
65 | // Front material properties accessors |
66 | vec4 occFrontMaterial_Emission(void); //!< Emission color |
67 | vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection |
68 | vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection |
69 | vec4 occFrontMaterial_Specular(void); //!< Specular reflection |
70 | float occFrontMaterial_Shininess(void); //!< Specular exponent |
71 | float occFrontMaterial_Transparency(void); //!< Transparency coefficient |
72 | |
8625ef7e |
73 | // Back material properties accessors |
12381341 |
74 | vec4 occBackMaterial_Emission(void); //!< Emission color |
75 | vec4 occBackMaterial_Ambient(void); //!< Ambient reflection |
76 | vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection |
77 | vec4 occBackMaterial_Specular(void); //!< Specular reflection |
78 | float occBackMaterial_Shininess(void); //!< Specular exponent |
79 | float occBackMaterial_Transparency(void); //!< Transparency coefficient |
80 | |
8625ef7e |
81 | uniform vec4 occColor; //!< color value (in case of disabled lighting) |
12381341 |
82 | uniform int occDistinguishingMode; //!< Are front and back faces distinguished? |
83 | uniform int occTextureEnable; //!< Is texture enabled? |
84 | uniform sampler2D occActiveSampler; //!< Current active sampler |
8625ef7e |
85 | uniform float occPointSize; //!< point size |
12381341 |
86 | |
87 | // clipping planes state |
88 | const int OccEquationCoords_View = 0; //!< view-space clipping plane |
89 | const int OccEquationCoords_World = 1; //!< world-space clipping plane |
90 | |
91 | //! Parameters of clipping planes |
92 | uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES]; |
93 | uniform int occClipPlaneSpaces [THE_MAX_CLIP_PLANES]; |
5495fa7e |
94 | uniform int occClipPlaneCount; //!< Total number of clip planes |