ogre-python 14.2.3__cp312-cp312-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/ImGui.py +12 -0
- Ogre/Numpy.py +59 -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.2.3.data/data/Media/Main/DefaultShaders.metal +38 -0
- ogre_python-14.2.3.data/data/Media/Main/GLSL_GL3Support.glsl +97 -0
- ogre_python-14.2.3.data/data/Media/Main/HLSL_SM4Support.hlsl +98 -0
- ogre_python-14.2.3.data/data/Media/Main/OgreUnifiedShader.h +183 -0
- ogre_python-14.2.3.data/data/Media/Main/Shadow.material +85 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowBlend.frag +11 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowBlend.vert +12 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowExtrudeDirLight.vert +18 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowExtrudeDirLightFinite.vert +22 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowExtrudePointLight.vert +19 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowExtrudePointLightFinite.vert +22 -0
- ogre_python-14.2.3.data/data/Media/Main/ShadowVolumeExtude.program +41 -0
- ogre_python-14.2.3.data/data/Media/Main/spot_shadow_fade.dds +0 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/FFPLib_AlphaTest.glsl +45 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/FFPLib_Fog.glsl +92 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/FFPLib_Texturing.glsl +144 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/FFPLib_Transform.glsl +100 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/RTSLib_IBL.glsl +88 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/RTSLib_LTC.glsl +114 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/RTSLib_Lighting.glsl +18 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/RTSSamplers.material +17 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_CookTorrance.glsl +246 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_DualQuaternion.glsl +172 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_IntegratedPSSM.glsl +183 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_LayeredBlending.glsl +825 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_NormalMap.glsl +125 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_PerPixelLighting.glsl +172 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_TriplanarTexturing.glsl +47 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/SGXLib_WBOIT.glsl +19 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/dfgLUTmultiscatter.dds +0 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/ltc_1.dds +0 -0
- ogre_python-14.2.3.data/data/Media/RTShaderLib/ltc_2.dds +0 -0
- ogre_python-14.2.3.data/data/Media/Terrain/TerrainSurface.glsl +83 -0
- ogre_python-14.2.3.data/data/Media/Terrain/TerrainTransforms.glsl +36 -0
- ogre_python-14.2.3.data/data/Media/packs/SdkTrays.zip +0 -0
- ogre_python-14.2.3.data/data/Media/packs/profiler.zip +0 -0
- ogre_python-14.2.3.data/data/bin/plugins.cfg +27 -0
- ogre_python-14.2.3.data/data/bin/resources.cfg +12 -0
- ogre_python-14.2.3.dist-info/AUTHORS +312 -0
- ogre_python-14.2.3.dist-info/LICENSE +21 -0
- ogre_python-14.2.3.dist-info/METADATA +125 -0
- ogre_python-14.2.3.dist-info/RECORD +81 -0
- ogre_python-14.2.3.dist-info/WHEEL +5 -0
- ogre_python-14.2.3.dist-info/top_level.txt +1 -0
Ogre/Bites.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
import Ogre.Ogre
|
|
9
|
+
|
|
10
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
11
|
+
if __package__ or "." in __name__:
|
|
12
|
+
from ._Bites import *
|
|
13
|
+
else:
|
|
14
|
+
from _Bites import *
|
Ogre/Bullet.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
import Ogre.Ogre
|
|
9
|
+
|
|
10
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
11
|
+
if __package__ or "." in __name__:
|
|
12
|
+
from ._Bullet import *
|
|
13
|
+
else:
|
|
14
|
+
from _Bullet import *
|
Ogre/Codec_Assimp.dll
ADDED
|
Binary file
|
Ogre/Codec_STBI.dll
ADDED
|
Binary file
|
Ogre/ImGui.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
9
|
+
if __package__ or "." in __name__:
|
|
10
|
+
from ._ImGui import *
|
|
11
|
+
else:
|
|
12
|
+
from _ImGui import *
|
Ogre/Numpy.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Ogre
|
|
2
|
+
|
|
3
|
+
import ctypes
|
|
4
|
+
import numpy.ctypeslib as npc
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
def AsDataStream(arr):
|
|
8
|
+
"""
|
|
9
|
+
copy numpy array to Ogre.MemoryDataStream that can be used in Ogre
|
|
10
|
+
@param arr: some numpy array
|
|
11
|
+
"""
|
|
12
|
+
size = int(np.prod(arr.shape) * arr.dtype.itemsize)
|
|
13
|
+
ret = Ogre.MemoryDataStream(size)
|
|
14
|
+
tp = ctypes.POINTER(ctypes.c_ubyte)
|
|
15
|
+
np_view = npc.as_array(ctypes.cast(int(ret.getPtr()), tp), (size, ))
|
|
16
|
+
np_view[:] = arr.ravel().view(np.ubyte)
|
|
17
|
+
|
|
18
|
+
return ret
|
|
19
|
+
|
|
20
|
+
def view(o):
|
|
21
|
+
"""
|
|
22
|
+
writable numpy view to the ogre data types
|
|
23
|
+
|
|
24
|
+
take care that the ogre type does not get released while the view is used.
|
|
25
|
+
e.g. this is invalid
|
|
26
|
+
|
|
27
|
+
v = Ogre.Vector3()
|
|
28
|
+
return OgreNumpy.view(v)
|
|
29
|
+
|
|
30
|
+
instead do
|
|
31
|
+
return OgreNumpy.view(v).copy()
|
|
32
|
+
|
|
33
|
+
to pass numpy arrays into Ogre use AsDataStream()
|
|
34
|
+
"""
|
|
35
|
+
tp = ctypes.POINTER(ctypes.c_float)
|
|
36
|
+
|
|
37
|
+
if isinstance(o, Ogre.Vector2):
|
|
38
|
+
shape = (2,)
|
|
39
|
+
ptr = o.this
|
|
40
|
+
elif isinstance(o, Ogre.Vector3):
|
|
41
|
+
shape = (3,)
|
|
42
|
+
ptr = o.this
|
|
43
|
+
elif isinstance(o, Ogre.Vector4):
|
|
44
|
+
shape = (4,)
|
|
45
|
+
ptr = o.this
|
|
46
|
+
elif isinstance(o, Ogre.Matrix3):
|
|
47
|
+
shape = (3, 3)
|
|
48
|
+
ptr = o.this
|
|
49
|
+
elif isinstance(o, Ogre.Matrix4):
|
|
50
|
+
shape = (4, 4)
|
|
51
|
+
ptr = o.this
|
|
52
|
+
elif isinstance(o, Ogre.PixelBox):
|
|
53
|
+
tp = ctypes.POINTER(ctypes.c_uint8)
|
|
54
|
+
shape = (o.getHeight(), o.getWidth(), Ogre.PixelUtil.getNumElemBytes(o.format))
|
|
55
|
+
ptr = o.data
|
|
56
|
+
else:
|
|
57
|
+
raise TypeError("do not know how to map '{}'".format(type(o).__name__))
|
|
58
|
+
|
|
59
|
+
return npc.as_array(ctypes.cast(int(ptr), tp), shape)
|
Ogre/Ogre.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
9
|
+
if __package__ or "." in __name__:
|
|
10
|
+
from ._Ogre import *
|
|
11
|
+
else:
|
|
12
|
+
from _Ogre import *
|
Ogre/OgreBites.dll
ADDED
|
Binary file
|
Ogre/OgreBullet.dll
ADDED
|
Binary file
|
Ogre/OgreMain.dll
ADDED
|
Binary file
|
Ogre/OgreOverlay.dll
ADDED
|
Binary file
|
Ogre/OgrePaging.dll
ADDED
|
Binary file
|
|
Binary file
|
Ogre/OgreTerrain.dll
ADDED
|
Binary file
|
Ogre/Overlay.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
import Ogre.Ogre
|
|
9
|
+
|
|
10
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
11
|
+
if __package__ or "." in __name__:
|
|
12
|
+
from ._Overlay import *
|
|
13
|
+
else:
|
|
14
|
+
from _Overlay import *
|
Ogre/Plugin_DotScene.dll
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
Ogre/RTShader.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
import Ogre.Ogre
|
|
9
|
+
|
|
10
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
11
|
+
if __package__ or "." in __name__:
|
|
12
|
+
from ._RTShader import *
|
|
13
|
+
else:
|
|
14
|
+
from _RTShader import *
|
|
Binary file
|
Ogre/RenderSystem_GL.dll
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
Ogre/SDL2.dll
ADDED
|
Binary file
|
Ogre/Terrain.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.2.1
|
|
3
|
+
#
|
|
4
|
+
# Do not make changes to this file unless you know what you are doing - modify
|
|
5
|
+
# the SWIG interface file instead.
|
|
6
|
+
|
|
7
|
+
from sys import version_info as _swig_python_version_info
|
|
8
|
+
import Ogre.Ogre
|
|
9
|
+
|
|
10
|
+
# Pull in all the attributes from the low-level C/C++ module
|
|
11
|
+
if __package__ or "." in __name__:
|
|
12
|
+
from ._Terrain import *
|
|
13
|
+
else:
|
|
14
|
+
from _Terrain import *
|
Ogre/_Bites.pyd
ADDED
|
Binary file
|
Ogre/_Bullet.pyd
ADDED
|
Binary file
|
Ogre/_ImGui.pyd
ADDED
|
Binary file
|
Ogre/_Ogre.pyd
ADDED
|
Binary file
|
Ogre/_Overlay.pyd
ADDED
|
Binary file
|
Ogre/_RTShader.pyd
ADDED
|
Binary file
|
Ogre/_Terrain.pyd
ADDED
|
Binary file
|
Ogre/__init__.py
ADDED
Ogre/zlib.dll
ADDED
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#include "OgreUnifiedShader.h"
|
|
2
|
+
|
|
3
|
+
struct RasterizerData
|
|
4
|
+
{
|
|
5
|
+
vec4 pos [[position]];
|
|
6
|
+
vec2 uv;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
struct Vertex
|
|
10
|
+
{
|
|
11
|
+
IN(vec3 pos, POSITION);
|
|
12
|
+
IN(vec2 uv, TEXCOORD0);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
struct Uniform
|
|
16
|
+
{
|
|
17
|
+
mat4 mvpMtx;
|
|
18
|
+
mat4 texMtx;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// first 15 slots are reserved for the vertex attributes
|
|
22
|
+
#define UNIFORM_INDEX_START 16
|
|
23
|
+
|
|
24
|
+
vertex RasterizerData default_vp(Vertex in [[stage_in]],
|
|
25
|
+
constant Uniform& u [[buffer(UNIFORM_INDEX_START)]])
|
|
26
|
+
{
|
|
27
|
+
RasterizerData out;
|
|
28
|
+
out.pos = u.mvpMtx * vec4(in.pos, 1);
|
|
29
|
+
out.uv = (u.texMtx * vec4(in.uv,1,1)).xy;
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fragment half4 default_fp(RasterizerData in [[stage_in]],
|
|
34
|
+
metal::texture2d<half> tex [[texture(0)]],
|
|
35
|
+
metal::sampler s [[sampler(0)]])
|
|
36
|
+
{
|
|
37
|
+
return tex.sample(s, in.uv);
|
|
38
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
// @public-api
|
|
6
|
+
|
|
7
|
+
#if defined(OGRE_FRAGMENT_SHADER) && defined(OGRE_GLSLES)
|
|
8
|
+
// define default precisions for ES fragement shaders
|
|
9
|
+
precision mediump float;
|
|
10
|
+
|
|
11
|
+
#if __VERSION__ > 100
|
|
12
|
+
precision lowp sampler2DArray;
|
|
13
|
+
precision lowp sampler2DShadow;
|
|
14
|
+
precision lowp sampler3D;
|
|
15
|
+
#endif
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if __VERSION__ == 100
|
|
19
|
+
mat2 transpose(mat2 m)
|
|
20
|
+
{
|
|
21
|
+
return mat2(m[0][0], m[1][0],
|
|
22
|
+
m[0][1], m[1][1]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
mat3 transpose(mat3 m)
|
|
26
|
+
{
|
|
27
|
+
return mat3(m[0][0], m[1][0], m[2][0],
|
|
28
|
+
m[0][1], m[1][1], m[2][1],
|
|
29
|
+
m[0][2], m[1][2], m[2][2]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
mat4 transpose(mat4 m)
|
|
33
|
+
{
|
|
34
|
+
return mat4(m[0][0], m[1][0], m[2][0], m[3][0],
|
|
35
|
+
m[0][1], m[1][1], m[2][1], m[3][1],
|
|
36
|
+
m[0][2], m[1][2], m[2][2], m[3][2],
|
|
37
|
+
m[0][3], m[1][3], m[2][3], m[3][3]);
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#if __VERSION__ > 120 || defined(OGRE_GLSLANG)
|
|
42
|
+
#define texture1D texture
|
|
43
|
+
#define texture2D texture
|
|
44
|
+
#define texture3D texture
|
|
45
|
+
#define texture2DArray texture
|
|
46
|
+
#define textureCube texture
|
|
47
|
+
#define shadow2D texture
|
|
48
|
+
#define shadow2DProj textureProj
|
|
49
|
+
#define texture2DProj textureProj
|
|
50
|
+
#define texture2DLod textureLod
|
|
51
|
+
#define textureCubeLod textureLod
|
|
52
|
+
|
|
53
|
+
#if defined(OGRE_GLSLANG) || (__VERSION__ > 150 && defined(OGRE_VERTEX_SHADER)) || __VERSION__ >= 410
|
|
54
|
+
#define IN(decl, loc) layout(location = loc) in decl;
|
|
55
|
+
#else
|
|
56
|
+
#define IN(decl, loc) in decl;
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#if defined(OGRE_GLSLANG) || (__VERSION__ > 150 && defined(OGRE_FRAGMENT_SHADER)) || __VERSION__ >= 410
|
|
60
|
+
#define OUT(decl, loc) layout(location = loc) out decl;
|
|
61
|
+
#else
|
|
62
|
+
#define OUT(decl, loc) out decl;
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
#else
|
|
66
|
+
|
|
67
|
+
#ifdef OGRE_VERTEX_SHADER
|
|
68
|
+
#define IN(decl, loc) attribute decl;
|
|
69
|
+
#define OUT(decl, loc) varying decl;
|
|
70
|
+
#else
|
|
71
|
+
#define IN(decl, loc) varying decl;
|
|
72
|
+
#define OUT(decl, loc) out decl;
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
#if defined(OGRE_FRAGMENT_SHADER) && (defined(OGRE_GLSLANG) || (__VERSION__ > 130))
|
|
78
|
+
#define gl_FragColor FragColor
|
|
79
|
+
OUT(vec4 FragColor, 0)
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
#ifdef VULKAN
|
|
83
|
+
|
|
84
|
+
#ifdef OGRE_VERTEX_SHADER
|
|
85
|
+
#define OGRE_UNIFORMS_BEGIN layout(binding = 0, row_major) uniform OgreUniforms {
|
|
86
|
+
#else
|
|
87
|
+
#define OGRE_UNIFORMS_BEGIN layout(binding = 1, row_major) uniform OgreUniforms {
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
#define OGRE_UNIFORMS_END };
|
|
91
|
+
|
|
92
|
+
#else
|
|
93
|
+
|
|
94
|
+
#define OGRE_UNIFORMS_BEGIN
|
|
95
|
+
#define OGRE_UNIFORMS_END
|
|
96
|
+
|
|
97
|
+
#endif
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
// @public-api
|
|
6
|
+
|
|
7
|
+
#if OGRE_HLSL >= 4
|
|
8
|
+
|
|
9
|
+
// SM4 separates sampler into Texture and SamplerState
|
|
10
|
+
|
|
11
|
+
#define sampler1D Sampler1D
|
|
12
|
+
#define sampler2D Sampler2D
|
|
13
|
+
#define sampler3D Sampler3D
|
|
14
|
+
#define samplerCUBE SamplerCube
|
|
15
|
+
|
|
16
|
+
struct Sampler1D
|
|
17
|
+
{
|
|
18
|
+
Texture1D t;
|
|
19
|
+
SamplerState s;
|
|
20
|
+
};
|
|
21
|
+
struct Sampler2D
|
|
22
|
+
{
|
|
23
|
+
Texture2D t;
|
|
24
|
+
SamplerState s;
|
|
25
|
+
};
|
|
26
|
+
struct Sampler3D
|
|
27
|
+
{
|
|
28
|
+
Texture3D t;
|
|
29
|
+
SamplerState s;
|
|
30
|
+
};
|
|
31
|
+
struct SamplerCube
|
|
32
|
+
{
|
|
33
|
+
TextureCube t;
|
|
34
|
+
SamplerState s;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
float4 tex1D(Sampler1D s, float v) { return s.t.Sample(s.s, v); }
|
|
38
|
+
float4 tex2D(Sampler2D s, float2 v) { return s.t.Sample(s.s, v); }
|
|
39
|
+
float4 tex3D(Sampler3D s, float3 v) { return s.t.Sample(s.s, v); }
|
|
40
|
+
float4 texCUBE(SamplerCube s, float3 v) { return s.t.Sample(s.s, v); }
|
|
41
|
+
float4 texCUBElod(SamplerCube s, float4 v) { return s.t.SampleLevel(s.s, v.xyz, v.w); }
|
|
42
|
+
|
|
43
|
+
float4 tex2D(Sampler2D s, float2 v, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, v, ddx, ddy); }
|
|
44
|
+
float4 tex2Dproj(Sampler2D s, float4 v) { return s.t.Sample(s.s, v.xy/v.w); }
|
|
45
|
+
float4 tex2Dlod(Sampler2D s, float4 v) { return s.t.SampleLevel(s.s, v.xy, v.w); }
|
|
46
|
+
|
|
47
|
+
#define SAMPLER1D(name, reg) \
|
|
48
|
+
Texture1D name ## Tex : register(t ## reg);\
|
|
49
|
+
SamplerState name ## State : register(s ## reg);\
|
|
50
|
+
static Sampler1D name = {name ## Tex, name ## State}
|
|
51
|
+
|
|
52
|
+
#define SAMPLER2D(name, reg) \
|
|
53
|
+
Texture2D name ## Tex : register(t ## reg);\
|
|
54
|
+
SamplerState name ## State : register(s ## reg);\
|
|
55
|
+
static Sampler2D name = {name ## Tex, name ## State}
|
|
56
|
+
|
|
57
|
+
#define SAMPLER3D(name, reg) \
|
|
58
|
+
Texture3D name ## Tex : register(t ## reg);\
|
|
59
|
+
SamplerState name ## State : register(s ## reg);\
|
|
60
|
+
static Sampler3D name = {name ## Tex, name ## State}
|
|
61
|
+
|
|
62
|
+
#define SAMPLERCUBE(name, reg) \
|
|
63
|
+
TextureCube name ## Tex : register(t ## reg);\
|
|
64
|
+
SamplerState name ## State : register(s ## reg);\
|
|
65
|
+
static SamplerCube name = {name ## Tex, name ## State}
|
|
66
|
+
|
|
67
|
+
// the following are not available in D3D9, but provided for convenience
|
|
68
|
+
struct Sampler2DShadow
|
|
69
|
+
{
|
|
70
|
+
Texture2D t;
|
|
71
|
+
SamplerComparisonState s;
|
|
72
|
+
};
|
|
73
|
+
struct Sampler2DArray
|
|
74
|
+
{
|
|
75
|
+
Texture2DArray t;
|
|
76
|
+
SamplerState s;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
#define SAMPLER2DSHADOW(name, reg) \
|
|
80
|
+
Texture2D name ## Tex : register(t ## reg);\
|
|
81
|
+
SamplerComparisonState name ## State : register(s ## reg);\
|
|
82
|
+
static Sampler2DShadow name = {name ## Tex, name ## State}
|
|
83
|
+
|
|
84
|
+
#define SAMPLER2DARRAY(name, reg) \
|
|
85
|
+
Texture2DArray name ## Tex : register(t ## reg);\
|
|
86
|
+
SamplerState name ## State : register(s ## reg);\
|
|
87
|
+
static Sampler2DArray name = {name ## Tex, name ## State}
|
|
88
|
+
|
|
89
|
+
float tex2Dcmp(Sampler2DShadow s, float3 v) { return s.t.SampleCmpLevelZero(s.s, v.xy, v.z); }
|
|
90
|
+
float4 tex2DARRAY(Sampler2DArray s, float3 v) { return s.t.Sample(s.s, v); }
|
|
91
|
+
#else
|
|
92
|
+
|
|
93
|
+
#define SAMPLER1D(name, reg) sampler1D name : register(s ## reg)
|
|
94
|
+
#define SAMPLER2D(name, reg) sampler2D name : register(s ## reg)
|
|
95
|
+
#define SAMPLER3D(name, reg) sampler3D name : register(s ## reg)
|
|
96
|
+
#define SAMPLERCUBE(name, reg) samplerCUBE name : register(s ## reg)
|
|
97
|
+
|
|
98
|
+
#endif
|
|
@@ -0,0 +1,183 @@
|
|
|
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
|
+
// greatly inspired by
|
|
6
|
+
// - shiny: https://ogrecave.github.io/shiny/defining-materials-shaders.html
|
|
7
|
+
// - bgfx: https://github.com/bkaradzic/bgfx/blob/master/src/bgfx_shader.sh
|
|
8
|
+
|
|
9
|
+
/// general usage:
|
|
10
|
+
// MAIN_PARAMETERS
|
|
11
|
+
// IN(vec4 vertex, POSITION)
|
|
12
|
+
// MAIN_DECLARATION
|
|
13
|
+
// {
|
|
14
|
+
// GLSL code here
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
/// configuration
|
|
18
|
+
// use macros that will be default with Ogre 15
|
|
19
|
+
// #define USE_OGRE_FROM_FUTURE
|
|
20
|
+
|
|
21
|
+
// @public-api
|
|
22
|
+
|
|
23
|
+
#if defined(OGRE_HLSL) || defined(OGRE_CG)
|
|
24
|
+
// HLSL
|
|
25
|
+
#include "HLSL_SM4Support.hlsl"
|
|
26
|
+
#define vec2 float2
|
|
27
|
+
#define vec3 float3
|
|
28
|
+
#define vec4 float4
|
|
29
|
+
#define mat3 float3x3
|
|
30
|
+
#define mat4 float4x4
|
|
31
|
+
|
|
32
|
+
#define ivec2 int2
|
|
33
|
+
#define ivec3 int3
|
|
34
|
+
#define ivec4 int4
|
|
35
|
+
|
|
36
|
+
#define texture1D tex1D
|
|
37
|
+
#define texture2D tex2D
|
|
38
|
+
#define texture3D tex3D
|
|
39
|
+
#define texture2DArray tex2DARRAY
|
|
40
|
+
#define textureCube texCUBE
|
|
41
|
+
#define shadow2D tex2Dcmp
|
|
42
|
+
#define texture2DProj tex2Dproj
|
|
43
|
+
vec4 texture2DLod(sampler2D s, vec2 v, float lod) { return tex2Dlod(s, vec4(v.x, v.y, 0, lod)); }
|
|
44
|
+
|
|
45
|
+
#define samplerCube samplerCUBE
|
|
46
|
+
vec4 textureCubeLod(samplerCube s, vec3 v, float lod) { return texCUBElod(s, vec4(v.x, v.y, v.z, lod)); }
|
|
47
|
+
|
|
48
|
+
#define sampler2DShadow Sampler2DShadow
|
|
49
|
+
|
|
50
|
+
#define mix lerp
|
|
51
|
+
#define fract frac
|
|
52
|
+
#define inversesqrt rsqrt
|
|
53
|
+
|
|
54
|
+
float mod(float _a, float _b) { return _a - _b * floor(_a / _b); }
|
|
55
|
+
vec2 mod(vec2 _a, vec2 _b) { return _a - _b * floor(_a / _b); }
|
|
56
|
+
vec3 mod(vec3 _a, vec3 _b) { return _a - _b * floor(_a / _b); }
|
|
57
|
+
vec4 mod(vec4 _a, vec4 _b) { return _a - _b * floor(_a / _b); }
|
|
58
|
+
|
|
59
|
+
vec2 vec2_splat(float x) { return vec2(x, x); }
|
|
60
|
+
vec3 vec3_splat(float x) { return vec3(x, x, x); }
|
|
61
|
+
vec4 vec4_splat(float x) { return vec4(x, x, x, x); }
|
|
62
|
+
|
|
63
|
+
mat4 mtxFromRows(vec4 a, vec4 b, vec4 c, vec4 d)
|
|
64
|
+
{
|
|
65
|
+
return mat4(a, b, c, d);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
mat3 mtxFromRows(vec3 a, vec3 b, vec3 c)
|
|
69
|
+
{
|
|
70
|
+
return mat3(a, b, c);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
mat3 mtxFromCols(vec3 a, vec3 b, vec3 c)
|
|
74
|
+
{
|
|
75
|
+
return transpose(mat3(a, b, c));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#define STATIC static
|
|
79
|
+
|
|
80
|
+
#define OGRE_UNIFORMS_BEGIN
|
|
81
|
+
#define OGRE_UNIFORMS_END
|
|
82
|
+
|
|
83
|
+
#define MAIN_PARAMETERS void main(
|
|
84
|
+
|
|
85
|
+
#ifdef OGRE_VERTEX_SHADER
|
|
86
|
+
#define MAIN_DECLARATION out float4 gl_Position : POSITION)
|
|
87
|
+
#else
|
|
88
|
+
#define MAIN_DECLARATION in float4 gl_FragCoord : POSITION, out float4 gl_FragColor : COLOR)
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#define IN(decl, sem) in decl : sem,
|
|
92
|
+
#define OUT(decl, sem) out decl : sem,
|
|
93
|
+
#elif defined(OGRE_METAL)
|
|
94
|
+
#define vec2 float2
|
|
95
|
+
#define vec3 float3
|
|
96
|
+
#define vec4 float4
|
|
97
|
+
#define mat3 metal::float3x3
|
|
98
|
+
#define mat4 metal::float4x4
|
|
99
|
+
|
|
100
|
+
#define IN(decl, sem) decl [[ attribute(sem) ]];
|
|
101
|
+
#else
|
|
102
|
+
// GLSL
|
|
103
|
+
#include "GLSL_GL3Support.glsl"
|
|
104
|
+
|
|
105
|
+
#ifdef VULKAN
|
|
106
|
+
#define _UNIFORM_BINDING(b) layout(binding = b + 2) uniform
|
|
107
|
+
#elif __VERSION__ >= 420
|
|
108
|
+
#define _UNIFORM_BINDING(b) layout(binding = b) uniform
|
|
109
|
+
#else
|
|
110
|
+
#define _UNIFORM_BINDING(b) uniform
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
#define SAMPLER1D(name, reg) _UNIFORM_BINDING(reg) sampler1D name
|
|
114
|
+
#define SAMPLER2D(name, reg) _UNIFORM_BINDING(reg) sampler2D name
|
|
115
|
+
#define SAMPLER3D(name, reg) _UNIFORM_BINDING(reg) sampler3D name
|
|
116
|
+
#define SAMPLER2DARRAY(name, reg) _UNIFORM_BINDING(reg) sampler2DArray name
|
|
117
|
+
#define SAMPLERCUBE(name, reg) _UNIFORM_BINDING(reg) samplerCube name
|
|
118
|
+
#define SAMPLER2DSHADOW(name, reg) _UNIFORM_BINDING(reg) sampler2DShadow name
|
|
119
|
+
|
|
120
|
+
#define saturate(x) clamp(x, 0.0, 1.0)
|
|
121
|
+
#define mul(a, b) ((a) * (b))
|
|
122
|
+
|
|
123
|
+
#define vec2_splat vec2
|
|
124
|
+
#define vec3_splat vec3
|
|
125
|
+
#define vec4_splat vec4
|
|
126
|
+
|
|
127
|
+
mat4 mtxFromRows(vec4 a, vec4 b, vec4 c, vec4 d)
|
|
128
|
+
{
|
|
129
|
+
return transpose(mat4(a, b, c, d));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
mat3 mtxFromRows(vec3 a, vec3 b, vec3 c)
|
|
133
|
+
{
|
|
134
|
+
return transpose(mat3(a, b, c));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
mat3 mtxFromCols(vec3 a, vec3 b, vec3 c)
|
|
138
|
+
{
|
|
139
|
+
return mat3(a, b, c);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#define STATIC
|
|
143
|
+
|
|
144
|
+
#define MAIN_PARAMETERS
|
|
145
|
+
#define MAIN_DECLARATION void main()
|
|
146
|
+
|
|
147
|
+
#endif
|
|
148
|
+
|
|
149
|
+
#if !defined(OGRE_HLSL) && !defined(OGRE_CG)
|
|
150
|
+
// semantics as aliases for attribute locations
|
|
151
|
+
#define POSITION 0
|
|
152
|
+
#define BLENDWEIGHT 1
|
|
153
|
+
#define NORMAL 2
|
|
154
|
+
#define COLOR0 3
|
|
155
|
+
#define COLOR1 4
|
|
156
|
+
#define COLOR COLOR0
|
|
157
|
+
#define FOG 5
|
|
158
|
+
#define BLENDINDICES 7
|
|
159
|
+
#define TEXCOORD0 8
|
|
160
|
+
#define TEXCOORD1 9
|
|
161
|
+
#define TEXCOORD2 10
|
|
162
|
+
#define TEXCOORD3 11
|
|
163
|
+
#define TEXCOORD4 12
|
|
164
|
+
#define TEXCOORD5 13
|
|
165
|
+
#define TEXCOORD6 14
|
|
166
|
+
#define TEXCOORD7 15
|
|
167
|
+
#define TANGENT 14
|
|
168
|
+
#endif
|
|
169
|
+
|
|
170
|
+
#define OGRE_UNIFORMS(params) OGRE_UNIFORMS_BEGIN params OGRE_UNIFORMS_END
|
|
171
|
+
|
|
172
|
+
// GL_EXT_shader_explicit_arithmetic_types polyfill
|
|
173
|
+
#ifdef OGRE_GLSLES
|
|
174
|
+
#define float32_t highp float
|
|
175
|
+
#define f32vec2 highp vec2
|
|
176
|
+
#define f32vec3 highp vec3
|
|
177
|
+
#define f32vec4 highp vec4
|
|
178
|
+
#else
|
|
179
|
+
#define float32_t float
|
|
180
|
+
#define f32vec2 vec2
|
|
181
|
+
#define f32vec3 vec3
|
|
182
|
+
#define f32vec4 vec4
|
|
183
|
+
#endif
|