ee5befae |
1 | // This file has been automatically generated from resource file src/Shaders/Declarations.glsl |
2 | |
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" |
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" |
19 | "// This files includes definition of common uniform variables in OCCT GLSL programs\n" |
20 | "\n" |
21 | "#define THE_MAX_LIGHTS 8\n" |
22 | "#define THE_MAX_CLIP_PLANES 8\n" |
23 | "\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" |
ff6665dc |
30 | " #define occTexture1D texture\n" |
ee5befae |
31 | " #define occTexture2D texture\n" |
ff6665dc |
32 | " #define occTexture3D texture\n" |
ee5befae |
33 | "#else\n" |
34 | " #define THE_ATTRIBUTE attribute\n" |
35 | " #define THE_SHADER_IN varying\n" |
36 | " #define THE_SHADER_OUT varying\n" |
37 | " #define THE_OUT\n" |
ff6665dc |
38 | " #define occTexture1D texture1D\n" |
ee5befae |
39 | " #define occTexture2D texture2D\n" |
ff6665dc |
40 | " #define occTexture3D texture3D\n" |
ee5befae |
41 | "#endif\n" |
42 | "\n" |
43 | "#ifdef GL_ES\n" |
44 | " #define THE_PREC_ENUM lowp // enumerations should fit into lowp range\n" |
45 | "#else\n" |
46 | " #define THE_PREC_ENUM\n" |
47 | "#endif\n" |
48 | "\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 (__VERSION__ >= 130)\n" |
a1073ae2 |
56 | " #ifdef OCC_ENABLE_draw_buffers\n" |
177781da |
57 | " out vec4 occFragColorArray[2];\n" |
58 | " #define occFragColor occFragColorArray[0]\n" |
59 | " #define occFragCoverage occFragColorArray[1]\n" |
60 | " #else\n" |
61 | " out vec4 occFragColor;\n" |
a1073ae2 |
62 | " #endif\n" |
ee5befae |
63 | "#else\n" |
a1073ae2 |
64 | " #ifdef OCC_ENABLE_draw_buffers\n" |
65 | " #define occFragColor gl_FragData[0]\n" |
66 | " #define occFragCoverage gl_FragData[1]\n" |
67 | " #else\n" |
68 | " #define occFragColor gl_FragColor\n" |
69 | " #endif\n" |
ee5befae |
70 | "#endif\n" |
71 | "\n" |
72 | "// Matrix state\n" |
73 | "uniform mat4 occWorldViewMatrix; //!< World-view matrix\n" |
74 | "uniform mat4 occProjectionMatrix; //!< Projection matrix\n" |
75 | "uniform mat4 occModelWorldMatrix; //!< Model-world matrix\n" |
76 | "\n" |
77 | "uniform mat4 occWorldViewMatrixInverse; //!< Inverse of the world-view matrix\n" |
78 | "uniform mat4 occProjectionMatrixInverse; //!< Inverse of the projection matrix\n" |
79 | "uniform mat4 occModelWorldMatrixInverse; //!< Inverse of the model-world matrix\n" |
80 | "\n" |
81 | "uniform mat4 occWorldViewMatrixTranspose; //!< Transpose of the world-view matrix\n" |
82 | "uniform mat4 occProjectionMatrixTranspose; //!< Transpose of the projection matrix\n" |
83 | "uniform mat4 occModelWorldMatrixTranspose; //!< Transpose of the model-world matrix\n" |
84 | "\n" |
85 | "uniform mat4 occWorldViewMatrixInverseTranspose; //!< Transpose of the inverse of the world-view matrix\n" |
86 | "uniform mat4 occProjectionMatrixInverseTranspose; //!< Transpose of the inverse of the projection matrix\n" |
87 | "uniform mat4 occModelWorldMatrixInverseTranspose; //!< Transpose of the inverse of the model-world matrix\n" |
88 | "\n" |
89 | "// light type enumeration\n" |
90 | "const int OccLightType_Direct = 1; //!< directional light source\n" |
91 | "const int OccLightType_Point = 2; //!< isotropic point light source\n" |
92 | "const int OccLightType_Spot = 3; //!< spot light source\n" |
93 | "\n" |
94 | "// Light sources\n" |
95 | "uniform vec4 occLightAmbient; //!< Cumulative ambient color\n" |
96 | "uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources\n" |
97 | "int occLight_Type (in int theId); //!< Type of light source\n" |
98 | "int occLight_IsHeadlight (in int theId); //!< Is light a headlight?\n" |
99 | "vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source\n" |
100 | "vec4 occLight_Specular (in int theId); //!< Specular intensity (currently - equals to diffuse intencity)\n" |
101 | "vec4 occLight_Position (in int theId); //!< Position of specified light source\n" |
102 | "vec4 occLight_SpotDirection (in int theId); //!< Direction of specified spot light source\n" |
103 | "float occLight_ConstAttenuation (in int theId); //!< Const attenuation factor of positional light source\n" |
104 | "float occLight_LinearAttenuation (in int theId); //!< Linear attenuation factor of positional light source\n" |
105 | "float occLight_SpotCutOff (in int theId); //!< Maximum spread angle of the spot light (in radians)\n" |
106 | "float occLight_SpotExponent (in int theId); //!< Attenuation of the spot light intensity (from 0 to 1)\n" |
107 | "\n" |
108 | "// Front material properties accessors\n" |
109 | "vec4 occFrontMaterial_Emission(void); //!< Emission color\n" |
110 | "vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection\n" |
111 | "vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection\n" |
112 | "vec4 occFrontMaterial_Specular(void); //!< Specular reflection\n" |
113 | "float occFrontMaterial_Shininess(void); //!< Specular exponent\n" |
114 | "float occFrontMaterial_Transparency(void); //!< Transparency coefficient\n" |
115 | "\n" |
116 | "// Back material properties accessors\n" |
117 | "vec4 occBackMaterial_Emission(void); //!< Emission color\n" |
118 | "vec4 occBackMaterial_Ambient(void); //!< Ambient reflection\n" |
119 | "vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection\n" |
120 | "vec4 occBackMaterial_Specular(void); //!< Specular reflection\n" |
121 | "float occBackMaterial_Shininess(void); //!< Specular exponent\n" |
122 | "float occBackMaterial_Transparency(void); //!< Transparency coefficient\n" |
123 | "\n" |
124 | "uniform vec4 occColor; //!< color value (in case of disabled lighting)\n" |
125 | "uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n" |
126 | "uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n" |
127 | "uniform sampler2D occActiveSampler; //!< Current active sampler\n" |
128 | "uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n" |
129 | "uniform float occPointSize; //!< point size\n" |
130 | "\n" |
a1073ae2 |
131 | "//! Parameters of blended order-independent transparency rendering algorithm\n" |
132 | "uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n" |
133 | "uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n" |
134 | "\n" |
ee5befae |
135 | "//! Parameters of clipping planes\n" |
136 | "uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n" |
137 | "uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n"; |