0029337: Visualization, TKOpenGl - visual artifacts on Intel Broadwell GPU
[occt.git] / src / Shaders / Shaders_Declarations_glsl.pxx
CommitLineData
ee5befae 1// This file has been automatically generated from resource file src/Shaders/Declarations.glsl
2
3static const char Shaders_Declarations_glsl[] =
4 "// Created on: 2013-10-10\n"
5 "// Created by: Denis BOGOLEPOV\n"
6 "// Copyright (c) 2013-2014 OPEN CASCADE SAS\n"
7 "//\n"
8 "// This file is part of Open CASCADE Technology software library.\n"
9 "//\n"
10 "// This library is free software; you can redistribute it and/or modify it under\n"
11 "// the terms of the GNU Lesser General Public License version 2.1 as published\n"
12 "// by the Free Software Foundation, with special exception defined in the file\n"
13 "// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT\n"
14 "// distribution for complete text of the license and disclaimer of any warranty.\n"
15 "//\n"
16 "// Alternatively, this file may be used under the terms of Open CASCADE\n"
17 "// commercial license or contractual agreement.\n"
18 "\n"
daf73ab7 19 "//! @file Declarations.glsl\n"
20 "//! This files includes definition of common uniform variables in OCCT GLSL programs\n"
ee5befae 21 "\n"
daf73ab7 22 "//! @def THE_MAX_LIGHTS\n"
23 "//! Specifies the length of array of lights, which is 8 by default. Defined by Shader Manager.\n"
24 "// #define THE_MAX_LIGHTS 8\n"
25 "\n"
26 "//! @def THE_MAX_CLIP_PLANES\n"
27 "//! Specifies the length of array of clipping planes, which is 8 by default. Defined by Shader Manager.\n"
28 "// #define THE_MAX_CLIP_PLANES 8\n"
ee5befae 29 "\n"
b17e5bae 30 "//! @def THE_NB_FRAG_OUTPUTS\n"
31 "//! Specifies the length of array of Fragment Shader outputs, which is 1 by default. Defined by Shader Manager.\n"
32 "// #define THE_NB_FRAG_OUTPUTS 1\n"
33 "\n"
ee5befae 34 "// compatibility macros\n"
35 "#if (__VERSION__ >= 130)\n"
36 " #define THE_ATTRIBUTE in\n"
37 " #define THE_SHADER_IN in\n"
38 " #define THE_SHADER_OUT out\n"
39 " #define THE_OUT out\n"
ff6665dc 40 " #define occTexture1D texture\n"
ee5befae 41 " #define occTexture2D texture\n"
ff6665dc 42 " #define occTexture3D texture\n"
ee5befae 43 "#else\n"
44 " #define THE_ATTRIBUTE attribute\n"
45 " #define THE_SHADER_IN varying\n"
46 " #define THE_SHADER_OUT varying\n"
47 " #define THE_OUT\n"
ff6665dc 48 " #define occTexture1D texture1D\n"
ee5befae 49 " #define occTexture2D texture2D\n"
ff6665dc 50 " #define occTexture3D texture3D\n"
ee5befae 51 "#endif\n"
52 "\n"
53 "#ifdef GL_ES\n"
54 " #define THE_PREC_ENUM lowp // enumerations should fit into lowp range\n"
55 "#else\n"
56 " #define THE_PREC_ENUM\n"
57 "#endif\n"
58 "\n"
59 "// Vertex attributes\n"
60 "#ifdef VERTEX_SHADER\n"
61 " THE_ATTRIBUTE vec4 occVertex;\n"
62 " THE_ATTRIBUTE vec3 occNormal;\n"
63 " THE_ATTRIBUTE vec4 occTexCoord;\n"
64 " THE_ATTRIBUTE vec4 occVertColor;\n"
8e0a2b19 65 "#elif defined(FRAGMENT_SHADER)\n"
66 " #if (__VERSION__ >= 130)\n"
67 " #ifdef OCC_ENABLE_draw_buffers\n"
b17e5bae 68 " out vec4 occFragColorArray[THE_NB_FRAG_OUTPUTS];\n"
69 " #define occFragColorArrayAlias occFragColorArray\n"
70 " #define occFragColor0 occFragColorArray[0]\n"
8e0a2b19 71 " #else\n"
b17e5bae 72 " out vec4 occFragColor0;\n"
8e0a2b19 73 " #endif\n"
177781da 74 " #else\n"
8e0a2b19 75 " #ifdef OCC_ENABLE_draw_buffers\n"
b17e5bae 76 " #define occFragColorArrayAlias gl_FragData\n"
77 " #define occFragColor0 gl_FragData[0]\n"
8e0a2b19 78 " #else\n"
b17e5bae 79 " #define occFragColor0 gl_FragColor\n"
8e0a2b19 80 " #endif\n"
a1073ae2 81 " #endif\n"
b17e5bae 82 "\n"
83 " #if (THE_NB_FRAG_OUTPUTS >= 2)\n"
84 " #define occFragColor1 occFragColorArrayAlias[1]\n"
85 " #else\n"
86 " vec4 occFragColor1;\n"
87 " #endif\n"
88 " #if (THE_NB_FRAG_OUTPUTS >= 3)\n"
89 " #define occFragColor2 occFragColorArrayAlias[2]\n"
90 " #else\n"
91 " vec4 occFragColor2;\n"
92 " #endif\n"
93 " #if (THE_NB_FRAG_OUTPUTS >= 4)\n"
94 " #define occFragColor3 occFragColorArrayAlias[3]\n"
95 " #else\n"
96 " vec4 occFragColor3;\n"
97 " #endif\n"
98 "\n"
99 " // Built-in outputs notation\n"
100 " #define occFragColor occFragColor0\n"
101 " #define occFragCoverage occFragColor1\n"
102 "\n"
103 " //! Define the main Fragment Shader output - color value.\n"
104 " void occSetFragColor (in vec4 theColor);\n"
ee5befae 105 "#endif\n"
106 "\n"
107 "// Matrix state\n"
108 "uniform mat4 occWorldViewMatrix; //!< World-view matrix\n"
109 "uniform mat4 occProjectionMatrix; //!< Projection matrix\n"
110 "uniform mat4 occModelWorldMatrix; //!< Model-world matrix\n"
111 "\n"
112 "uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix\n"
113 "uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix\n"
114 "uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix\n"
115 "\n"
116 "uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix\n"
117 "uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix\n"
118 "uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix\n"
119 "\n"
120 "uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix\n"
121 "uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix\n"
122 "uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix\n"
123 "\n"
124 "// light type enumeration\n"
125 "const int OccLightType_Direct = 1; //!< directional light source\n"
126 "const int OccLightType_Point = 2; //!< isotropic point light source\n"
127 "const int OccLightType_Spot = 3; //!< spot light source\n"
128 "\n"
129 "// Light sources\n"
130 "uniform vec4 occLightAmbient; //!< Cumulative ambient color\n"
daf73ab7 131 "#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"
ee5befae 132 "uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n"
133 "int occLight_Type (in int theId); //!< Type of light source\n"
134 "int occLight_IsHeadlight (in int theId); //!< Is light a headlight?\n"
135 "vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source\n"
136 "vec4 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intencity)\n"
137 "vec4 occLight_Position (in int theId); //!< Position of specified light source\n"
138 "vec4 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source\n"
139 "float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source\n"
140 "float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source\n"
141 "float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)\n"
142 "float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)\n"
daf73ab7 143 "#endif\n"
ee5befae 144 "\n"
145 "// Front material properties accessors\n"
146 "vec4 occFrontMaterial_Emission(void); //!< Emission color\n"
147 "vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection\n"
148 "vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection\n"
149 "vec4 occFrontMaterial_Specular(void); //!< Specular reflection\n"
150 "float occFrontMaterial_Shininess(void); //!< Specular exponent\n"
151 "float occFrontMaterial_Transparency(void); //!< Transparency coefficient\n"
152 "\n"
153 "// Back material properties accessors\n"
154 "vec4 occBackMaterial_Emission(void); //!< Emission color\n"
155 "vec4 occBackMaterial_Ambient(void); //!< Ambient reflection\n"
156 "vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection\n"
157 "vec4 occBackMaterial_Specular(void); //!< Specular reflection\n"
158 "float occBackMaterial_Shininess(void); //!< Specular exponent\n"
159 "float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
160 "\n"
cc8cbabe 161 "#define occActiveSampler occSampler0 //!< alias for backward compatibility\n"
162 "#define occSamplerBaseColor occSampler0 //!< alias to a base color texture\n"
163 "uniform sampler2D occSampler0; //!< current active sampler;\n"
164 " //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
ee5befae 165 "uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"
166 "uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n"
167 "uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n"
ee5befae 168 "uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
169 "uniform float occPointSize; //!< point size\n"
170 "\n"
a1073ae2 171 "//! Parameters of blended order-independent transparency rendering algorithm\n"
172 "uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n"
173 "uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
174 "\n"
ee5befae 175 "//! Parameters of clipping planes\n"
daf73ab7 176 "#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)\n"
ee5befae 177 "uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n"
daf73ab7 178 "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n"
179 "#endif\n";