Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing OIS with SDL input (using OGRE14 + Bites component) #2983

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ mark_as_advanced(
if (WIN32)
add_definitions("/D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /wd4251 /wd4275 /wd4099 /nologo")

set(CMAKE_CONFIGURATION_TYPES "Debug" "Release" CACHE STRING "Configuration types")

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MP /GL /Ox /Ob2 /Oi /Ot /Oy /fp:fast /GS- /MP /Zi")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MP /Zi")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MP /Od /Zi /Gy /fp:except /GF- /GS /Ob0")
Expand Down
4 changes: 1 addition & 3 deletions cmake/DependenciesConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ set(CMAKE_THREAD_PREFER_PTHREAD YES)
find_package(Threads REQUIRED)

# --- Ogre 3D graphics engine ---
find_package(OGRE 1.11 REQUIRED COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain)
find_package(OGRE 14 REQUIRED COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain)

# --- Object Oriented Input System ---
find_package(OIS REQUIRED)

# --- MyGUI - graphical user inferface ---
find_package(MyGUI REQUIRED)

# --- fmt - A modern formatting library ---
find_package(fmt REQUIRED)

Expand Down
8 changes: 4 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def requirements(self):
self.requires("discord-rpc/3.4.0@anotherfoxguy/stable")
self.requires("fmt/8.0.1")
self.requires("libcurl/7.79.1")
self.requires("mygui/3.4.0@anotherfoxguy/stable")
self.requires("ogre3d-caelum/0.6.3.1@anotherfoxguy/stable")
self.requires("ogre3d-pagedgeometry/1.2.0@anotherfoxguy/stable")
self.requires("ogre3d/1.11.6.1@anotherfoxguy/stable", force=True)
self.requires("mygui/3.4.3@anotherfoxguy/stable")
self.requires("ogre3d-caelum/2022.08@anotherfoxguy/stable")
self.requires("ogre3d-pagedgeometry/2023.07@anotherfoxguy/stable")
self.requires("ogre3d/14.1.0@anotherfoxguy/stable", force=True)
self.requires("ois/1.4.1@rigsofrods/custom")
self.requires("openal-soft/1.22.2")
self.requires("openssl/1.1.1s", force=True)
Expand Down
38 changes: 38 additions & 0 deletions resources/OgreCore/DefaultShaders.metal
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "OgreUnifiedShader.h"

struct RasterizerData
{
vec4 pos [[position]];
vec2 uv;
};

struct Vertex
{
IN(vec3 pos, POSITION);
IN(vec2 uv, TEXCOORD0);
};

struct Uniform
{
mat4 mvpMtx;
mat4 texMtx;
};

// first 15 slots are reserved for the vertex attributes
#define UNIFORM_INDEX_START 16

vertex RasterizerData default_vp(Vertex in [[stage_in]],
constant Uniform& u [[buffer(UNIFORM_INDEX_START)]])
{
RasterizerData out;
out.pos = u.mvpMtx * vec4(in.pos, 1);
out.uv = (u.texMtx * vec4(in.uv,1,1)).xy;
return out;
}

fragment half4 default_fp(RasterizerData in [[stage_in]],
metal::texture2d<half> tex [[texture(0)]],
metal::sampler s [[sampler(0)]])
{
return tex.sample(s, in.uv);
}
86 changes: 86 additions & 0 deletions resources/OgreCore/GLSL_GL3Support.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// This file is part of the OGRE project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at https://www.ogre3d.org/licensing.

// @public-api

#if __VERSION__ == 100
mat2 transpose(mat2 m)
{
return mat2(m[0][0], m[1][0],
m[0][1], m[1][1]);
}

mat3 transpose(mat3 m)
{
return mat3(m[0][0], m[1][0], m[2][0],
m[0][1], m[1][1], m[2][1],
m[0][2], m[1][2], m[2][2]);
}

mat4 transpose(mat4 m)
{
return mat4(m[0][0], m[1][0], m[2][0], m[3][0],
m[0][1], m[1][1], m[2][1], m[3][1],
m[0][2], m[1][2], m[2][2], m[3][2],
m[0][3], m[1][3], m[2][3], m[3][3]);
}
#endif

#if __VERSION__ > 120 || defined(OGRE_GLSLANG)
#define texture1D texture
#define texture2D texture
#define texture3D texture
#define texture2DArray texture
#define textureCube texture
#define shadow2D texture
#define shadow2DProj textureProj
#define texture2DProj textureProj
#define texture2DLod textureLod
#define textureCubeLod textureLod

#if defined(OGRE_GLSLANG) || (__VERSION__ > 150 && defined(OGRE_VERTEX_SHADER)) || __VERSION__ >= 410
#define IN(decl, loc) layout(location = loc) in decl;
#else
#define IN(decl, loc) in decl;
#endif

