0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / Shaders / Declarations.glsl
CommitLineData
12381341 1// This files includes definition of common uniform variables in OCCT GLSL programs
30f0ad28 2
12381341 3#define THE_MAX_LIGHTS 8
4#define THE_MAX_CLIP_PLANES 8
30f0ad28 5
12381341 6// Vertex attributes
30f0ad28 7// Note: At the moment, we just 'rename' the default OpenGL
8// vertex attributes from compatibility profile. In the next
9// release old functionality will be removed from shader API.
12381341 10#ifdef VERTEX_SHADER
11 #define occColor gl_Color //!< Vertex color
12 #define occNormal gl_Normal //!< Normal coordinates
13 #define occVertex gl_Vertex //!< Vertex coordinates
14 #define occTexCoord gl_MultiTexCoord0 //!< Texture coordinates
30f0ad28 15#endif
16
12381341 17// Matrix state
18uniform mat4 occWorldViewMatrix; //!< World-view matrix
19uniform mat4 occProjectionMatrix; //!< Projection matrix
20uniform mat4 occModelWorldMatrix; //!< Model-world matrix
21
22uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix
23uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix
24uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix
25
26uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix
27uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix
28uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix
29
30uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix
31uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix
32uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix
33
34// light type enumeration
35const int OccLightType_Direct = 1; //!< directional light source
36const int OccLightType_Point = 2; //!< isotropic point light source
37const int OccLightType_Spot = 3; //!< spot light source
38
39// Light sources
40uniform vec4 occLightAmbient; //!< Cumulative ambient color
41uniform int occLightSourcesCount; //!< Total number of light sources
42int occLight_Type (in int theId); //!< Type of light source
43int occLight_IsHeadlight (in int theId); //!< Is light a headlight?
44vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source
45vec4 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intencity)
46vec4 occLight_Position (in int theId); //!< Position of specified light source
47vec4 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source
48float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source
49float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source
50float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)
51float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)
52
53// Front material properties accessors
54vec4 occFrontMaterial_Emission(void); //!< Emission color
55vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection
56vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection
57vec4 occFrontMaterial_Specular(void); //!< Specular reflection
58float occFrontMaterial_Shininess(void); //!< Specular exponent
59float occFrontMaterial_Transparency(void); //!< Transparency coefficient
60
61// Front material properties accessors
62vec4 occBackMaterial_Emission(void); //!< Emission color
63vec4 occBackMaterial_Ambient(void); //!< Ambient reflection
64vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection
65vec4 occBackMaterial_Specular(void); //!< Specular reflection
66float occBackMaterial_Shininess(void); //!< Specular exponent
67float occBackMaterial_Transparency(void); //!< Transparency coefficient
68
69uniform int occDistinguishingMode; //!< Are front and back faces distinguished?
70uniform int occTextureEnable; //!< Is texture enabled?
71uniform sampler2D occActiveSampler; //!< Current active sampler
72
73// clipping planes state
74const int OccEquationCoords_View = 0; //!< view-space clipping plane
75const int OccEquationCoords_World = 1; //!< world-space clipping plane
76
77//! Parameters of clipping planes
78uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
79uniform int occClipPlaneSpaces [THE_MAX_CLIP_PLANES];
5495fa7e 80uniform int occClipPlaneCount; //!< Total number of clip planes