ogre-python 14.5.0__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Ogre/Bites.py +14 -0
- Ogre/Bullet.py +14 -0
- Ogre/Codec_Assimp.dll +0 -0
- Ogre/Codec_STBI.dll +0 -0
- Ogre/HighPy.py +389 -0
- Ogre/ImGui.py +12 -0
- Ogre/Numpy.py +80 -0
- Ogre/Ogre.py +12 -0
- Ogre/OgreBites.dll +0 -0
- Ogre/OgreBullet.dll +0 -0
- Ogre/OgreMain.dll +0 -0
- Ogre/OgreOverlay.dll +0 -0
- Ogre/OgrePaging.dll +0 -0
- Ogre/OgreRTShaderSystem.dll +0 -0
- Ogre/OgreTerrain.dll +0 -0
- Ogre/Overlay.py +14 -0
- Ogre/Plugin_DotScene.dll +0 -0
- Ogre/Plugin_GLSLangProgramManager.dll +0 -0
- Ogre/Plugin_OctreeSceneManager.dll +0 -0
- Ogre/Plugin_ParticleFX.dll +0 -0
- Ogre/RTShader.py +14 -0
- Ogre/RenderSystem_Direct3D11.dll +0 -0
- Ogre/RenderSystem_GL.dll +0 -0
- Ogre/RenderSystem_GL3Plus.dll +0 -0
- Ogre/RenderSystem_GLES2.dll +0 -0
- Ogre/RenderSystem_Tiny.dll +0 -0
- Ogre/RenderSystem_Vulkan.dll +0 -0
- Ogre/SDL2.dll +0 -0
- Ogre/Terrain.py +14 -0
- Ogre/_Bites.pyd +0 -0
- Ogre/_Bullet.pyd +0 -0
- Ogre/_ImGui.pyd +0 -0
- Ogre/_Ogre.pyd +0 -0
- Ogre/_Overlay.pyd +0 -0
- Ogre/_RTShader.pyd +0 -0
- Ogre/_Terrain.pyd +0 -0
- Ogre/__init__.py +2 -0
- Ogre/zlib.dll +0 -0
- ogre_python-14.5.0.data/data/Media/Main/DefaultShaders.metal +38 -0
- ogre_python-14.5.0.data/data/Media/Main/GLSL_GL3Support.glsl +110 -0
- ogre_python-14.5.0.data/data/Media/Main/HLSL_SM4Support.hlsl +124 -0
- ogre_python-14.5.0.data/data/Media/Main/OgreUnifiedShader.h +201 -0
- ogre_python-14.5.0.data/data/Media/Main/Shadow.material +85 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowBlend.frag +11 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowBlend.vert +12 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowExtrudeDirLight.vert +18 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowExtrudeDirLightFinite.vert +22 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowExtrudePointLight.vert +19 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowExtrudePointLightFinite.vert +22 -0
- ogre_python-14.5.0.data/data/Media/Main/ShadowVolumeExtude.program +41 -0
- ogre_python-14.5.0.data/data/Media/Main/spot_shadow_fade.dds +0 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/FFPLib_AlphaTest.glsl +45 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/FFPLib_Fog.glsl +92 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/FFPLib_Texturing.glsl +150 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/FFPLib_Transform.glsl +100 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/RTSLib_Colour.glsl +16 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/RTSLib_IBL.glsl +90 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/RTSLib_LTC.glsl +114 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/RTSLib_Lighting.glsl +18 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/RTSSamplers.material +18 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_CookTorrance.glsl +238 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_DualQuaternion.glsl +172 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_IntegratedPSSM.glsl +198 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_LayeredBlending.glsl +825 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_NormalMap.glsl +125 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_PerPixelLighting.glsl +183 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_TriplanarTexturing.glsl +47 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/SGXLib_WBOIT.glsl +19 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/dfgLUTmultiscatter.dds +0 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/ltc_1.dds +0 -0
- ogre_python-14.5.0.data/data/Media/RTShaderLib/ltc_2.dds +0 -0
- ogre_python-14.5.0.data/data/Media/Terrain/TerrainSurface.glsl +91 -0
- ogre_python-14.5.0.data/data/Media/Terrain/TerrainTransforms.glsl +36 -0
- ogre_python-14.5.0.data/data/Media/packs/SdkTrays.zip +0 -0
- ogre_python-14.5.0.data/data/Media/packs/profiler.zip +0 -0
- ogre_python-14.5.0.data/data/bin/plugins.cfg +27 -0
- ogre_python-14.5.0.data/data/bin/resources.cfg +12 -0
- ogre_python-14.5.0.dist-info/METADATA +148 -0
- ogre_python-14.5.0.dist-info/RECORD +83 -0
- ogre_python-14.5.0.dist-info/WHEEL +5 -0
- ogre_python-14.5.0.dist-info/licenses/AUTHORS +313 -0
- ogre_python-14.5.0.dist-info/licenses/LICENSE +21 -0
- ogre_python-14.5.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// This file is part of the OGRE project.
|
|
2
|
+
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
3
|
+
// of this distribution and at https://www.ogre3d.org/licensing.
|
|
4
|
+
|
|
5
|
+
vertex_program Ogre/ShadowBlendVP glsl glsles hlsl glslang
|
|
6
|
+
{
|
|
7
|
+
source ShadowBlend.vert
|
|
8
|
+
default_params
|
|
9
|
+
{
|
|
10
|
+
param_named_auto worldViewProj worldviewproj_matrix
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fragment_program Ogre/ShadowBlendFP glsl glsles hlsl glslang
|
|
15
|
+
{
|
|
16
|
+
source ShadowBlend.frag
|
|
17
|
+
default_params
|
|
18
|
+
{
|
|
19
|
+
param_named_auto shadowColor shadow_colour
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
vertex_program Ogre/ShadowExtrudePointLight glsl glsles hlsl
|
|
24
|
+
{
|
|
25
|
+
source ShadowExtrudePointLight.vert
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
vertex_program Ogre/ShadowExtrudeDirLight glsl glsles hlsl
|
|
29
|
+
{
|
|
30
|
+
source ShadowExtrudeDirLight.vert
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
vertex_program Ogre/ShadowExtrudePointLightFinite glsl glsles hlsl
|
|
34
|
+
{
|
|
35
|
+
source ShadowExtrudePointLightFinite.vert
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vertex_program Ogre/ShadowExtrudeDirLightFinite glsl glsles hlsl
|
|
39
|
+
{
|
|
40
|
+
source ShadowExtrudeDirLightFinite.vert
|
|
41
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//-----------------------------------------------------------------------------
|
|
2
|
+
// Program Name: FFPLib_AlphaTest
|
|
3
|
+
// Program Desc: Alpha test function.
|
|
4
|
+
// Program Type: Vertex/Pixel shader
|
|
5
|
+
// Language: GLSL
|
|
6
|
+
//-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
#define CMPF_ALWAYS_FAIL 0
|
|
9
|
+
#define CMPF_ALWAYS_PASS 1
|
|
10
|
+
#define CMPF_LESS 2
|
|
11
|
+
#define CMPF_LESS_EQUAL 3
|
|
12
|
+
#define CMPF_EQUAL 4
|
|
13
|
+
#define CMPF_NOT_EQUAL 5
|
|
14
|
+
#define CMPF_GREATER_EQUAL 6
|
|
15
|
+
#define CMPF_GREATER 7
|
|
16
|
+
|
|
17
|
+
bool Alpha_Func(in int func, in float alphaRef, in float alphaValue)
|
|
18
|
+
{
|
|
19
|
+
// ES2 does not have switch
|
|
20
|
+
if(func == CMPF_ALWAYS_PASS)
|
|
21
|
+
return true;
|
|
22
|
+
else if(func == CMPF_LESS)
|
|
23
|
+
return alphaValue < alphaRef;
|
|
24
|
+
else if(func == CMPF_LESS_EQUAL)
|
|
25
|
+
return alphaValue <= alphaRef;
|
|
26
|
+
else if(func == CMPF_EQUAL)
|
|
27
|
+
return alphaValue == alphaRef;
|
|
28
|
+
else if(func == CMPF_NOT_EQUAL)
|
|
29
|
+
return alphaValue != alphaRef;
|
|
30
|
+
else if(func == CMPF_GREATER_EQUAL)
|
|
31
|
+
return alphaValue >= alphaRef;
|
|
32
|
+
else if(func == CMPF_GREATER)
|
|
33
|
+
return alphaValue > alphaRef;
|
|
34
|
+
|
|
35
|
+
// CMPF_ALWAYS_FAIL and default
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
void FFP_Alpha_Test(in float func, in float alphaRef, in vec4 texel)
|
|
41
|
+
{
|
|
42
|
+
bool pass_ = Alpha_Func(int(func), alphaRef, texel.a);
|
|
43
|
+
if (!pass_)
|
|
44
|
+
discard;
|
|
45
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
-----------------------------------------------------------------------------
|
|
3
|
+
This source file is part of OGRE
|
|
4
|
+
(Object-oriented Graphics Rendering Engine)
|
|
5
|
+
For the latest info, see http://www.ogre3d.org
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2000-2014 Torus Knot Software Ltd
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
25
|
+
-----------------------------------------------------------------------------
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
//-----------------------------------------------------------------------------
|
|
29
|
+
// Program Name: FFPLib_Fog
|
|
30
|
+
// Program Desc: Fog functions of the FFP.
|
|
31
|
+
// Program Type: Vertex/Pixel shader
|
|
32
|
+
// Language: GLSL
|
|
33
|
+
// Notes: Implements core functions needed by FFPFog class.
|
|
34
|
+
// Based on fog engine.
|
|
35
|
+
// See http://msdn.microsoft.com/en-us/library/bb173398.aspx
|
|
36
|
+
// Vertex based fog: the w component of the out position is used
|
|
37
|
+
// as the distance parameter to fog formulas. This is basically the z coordinate
|
|
38
|
+
// in world space. See pixel fog under D3D docs. The fog factor is computed according
|
|
39
|
+
// to each formula, then clamped and output to the pixel shader.
|
|
40
|
+
// Pixel based fog: the w component of the out position is passed to pixel shader
|
|
41
|
+
// that computes the fog factor based on it.
|
|
42
|
+
// Both techniques use the fog factor in the end of the pixel shader to blend
|
|
43
|
+
// the output color with the fog color.
|
|
44
|
+
//-----------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
#define FOG_EXP 1
|
|
47
|
+
#define FOG_EXP2 2
|
|
48
|
+
#define FOG_LINEAR 3
|
|
49
|
+
|
|
50
|
+
//-----------------------------------------------------------------------------
|
|
51
|
+
void FFP_FogFactor(in float depth,
|
|
52
|
+
in vec4 fogParams,
|
|
53
|
+
out float oFogFactor)
|
|
54
|
+
{
|
|
55
|
+
float distance = abs(depth);
|
|
56
|
+
|
|
57
|
+
#if FOG_TYPE == FOG_LINEAR
|
|
58
|
+
float fogFactor = (fogParams.z - distance) * fogParams.w;
|
|
59
|
+
#elif FOG_TYPE == FOG_EXP
|
|
60
|
+
float x = distance*fogParams.x;
|
|
61
|
+
float fogFactor = 1.0 / exp(x);
|
|
62
|
+
#elif FOG_TYPE == FOG_EXP2
|
|
63
|
+
float x = (distance*fogParams.x*distance*fogParams.x);
|
|
64
|
+
float fogFactor = 1.0 / exp(x);
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
oFogFactor = saturate(fogFactor);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//-----------------------------------------------------------------------------
|
|
71
|
+
void FFP_PixelFog_PositionDepth(in mat4 mWorld,
|
|
72
|
+
in vec3 cameraPos,
|
|
73
|
+
in vec4 pos,
|
|
74
|
+
out vec3 oPosView,
|
|
75
|
+
out float oDepth)
|
|
76
|
+
{
|
|
77
|
+
vec4 vOutPos = mul(mWorld, pos);
|
|
78
|
+
oPosView = vOutPos.xyz - cameraPos;
|
|
79
|
+
oDepth = length(oPosView);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//-----------------------------------------------------------------------------
|
|
83
|
+
void FFP_PixelFog(in float depth,
|
|
84
|
+
in vec4 fogParams,
|
|
85
|
+
in vec4 fogColor,
|
|
86
|
+
in vec4 baseColor,
|
|
87
|
+
out vec4 oColor)
|
|
88
|
+
{
|
|
89
|
+
float fogFactor = 0.0;
|
|
90
|
+
FFP_FogFactor(depth, fogParams, fogFactor);
|
|
91
|
+
oColor = mix(fogColor, baseColor, fogFactor);
|
|
92
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
-----------------------------------------------------------------------------
|
|
3
|
+
This source file is part of OGRE
|
|
4
|
+
(Object-oriented Graphics Rendering Engine)
|
|
5
|
+
For the latest info, see http://www.ogre3d.org
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2000-2014 Torus Knot Software Ltd
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
25
|
+
-----------------------------------------------------------------------------
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
//-----------------------------------------------------------------------------
|
|
29
|
+
// Program Name: FFPLib_Texturing
|
|
30
|
+
// Program Desc: Texture functions of the FFP.
|
|
31
|
+
// Program Type: Vertex/Pixel shader
|
|
32
|
+
// Language: GLSL
|
|
33
|
+
// Notes: Implements core functions for FFPTexturing class.
|
|
34
|
+
// based on texturing operations needed by render system.
|
|
35
|
+
// Implements texture coordinate processing:
|
|
36
|
+
// see http://msdn.microsoft.com/en-us/library/bb206247.aspx
|
|
37
|
+
// Implements texture blending operation:
|
|
38
|
+
// see http://msdn.microsoft.com/en-us/library/bb206241.aspx
|
|
39
|
+
//-----------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
//-----------------------------------------------------------------------------
|
|
42
|
+
void FFP_TransformTexCoord(in mat4 m, in vec2 v, out vec2 vOut)
|
|
43
|
+
{
|
|
44
|
+
vOut = mul(m, vec4(v, 0.0, 1.0)).xy;
|
|
45
|
+
}
|
|
46
|
+
//-----------------------------------------------------------------------------
|
|
47
|
+
void FFP_TransformTexCoord(in mat4 m, in vec4 v, out vec2 vOut)
|
|
48
|
+
{
|
|
49
|
+
vOut = mul(m, v).xy;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//-----------------------------------------------------------------------------
|
|
53
|
+
void FFP_TransformTexCoord(in mat4 m, in vec3 v, out vec3 vOut)
|
|
54
|
+
{
|
|
55
|
+
vOut = mul(m, vec4(v, 1.0)).xyz;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//-----------------------------------------------------------------------------
|
|
59
|
+
void FFP_GenerateTexCoord_EnvMap_Normal(in mat3 mWorldIT,
|
|
60
|
+
in vec3 vNormal,
|
|
61
|
+
out vec3 vOut)
|
|
62
|
+
{
|
|
63
|
+
vOut = normalize(mul(mWorldIT, vNormal));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//-----------------------------------------------------------------------------
|
|
67
|
+
void FFP_GenerateTexCoord_EnvMap_Sphere(in mat4 mWorldView,
|
|
68
|
+
in mat3 mWorldIT,
|
|
69
|
+
in vec4 vPos,
|
|
70
|
+
in vec3 vNormal,
|
|
71
|
+
out vec2 vOut)
|
|
72
|
+
{
|
|
73
|
+
vec3 normal = normalize( mul(mWorldIT, vNormal));
|
|
74
|
+
vec3 eyedir = normalize(mul(mWorldView, vPos)).xyz;
|
|
75
|
+
vec3 r = reflect(eyedir, normal);
|
|
76
|
+
r.z += 1.0;
|
|
77
|
+
float two_p = 2.0 * length(r);
|
|
78
|
+
vOut = vec2(0.5 + r.x / two_p, 0.5 - r.y / two_p);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//-----------------------------------------------------------------------------
|
|
82
|
+
void FFP_GenerateTexCoord_EnvMap_Reflect(in mat4 mWorld,
|
|
83
|
+
in mat4 mWorldIT,
|
|
84
|
+
in vec3 vCamPos,
|
|
85
|
+
in vec3 vNormal,
|
|
86
|
+
in vec4 vPos,
|
|
87
|
+
out vec3 vOut)
|
|
88
|
+
{
|
|
89
|
+
vec3 vWorldNormal = normalize(mul(mWorldIT, vec4(vNormal, 0.0)).xyz);
|
|
90
|
+
vec3 vWorldPos = mul(mWorld, vPos).xyz;
|
|
91
|
+
vec3 vEyeDir = normalize(vWorldPos - vCamPos);
|
|
92
|
+
|
|
93
|
+
vec3 vReflect = reflect(vEyeDir, vWorldNormal);
|
|
94
|
+
vReflect.z *= -1.0;
|
|
95
|
+
|
|
96
|
+
vOut = vReflect;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//-----------------------------------------------------------------------------
|
|
100
|
+
void FFP_AddSmooth(in float vIn0, in float vIn1, out float vOut)
|
|
101
|
+
{
|
|
102
|
+
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//-----------------------------------------------------------------------------
|
|
106
|
+
void FFP_AddSmooth(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
|
|
107
|
+
{
|
|
108
|
+
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//-----------------------------------------------------------------------------
|
|
112
|
+
void FFP_AddSmooth(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
|
|
113
|
+
{
|
|
114
|
+
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//-----------------------------------------------------------------------------
|
|
118
|
+
void FFP_AddSmooth(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
|
|
119
|
+
{
|
|
120
|
+
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
|
|
121
|
+
}
|
|
122
|
+
//-----------------------------------------------------------------------------
|
|
123
|
+
void FFP_DotProduct(in float vIn0, in float vIn1, out float vOut)
|
|
124
|
+
{
|
|
125
|
+
vOut = dot(vIn0, vIn1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//-----------------------------------------------------------------------------
|
|
129
|
+
void FFP_DotProduct(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
|
|
130
|
+
{
|
|
131
|
+
vOut = vec2_splat(dot(vIn0, vIn1));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//-----------------------------------------------------------------------------
|
|
135
|
+
void FFP_DotProduct(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
|
|
136
|
+
{
|
|
137
|
+
vOut = vec3_splat(dot(vIn0, vIn1));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//-----------------------------------------------------------------------------
|
|
141
|
+
void FFP_DotProduct(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
|
|
142
|
+
{
|
|
143
|
+
vOut = vec4_splat(dot(vIn0, vIn1));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
void TextureUVMix(in sampler2D tex, in vec2 uv, in vec4 params, out vec4 color)
|
|
147
|
+
{
|
|
148
|
+
color = mix(texture2D(tex, uv), texture2D(tex, -vec2(uv.y, uv.x) * params.x), params.y);
|
|
149
|
+
ENABLE_LINEAR_COLOUR(color);
|
|
150
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
-----------------------------------------------------------------------------
|
|
3
|
+
This source file is part of OGRE
|
|
4
|
+
(Object-oriented Graphics Rendering Engine)
|
|
5
|
+
For the latest info, see http://www.ogre3d.org
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2000-2014 Torus Knot Software Ltd
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
|
25
|
+
-----------------------------------------------------------------------------
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
//-----------------------------------------------------------------------------
|
|
29
|
+
// Program Name: FFPLib_Transform
|
|
30
|
+
// Program Desc: Transform functions of the FFP.
|
|
31
|
+
// Program Type: Vertex shader
|
|
32
|
+
// Language: GLSL
|
|
33
|
+
// Notes: Implements core functions for FFPTransform class.
|
|
34
|
+
// based on transform engine.
|
|
35
|
+
// See http://msdn.microsoft.com/en-us/library/bb206269.aspx
|
|
36
|
+
//-----------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
//-----------------------------------------------------------------------------
|
|
39
|
+
void FFP_Transform(in mat4 m,
|
|
40
|
+
in vec4 v,
|
|
41
|
+
out vec3 vOut)
|
|
42
|
+
{
|
|
43
|
+
vOut = mul(m, v).xyz;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#ifdef OGRE_HLSL
|
|
47
|
+
void FFP_Transform(in float3x4 m,
|
|
48
|
+
in float4 v,
|
|
49
|
+
out float3 vOut)
|
|
50
|
+
{
|
|
51
|
+
vOut = mul(m, v);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//-----------------------------------------------------------------------------
|
|
55
|
+
void FFP_Transform(in float3x4 m,
|
|
56
|
+
in float3 v,
|
|
57
|
+
out float3 vOut)
|
|
58
|
+
{
|
|
59
|
+
vOut = mul((float3x3)m, v);
|
|
60
|
+
}
|
|
61
|
+
#elif !defined(OGRE_GLSLES) || OGRE_GLSLES > 100
|
|
62
|
+
//-----------------------------------------------------------------------------
|
|
63
|
+
void FFP_Transform(in mat3x4 m,
|
|
64
|
+
in vec4 v,
|
|
65
|
+
out vec3 vOut)
|
|
66
|
+
{
|
|
67
|
+
/* transpose non-square uniform matrix for correct row-major > column-major mapping
|
|
68
|
+
* to keep the indexing inside the shader so mat[0] returns the same data in both GLSL and HLSL
|
|
69
|
+
* although it will be the first row in HLSL and the first column in GLSL
|
|
70
|
+
*/
|
|
71
|
+
vOut = v * m;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
void FFP_Transform(in mat3x4 m,
|
|
75
|
+
in vec3 v,
|
|
76
|
+
out vec3 vOut)
|
|
77
|
+
{
|
|
78
|
+
vOut = v * mat3(m);
|
|
79
|
+
}
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
//-----------------------------------------------------------------------------
|
|
83
|
+
void FFP_Transform(in mat4 m,
|
|
84
|
+
in vec3 v,
|
|
85
|
+
out vec3 vOut)
|
|
86
|
+
{
|
|
87
|
+
#ifdef OGRE_HLSL
|
|
88
|
+
vOut = mul((float3x3)m, v);
|
|
89
|
+
#else
|
|
90
|
+
vOut = mat3(m) * v;
|
|
91
|
+
#endif
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//-----------------------------------------------------------------------------
|
|
95
|
+
void FFP_DerivePointSize(in vec4 params,
|
|
96
|
+
in float d,
|
|
97
|
+
out float sz)
|
|
98
|
+
{
|
|
99
|
+
sz = params.x/sqrt(params.y + params.z*d + params.w*d*d);
|
|
100
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This file is part of the OGRE project.
|
|
2
|
+
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
3
|
+
// of this distribution and at https://www.ogre3d.org/licensing.
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
|
|
6
|
+
#ifdef USE_LINEAR_COLOURS
|
|
7
|
+
#define ENABLE_LINEAR_COLOUR(colour) colour.rgb = pow(colour.rgb, vec3_splat(2.2))
|
|
8
|
+
#else
|
|
9
|
+
#define ENABLE_LINEAR_COLOUR(colour)
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#if defined(USE_LINEAR_COLOURS) && !defined(TARGET_CONSUMES_LINEAR)
|
|
13
|
+
#define COLOUR_TRANSFER(colour) colour.rgb = pow(colour.rgb, vec3_splat(1.0/2.2))
|
|
14
|
+
#else
|
|
15
|
+
#define COLOUR_TRANSFER(colour)
|
|
16
|
+
#endif
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// This file is part of the OGRE project.
|
|
2
|
+
// code adapted from Google Filament
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
vec3 specularDFG(const PixelParams pixel) {
|
|
6
|
+
return mix(pixel.dfg.xxx, pixel.dfg.yyy, pixel.f0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
vec3 decodeDataForIBL(const vec4 data) {
|
|
10
|
+
return data.rgb;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
vec3 Irradiance_RoughnessOne(samplerCube light_iblSpecular, const vec3 n, float iblRoughnessOneLevel) {
|
|
14
|
+
// note: lod used is always integer, hopefully the hardware skips tri-linear filtering
|
|
15
|
+
return decodeDataForIBL(textureCubeLod(light_iblSpecular, n, iblRoughnessOneLevel));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
vec3 PrefilteredDFG_LUT(sampler2D light_iblDFG, float lod, float NoV) {
|
|
19
|
+
// coord = sqrt(linear_roughness), which is the mapping used by cmgen.
|
|
20
|
+
// OGRE Specific: y is flipped compared to Filament code
|
|
21
|
+
return texture2DLod(light_iblDFG, vec2(NoV, 1.0 - lod), 0.0).rgb;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
float perceptualRoughnessToLod(float iblRoughnessOneLevel, float perceptualRoughness) {
|
|
25
|
+
// The mapping below is a quadratic fit for log2(perceptualRoughness)+iblRoughnessOneLevel when
|
|
26
|
+
// iblRoughnessOneLevel is 4. We found empirically that this mapping works very well for
|
|
27
|
+
// a 256 cubemap with 5 levels used. But also scales well for other iblRoughnessOneLevel values.
|
|
28
|
+
return iblRoughnessOneLevel * perceptualRoughness * (2.0 - perceptualRoughness);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
vec3 prefilteredRadiance(samplerCube light_iblSpecular, const vec3 r, float perceptualRoughness, float iblRoughnessOneLevel) {
|
|
32
|
+
float lod = perceptualRoughnessToLod(iblRoughnessOneLevel, perceptualRoughness);
|
|
33
|
+
return decodeDataForIBL(textureCubeLod(light_iblSpecular, r, lod));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec3 getSpecularDominantDirection(const vec3 n, const vec3 r, float roughness) {
|
|
37
|
+
return mix(r, n, roughness * roughness);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void evaluateIBL(inout PixelParams pixel,
|
|
41
|
+
in vec3 vNormal,
|
|
42
|
+
in vec3 viewPos,
|
|
43
|
+
in mat4 invViewMat,
|
|
44
|
+
in sampler2D dfgTex,
|
|
45
|
+
in samplerCube iblEnvTex,
|
|
46
|
+
in float iblRoughnessOneLevel,
|
|
47
|
+
in float iblLuminance,
|
|
48
|
+
inout vec3 color)
|
|
49
|
+
{
|
|
50
|
+
vec3 shading_normal = normalize(vNormal);
|
|
51
|
+
vec3 shading_view = -normalize(viewPos);
|
|
52
|
+
float shading_NoV = clampNoV(abs(dot(shading_normal, shading_view)));
|
|
53
|
+
|
|
54
|
+
// the above is currently duplicated with CookTorrance
|
|
55
|
+
|
|
56
|
+
vec3 shading_reflected = reflect(-shading_view, shading_normal);
|
|
57
|
+
|
|
58
|
+
// Pre-filtered DFG term used for image-based lighting
|
|
59
|
+
pixel.dfg = PrefilteredDFG_LUT(dfgTex, pixel.perceptualRoughness, shading_NoV);
|
|
60
|
+
|
|
61
|
+
vec3 E = specularDFG(pixel);
|
|
62
|
+
vec3 r = getSpecularDominantDirection(shading_normal, shading_reflected, pixel.roughness);
|
|
63
|
+
|
|
64
|
+
// OGRE specific: convert r and n back to world space for texture sampling
|
|
65
|
+
r = normalize(mul(invViewMat, vec4(r, 0.0)).xyz);
|
|
66
|
+
r.z *= -1.0;
|
|
67
|
+
shading_normal = normalize(mul(invViewMat, vec4(shading_normal, 0.0)).xyz);
|
|
68
|
+
|
|
69
|
+
// specular layer
|
|
70
|
+
vec3 Fr = E * prefilteredRadiance(iblEnvTex, r, pixel.perceptualRoughness, iblRoughnessOneLevel);
|
|
71
|
+
|
|
72
|
+
vec3 diffuseIrradiance = Irradiance_RoughnessOne(iblEnvTex, shading_normal, iblRoughnessOneLevel);
|
|
73
|
+
vec3 Fd = pixel.diffuseColor * diffuseIrradiance * (1.0 - E);
|
|
74
|
+
|
|
75
|
+
Fr *= iblLuminance;
|
|
76
|
+
Fd *= iblLuminance;
|
|
77
|
+
|
|
78
|
+
// Combine all terms
|
|
79
|
+
// Note: iblLuminance is already premultiplied by the exposure
|
|
80
|
+
#ifndef USE_LINEAR_COLOURS
|
|
81
|
+
color = pow(color, vec3_splat(2.2)); // gamma to linear
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
color += Fr + Fd;
|
|
85
|
+
|
|
86
|
+
#ifndef USE_LINEAR_COLOURS
|
|
87
|
+
color = pow(color, vec3_splat(1.0/2.2)); // linear to gamma
|
|
88
|
+
color = saturate(color);
|
|
89
|
+
#endif
|
|
90
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
|
|
2
|
+
// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
|
|
3
|
+
// code: https://github.com/selfshadow/ltc_code/
|
|
4
|
+
// also: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
|
|
5
|
+
// adapted for Ogre by Pavel Rojtberg
|
|
6
|
+
|
|
7
|
+
#define LUT_SIZE 64.0
|
|
8
|
+
#define LUT_SCALE ((LUT_SIZE - 1.0)/LUT_SIZE)
|
|
9
|
+
#define LUT_BIAS (0.5/LUT_SIZE)
|
|
10
|
+
|
|
11
|
+
vec3 IntegrateEdgeVec(vec3 v1, vec3 v2)
|
|
12
|
+
{
|
|
13
|
+
float x = dot(v1, v2);
|
|
14
|
+
float y = abs(x);
|
|
15
|
+
|
|
16
|
+
float a = 0.8543985 + (0.4965155 + 0.0145206*y)*y;
|
|
17
|
+
float b = 3.4175940 + (4.1616724 + y)*y;
|
|
18
|
+
float v = a / b;
|
|
19
|
+
|
|
20
|
+
float theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(max(1.0 - x*x, 1e-7)) - v;
|
|
21
|
+
|
|
22
|
+
return cross(v1, v2)*theta_sintheta;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
float LTC_Evaluate(vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4], sampler2D ltc_2)
|
|
26
|
+
{
|
|
27
|
+
vec3 dir = points[0] - P;
|
|
28
|
+
vec3 lightDir = cross(points[1] - points[0], points[3] - points[0]);
|
|
29
|
+
if(dot(dir, lightDir) < 0.0)
|
|
30
|
+
return 0.0;
|
|
31
|
+
|
|
32
|
+
// construct orthonormal basis around N
|
|
33
|
+
vec3 T1, T2;
|
|
34
|
+
T1 = normalize(V - N*dot(V, N));
|
|
35
|
+
T2 = cross(N, T1);
|
|
36
|
+
|
|
37
|
+
// rotate area light in (T1, T2, N) basis
|
|
38
|
+
Minv = mul(Minv, mtxFromRows(T1, T2, N));
|
|
39
|
+
|
|
40
|
+
// polygon
|
|
41
|
+
vec3 L[4];
|
|
42
|
+
L[0] = mul(Minv, points[0] - P);
|
|
43
|
+
L[1] = mul(Minv, points[1] - P);
|
|
44
|
+
L[2] = mul(Minv, points[2] - P);
|
|
45
|
+
L[3] = mul(Minv, points[3] - P);
|
|
46
|
+
|
|
47
|
+
// project rect onto sphere
|
|
48
|
+
L[0] = normalize(L[0]);
|
|
49
|
+
L[1] = normalize(L[1]);
|
|
50
|
+
L[2] = normalize(L[2]);
|
|
51
|
+
L[3] = normalize(L[3]);
|
|
52
|
+
|
|
53
|
+
vec3 vsum = vec3_splat(0.0);
|
|
54
|
+
|
|
55
|
+
vsum += IntegrateEdgeVec(L[0], L[1]);
|
|
56
|
+
vsum += IntegrateEdgeVec(L[1], L[2]);
|
|
57
|
+
vsum += IntegrateEdgeVec(L[2], L[3]);
|
|
58
|
+
vsum += IntegrateEdgeVec(L[3], L[0]);
|
|
59
|
+
|
|
60
|
+
float len = length(vsum);
|
|
61
|
+
float z = vsum.z/len;
|
|
62
|
+
|
|
63
|
+
// clipless approximation: tabulated horizon-clipped sphere
|
|
64
|
+
// visually better than alternatives, but produces artifacts at low roughness values
|
|
65
|
+
vec2 uv = vec2(z*0.5 + 0.5, len);
|
|
66
|
+
uv = uv*LUT_SCALE + LUT_BIAS;
|
|
67
|
+
|
|
68
|
+
float scale = texture2D(ltc_2, uv).w;
|
|
69
|
+
return len*scale;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void InitRectPoints(vec3 center, vec3 ex, vec3 ey, out vec3 points[4])
|
|
73
|
+
{
|
|
74
|
+
points[0] = center - ex - ey;
|
|
75
|
+
points[1] = center + ex - ey;
|
|
76
|
+
points[2] = center + ex + ey;
|
|
77
|
+
points[3] = center - ex + ey;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
void evaluateRectLight(sampler2D ltc_1, sampler2D ltc_2, float roughness, vec3 N, vec3 pos, vec3 lpos, vec3 halfwidth, vec3 halfheight,
|
|
81
|
+
inout vec3 scol, inout vec3 dcol)
|
|
82
|
+
{
|
|
83
|
+
vec3 points[4];
|
|
84
|
+
InitRectPoints(lpos, halfwidth, halfheight, points);
|
|
85
|
+
|
|
86
|
+
vec3 V = -normalize(pos);
|
|
87
|
+
|
|
88
|
+
float ndotv = saturate(dot(N, V));
|
|
89
|
+
vec2 uv = vec2(roughness, sqrt(1.0 - ndotv));
|
|
90
|
+
uv = uv*LUT_SCALE + LUT_BIAS;
|
|
91
|
+
|
|
92
|
+
vec4 t1 = texture2D(ltc_1, uv);
|
|
93
|
+
|
|
94
|
+
mat3 Minv = mtxFromCols(
|
|
95
|
+
vec3(t1.x, 0.0, t1.y),
|
|
96
|
+
vec3( 0.0, 1.0, 0.0),
|
|
97
|
+
vec3(t1.z, 0.0, t1.w)
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
float spec = LTC_Evaluate(N, V, pos, Minv, points, ltc_2);
|
|
101
|
+
|
|
102
|
+
// LTC Fresnel Approximation by Stephen Hill
|
|
103
|
+
// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf
|
|
104
|
+
vec4 t2 = texture2D(ltc_2, uv);
|
|
105
|
+
scol = (scol*t2.x + (1.0 - scol)*t2.y)*spec;
|
|
106
|
+
|
|
107
|
+
mat3 Meye = mat3(
|
|
108
|
+
vec3(1.0, 0.0, 0.0),
|
|
109
|
+
vec3(0.0, 1.0, 0.0),
|
|
110
|
+
vec3(0.0, 0.0, 1.0)
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
dcol *= LTC_Evaluate(N, V, pos, Meye, points, ltc_2);
|
|
114
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file is part of the OGRE project.
|
|
2
|
+
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
3
|
+
// of this distribution and at https://www.ogre3d.org/licensing.
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
|
|
6
|
+
#define M_PI 3.14159265359
|
|
7
|
+
|
|
8
|
+
float getDistanceAttenuation(const vec3 params, float distance)
|
|
9
|
+
{
|
|
10
|
+
return 1.0 / (params.x + params.y * distance + params.z * distance * distance);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
float getAngleAttenuation(const vec3 params, const vec3 lightDir, const vec3 toLight)
|
|
14
|
+
{
|
|
15
|
+
float rho = dot(-lightDir, toLight);
|
|
16
|
+
float fSpotE = saturate((rho - params.y) / (params.x - params.y));
|
|
17
|
+
return pow(fSpotE, params.z);
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
sampler Ogre/ShadowSampler
|
|
2
|
+
{
|
|
3
|
+
tex_address_mode border
|
|
4
|
+
tex_border_colour 1 1 1 1
|
|
5
|
+
filtering linear linear none
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
sampler Ogre/DepthShadowSampler : Ogre/ShadowSampler
|
|
9
|
+
{
|
|
10
|
+
compare_test on
|
|
11
|
+
comp_func less_equal
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
sampler Ogre/LtcLUTSampler
|
|
15
|
+
{
|
|
16
|
+
filtering point linear point
|
|
17
|
+
tex_address_mode clamp
|
|
18
|
+
}
|