"// Alternatively, this file may be used under the terms of Open CASCADE\n"
"// commercial license or contractual agreement.\n"
"\n"
- "// This files includes definition of common uniform variables in OCCT GLSL programs\n"
+ "//! @file Declarations.glsl\n"
+ "//! This files includes definition of common uniform variables in OCCT GLSL programs\n"
"\n"
- "#define THE_MAX_LIGHTS 8\n"
- "#define THE_MAX_CLIP_PLANES 8\n"
+ "//! @def THE_MAX_LIGHTS\n"
+ "//! Specifies the length of array of lights, which is 8 by default. Defined by Shader Manager.\n"
+ "// #define THE_MAX_LIGHTS 8\n"
+ "\n"
+ "//! @def THE_MAX_CLIP_PLANES\n"
+ "//! Specifies the length of array of clipping planes, which is 8 by default. Defined by Shader Manager.\n"
+ "// #define THE_MAX_CLIP_PLANES 8\n"
+ "\n"
+ "//! @def THE_NB_FRAG_OUTPUTS\n"
+ "//! Specifies the length of array of Fragment Shader outputs, which is 1 by default. Defined by Shader Manager.\n"
+ "// #define THE_NB_FRAG_OUTPUTS 1\n"
"\n"
"// compatibility macros\n"
"#if (__VERSION__ >= 130)\n"
" #define THE_SHADER_IN in\n"
" #define THE_SHADER_OUT out\n"
" #define THE_OUT out\n"
+ " #define occTexture1D texture\n"
" #define occTexture2D texture\n"
+ " #define occTexture3D texture\n"
"#else\n"
" #define THE_ATTRIBUTE attribute\n"
" #define THE_SHADER_IN varying\n"
" #define THE_SHADER_OUT varying\n"
" #define THE_OUT\n"
+ " #define occTexture1D texture1D\n"
" #define occTexture2D texture2D\n"
+ " #define occTexture3D texture3D\n"
"#endif\n"
"\n"
"#ifdef GL_ES\n"
" THE_ATTRIBUTE vec3 occNormal;\n"
" THE_ATTRIBUTE vec4 occTexCoord;\n"
" THE_ATTRIBUTE vec4 occVertColor;\n"
- "#elif (__VERSION__ >= 130)\n"
- " out vec4 occFragColor;\n"
- "#else\n"
- " #define occFragColor gl_FragColor\n"
+ "#elif defined(FRAGMENT_SHADER)\n"
+ " #if (__VERSION__ >= 130)\n"
+ " #ifdef OCC_ENABLE_draw_buffers\n"
+ " out vec4 occFragColorArray[THE_NB_FRAG_OUTPUTS];\n"
+ " #define occFragColorArrayAlias occFragColorArray\n"
+ " #define occFragColor0 occFragColorArray[0]\n"
+ " #else\n"
+ " out vec4 occFragColor0;\n"
+ " #endif\n"
+ " #else\n"
+ " #ifdef OCC_ENABLE_draw_buffers\n"
+ " #define occFragColorArrayAlias gl_FragData\n"
+ " #define occFragColor0 gl_FragData[0]\n"
+ " #else\n"
+ " #define occFragColor0 gl_FragColor\n"
+ " #endif\n"
+ " #endif\n"
+ "\n"
+ " #if (THE_NB_FRAG_OUTPUTS >= 2)\n"
+ " #define occFragColor1 occFragColorArrayAlias[1]\n"
+ " #else\n"
+ " vec4 occFragColor1;\n"
+ " #endif\n"
+ " #if (THE_NB_FRAG_OUTPUTS >= 3)\n"
+ " #define occFragColor2 occFragColorArrayAlias[2]\n"
+ " #else\n"
+ " vec4 occFragColor2;\n"
+ " #endif\n"
+ " #if (THE_NB_FRAG_OUTPUTS >= 4)\n"
+ " #define occFragColor3 occFragColorArrayAlias[3]\n"
+ " #else\n"
+ " vec4 occFragColor3;\n"
+ " #endif\n"
+ "\n"
+ " // Built-in outputs notation\n"
+ " #define occFragColor occFragColor0\n"
+ " #define occFragCoverage occFragColor1\n"
+ "\n"
+ " //! Define the main Fragment Shader output - color value.\n"
+ " void occSetFragColor (in vec4 theColor);\n"
"#endif\n"
"\n"
"// Matrix state\n"
"\n"
"// Light sources\n"
"uniform vec4 occLightAmbient; //!< Cumulative ambient color\n"
+ "#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"
"uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n"
"int occLight_Type (in int theId); //!< Type of light source\n"
"int occLight_IsHeadlight (in int theId); //!< Is light a headlight?\n"
"float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source\n"
"float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)\n"
"float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)\n"
+ "#endif\n"
"\n"
"// Front material properties accessors\n"
"vec4 occFrontMaterial_Emission(void); //!< Emission color\n"
"float occBackMaterial_Shininess(void); //!< Specular exponent\n"
"float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
"\n"
+ "#define occActiveSampler occSampler0 //!< alias for backward compatibility\n"
+ "#define occSamplerBaseColor occSampler0 //!< alias to a base color texture\n"
+ "uniform sampler2D occSampler0; //!< current active sampler;\n"
+ " //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
"uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"
"uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n"
"uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n"
- "uniform sampler2D occActiveSampler; //!< Current active sampler\n"
"uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
"uniform float occPointSize; //!< point size\n"
"\n"
+ "//! Parameters of blended order-independent transparency rendering algorithm\n"
+ "uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n"
+ "uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
+ "\n"
"//! Parameters of clipping planes\n"
+ "#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)\n"
"uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n"
- "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n";
+ "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n"
+ "#endif\n";