1 // This file has been automatically generated from resource file src/Shaders/Declarations.glsl
3 static 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"
8 "// This file is part of Open CASCADE Technology software library.\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"
16 "// Alternatively, this file may be used under the terms of Open CASCADE\n"
17 "// commercial license or contractual agreement.\n"
19 "// This files includes definition of common uniform variables in OCCT GLSL programs\n"
21 "#define THE_MAX_LIGHTS 8\n"
22 "#define THE_MAX_CLIP_PLANES 8\n"
24 "// compatibility macros\n"
25 "#if (__VERSION__ >= 130)\n"
26 " #define THE_ATTRIBUTE in\n"
27 " #define THE_SHADER_IN in\n"
28 " #define THE_SHADER_OUT out\n"
29 " #define THE_OUT out\n"
30 " #define occTexture1D texture\n"
31 " #define occTexture2D texture\n"
32 " #define occTexture3D texture\n"
34 " #define THE_ATTRIBUTE attribute\n"
35 " #define THE_SHADER_IN varying\n"
36 " #define THE_SHADER_OUT varying\n"
38 " #define occTexture1D texture1D\n"
39 " #define occTexture2D texture2D\n"
40 " #define occTexture3D texture3D\n"
44 " #define THE_PREC_ENUM lowp // enumerations should fit into lowp range\n"
46 " #define THE_PREC_ENUM\n"
49 "// Vertex attributes\n"
50 "#ifdef VERTEX_SHADER\n"
51 " THE_ATTRIBUTE vec4 occVertex;\n"
52 " THE_ATTRIBUTE vec3 occNormal;\n"
53 " THE_ATTRIBUTE vec4 occTexCoord;\n"
54 " THE_ATTRIBUTE vec4 occVertColor;\n"
55 "#elif defined(FRAGMENT_SHADER)\n"
56 " #if (__VERSION__ >= 130)\n"
57 " #ifdef OCC_ENABLE_draw_buffers\n"
58 " out vec4 occFragColorArray[2];\n"
59 " #define occFragColor occFragColorArray[0]\n"
60 " #define occFragCoverage occFragColorArray[1]\n"
62 " out vec4 occFragColor;\n"
65 " #ifdef OCC_ENABLE_draw_buffers\n"
66 " #define occFragColor gl_FragData[0]\n"
67 " #define occFragCoverage gl_FragData[1]\n"
69 " #define occFragColor gl_FragColor\n"
75 "uniform mat4 occWorldViewMatrix; //!< World-view matrix\n"
76 "uniform mat4 occProjectionMatrix; //!< Projection matrix\n"
77 "uniform mat4 occModelWorldMatrix; //!< Model-world matrix\n"
79 "uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix\n"
80 "uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix\n"
81 "uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix\n"
83 "uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix\n"
84 "uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix\n"
85 "uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix\n"
87 "uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix\n"
88 "uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix\n"
89 "uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix\n"
91 "// light type enumeration\n"
92 "const int OccLightType_Direct = 1; //!< directional light source\n"
93 "const int OccLightType_Point = 2; //!< isotropic point light source\n"
94 "const int OccLightType_Spot = 3; //!< spot light source\n"
97 "uniform vec4 occLightAmbient; //!< Cumulative ambient color\n"
98 "uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n"
99 "int occLight_Type (in int theId); //!< Type of light source\n"
100 "int occLight_IsHeadlight (in int theId); //!< Is light a headlight?\n"
101 "vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source\n"
102 "vec4 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intencity)\n"
103 "vec4 occLight_Position (in int theId); //!< Position of specified light source\n"
104 "vec4 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source\n"
105 "float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source\n"
106 "float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source\n"
107 "float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)\n"
108 "float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)\n"
110 "// Front material properties accessors\n"
111 "vec4 occFrontMaterial_Emission(void); //!< Emission color\n"
112 "vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection\n"
113 "vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection\n"
114 "vec4 occFrontMaterial_Specular(void); //!< Specular reflection\n"
115 "float occFrontMaterial_Shininess(void); //!< Specular exponent\n"
116 "float occFrontMaterial_Transparency(void); //!< Transparency coefficient\n"
118 "// Back material properties accessors\n"
119 "vec4 occBackMaterial_Emission(void); //!< Emission color\n"
120 "vec4 occBackMaterial_Ambient(void); //!< Ambient reflection\n"
121 "vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection\n"
122 "vec4 occBackMaterial_Specular(void); //!< Specular reflection\n"
123 "float occBackMaterial_Shininess(void); //!< Specular exponent\n"
124 "float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
126 "#define occActiveSampler occSampler0 //!< alias for backward compatibility\n"
127 "#define occSamplerBaseColor occSampler0 //!< alias to a base color texture\n"
128 "uniform sampler2D occSampler0; //!< current active sampler;\n"
129 " //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
130 "uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"
131 "uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n"
132 "uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n"
133 "uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
134 "uniform float occPointSize; //!< point size\n"
136 "//! Parameters of blended order-independent transparency rendering algorithm\n"
137 "uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n"
138 "uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
140 "//! Parameters of clipping planes\n"
141 "uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n"
142 "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n";