#if defined(OGRE_GLSLANG) || (__VERSION__ > 150 && defined(OGRE_FRAGMENT_SHADER)) || __VERSION__ >= 410
#define OUT(decl, loc) layout(location = loc) out decl;
#else
#define OUT(decl, loc) out decl;
#endif

#else

#ifdef OGRE_VERTEX_SHADER
#define IN(decl, loc) attribute decl;
#define OUT(decl, loc) varying decl;
#else
#define IN(decl, loc) varying decl;
#define OUT(decl, loc) out decl;
#endif

#endif

#if defined(OGRE_FRAGMENT_SHADER) && (defined(OGRE_GLSLANG) || (__VERSION__ > 130))
#define gl_FragColor FragColor
OUT(vec4 FragColor, 0)
#endif

#ifdef VULKAN

#ifdef OGRE_VERTEX_SHADER
#define OGRE_UNIFORMS_BEGIN layout(binding = 0, row_major) uniform OgreUniforms {
#else
#define OGRE_UNIFORMS_BEGIN layout(binding = 1, row_major) uniform OgreUniforms {
#endif

#define OGRE_UNIFORMS_END };

#else

#define OGRE_UNIFORMS_BEGIN
#define OGRE_UNIFORMS_END

#endif
97 changes: 97 additions & 0 deletions resources/OgreCore/HLSL_SM4Support.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// This file is part of the OGRE project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at https://www.ogre3d.org/licensing.

// @public-api

#if OGRE_HLSL >= 4

// SM4 separates sampler into Texture and SamplerState

#define sampler1D Sampler1D
#define sampler2D Sampler2D
#define sampler3D Sampler3D
#define samplerCUBE SamplerCube

struct Sampler1D
{
Texture1D t;
SamplerState s;
};
struct Sampler2D
{
Texture2D t;
SamplerState s;
};
struct Sampler3D
{
Texture3D t;
SamplerState s;
};
struct SamplerCube
{
TextureCube t;
SamplerState s;
};

float4 tex1D(Sampler1D s, float v) { return s.t.Sample(s.s, v); }
float4 tex2D(Sampler2D s, float2 v) { return s.t.Sample(s.s, v); }
float4 tex3D(Sampler3D s, float3 v) { return s.t.Sample(s.s, v); }
float4 texCUBE(SamplerCube s, float3 v) { return s.t.Sample(s.s, v); }

float4 tex2D(Sampler2D s, float2 v, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, v, ddx, ddy); }
float4 tex2Dproj(Sampler2D s, float4 v) { return s.t.Sample(s.s, v.xy/v.w); }
float4 tex2Dlod(Sampler2D s, float4 v) { return s.t.SampleLevel(s.s, v.xy, v.w); }

#define SAMPLER1D(name, reg) \
Texture1D name ## Tex : register(t ## reg);\
SamplerState name ## State : register(s ## reg);\
static Sampler1D name = {name ## Tex, name ## State}

#define SAMPLER2D(name, reg) \
Texture2D name ## Tex : register(t ## reg);\
SamplerState name ## State : register(s ## reg);\
static Sampler2D name = {name ## Tex, name ## State}

#define SAMPLER3D(name, reg) \
Texture3D name ## Tex : register(t ## reg);\
SamplerState name ## State : register(s ## reg);\
static Sampler3D name = {name ## Tex, name ## State}

#define SAMPLERCUBE(name, reg) \
TextureCube name ## Tex : register(t ## reg);\
SamplerState name ## State : register(s ## reg);\
static SamplerCube name = {name ## Tex, name ## State}

// the following are not available in D3D9, but provided for convenience
struct Sampler2DShadow
{
Texture2D t;
SamplerComparisonState s;
};
struct Sampler2DArray
{
Texture2DArray t;
SamplerState s;
};

#define SAMPLER2DSHADOW(name, reg) \
Texture2D name ## Tex : register(t ## reg);\
SamplerComparisonState name ## State : register(s ## reg);\
static Sampler2DShadow name = {name ## Tex, name ## State}

#define SAMPLER2DARRAY(name, reg) \
Texture2DArray name ## Tex : register(t ## reg);\
SamplerState name ## State : register(s ## reg);\
static Sampler2DArray name = {name ## Tex, name ## State}

float tex2Dcmp(Sampler2DShadow s, float3 v) { return s.t.SampleCmpLevelZero(s.s, v.xy, v.z); }
float4 tex2DARRAY(Sampler2DArray s, float3 v) { return s.t.Sample(s.s, v); }
#else

#define SAMPLER1D(name, reg) sampler1D name : register(s ## reg)
#define SAMPLER2D(name, reg) sampler2D name : register(s ## reg)
#define SAMPLER3D(name, reg) sampler3D name : register(s ## reg)
#define SAMPLERCUBE(name, reg) samplerCUBE name : register(s ## reg)

#endif
Loading
Loading