summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-01-10 19:45:58 +0100
committeraap <aap@papnet.eu>2021-01-10 19:45:58 +0100
commit93ea98520bb652095c9f09ed5032842963e2a86c (patch)
tree28f7839aa1b94bcddc8f7c5eeb76f01b50cdadd0
parentc3b6e9da43c1e61a076056feb74aefbecbad39c6 (diff)
mobile building rendering
-rw-r--r--src/core/Frontend.cpp23
-rw-r--r--src/core/re3.cpp9
-rw-r--r--src/extras/custompipes.cpp1
-rw-r--r--src/extras/custompipes.h5
-rw-r--r--src/extras/custompipes_d3d9.cpp29
-rw-r--r--src/extras/custompipes_gl.cpp29
-rw-r--r--src/extras/postfx.h8
-rw-r--r--src/extras/shaders/Makefile7
-rw-r--r--src/extras/shaders/leedsBuilding_VS.hlsl1
-rw-r--r--src/extras/shaders/leedsBuilding_mobile.vert52
-rw-r--r--src/extras/shaders/leedsBuilding_mobile_VS.csobin0 -> 808 bytes
-rw-r--r--src/extras/shaders/leedsBuilding_mobile_VS.hlsl64
-rw-r--r--src/extras/shaders/leedsBuilding_mobile_VS.inc70
-rw-r--r--src/extras/shaders/leedsBuilding_mobile_vs_gl.inc54
14 files changed, 327 insertions, 25 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 11488aec..e0428fcf 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -58,6 +58,19 @@ const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR;
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
const CRGBA SCROLLBAR_COLOR = LABEL_COLOR;
+#if 0
+// Mobile
+#define DEFAULT_BRIGHTNESS 0x150
+#define MIN_BRIGHTNESS 180
+#define MAX_BRIGHTNESS 700
+#else
+// PS2
+// 8 bars (32 step)
+#define DEFAULT_BRIGHTNESS 0x120
+#define MIN_BRIGHTNESS 0x80
+#define MAX_BRIGHTNESS 0x180
+#endif
+
#define MAP_MIN_SIZE 162.f
#define MAP_SIZE_TO_ALLOW_X_MOVE 297.f
@@ -465,7 +478,7 @@ CMenuManager::CMenuManager()
m_PrefsMusicVolume = 49;
m_PrefsRadioStation = 0;
m_PrefsStereoMono = 1;
- m_PrefsBrightness = 256;
+ m_PrefsBrightness = DEFAULT_BRIGHTNESS;
m_PrefsLOD = CRenderer::ms_lodDistScale;
m_KeyPressedCode = -1;
m_bFrontEnd_ReloadObrTxtGxt = false;
@@ -674,8 +687,8 @@ CMenuManager::CheckSliderMovement(int value)
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
- m_PrefsBrightness += value * 24.19f;
- m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 384);
+ m_PrefsBrightness += value * 32.0f;
+ m_PrefsBrightness = clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
break;
case MENUACTION_DRAWDIST:
if(value > 0)
@@ -1464,7 +1477,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS:
- ProcessSlider(m_PrefsBrightness / 384.0f, 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true);
+ ProcessSlider((float)(m_PrefsBrightness - MIN_BRIGHTNESS) / (MAX_BRIGHTNESS - MIN_BRIGHTNESS), 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true);
break;
case MENUACTION_DRAWDIST:
ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
@@ -4736,7 +4749,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
SaveSettings();
} else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) {
- m_PrefsBrightness = 256;
+ m_PrefsBrightness = DEFAULT_BRIGHTNESS;
m_PrefsLOD = 1.2f;
#ifdef LEGACY_MENU_OPTIONS
m_PrefsVsync = true;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 53a4396d..58d8cc6b 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -600,6 +600,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); });
DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil);
+ DebugMenuAddVar("Render", "Brightness", &FrontEndMenuManager.m_PrefsBrightness, nil, 16, 0, 700, nil);
DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil);
DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
@@ -630,8 +631,8 @@ extern bool gbRenderWorld2;
#endif
#ifdef EXTENDED_COLOURFILTER
- static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
- e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
+ static const char *filternames[] = { "None", "PS2" };
+ e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_NORMAL, filternames);
DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
@@ -642,6 +643,10 @@ extern bool gbRenderWorld2;
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
#endif
#ifdef EXTENDED_PIPELINES
+ static const char *worldpipenames[] = { "PS2", "Mobile" };
+ e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil,
+ 1, CustomPipes::WORLDPIPE_PS2, CustomPipes::WORLDPIPE_MOBILE, worldpipenames);
+ DebugMenuEntrySetWrap(e, true);
static const char *vehpipenames[] = { "MatFX", "Neo" };
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames);
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp
index 379e7c8a..1d147ed6 100644
--- a/src/extras/custompipes.cpp
+++ b/src/extras/custompipes.cpp
@@ -370,6 +370,7 @@ AttachVehiclePipe(rw::Clump *clump)
* Neo World pipe
*/
+int32 WorldPipeSwitch = 0;
bool LightmapEnable;
float LightmapMult = 1.0f;
InterpolatedFloat WorldLightmapBlend(1.0f);
diff --git a/src/extras/custompipes.h b/src/extras/custompipes.h
index aed34520..a80546ef 100644
--- a/src/extras/custompipes.h
+++ b/src/extras/custompipes.h
@@ -102,6 +102,11 @@ void DestroyVehiclePipe(void);
void AttachVehiclePipe(rw::Atomic *atomic);
void AttachVehiclePipe(rw::Clump *clump);
+enum {
+ WORLDPIPE_PS2,
+ WORLDPIPE_MOBILE
+};
+extern int32 WorldPipeSwitch;
extern bool LightmapEnable;
extern float LightmapMult;
extern InterpolatedFloat WorldLightmapBlend;
diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp
index c4505b75..2ea2ede0 100644
--- a/src/extras/custompipes_d3d9.cpp
+++ b/src/extras/custompipes_d3d9.cpp
@@ -315,6 +315,7 @@ DestroyVehiclePipe(void)
*/
static void *leedsBuilding_VS;
+static void *leedsBuilding_mobile_VS;
static void *scale_PS;
static void
@@ -328,7 +329,10 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
setIndices(header->indexBuffer);
setVertexDeclaration(header->vertexDeclaration);
- setVertexShader(leedsBuilding_VS);
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
+ else
+ setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(scale_PS);
uploadMatrices(atomic->getFrame()->getLTM());
@@ -351,7 +355,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
Material *m = inst->material;
float cs = 1.0f;
- if(m->texture)
+ if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
@@ -361,7 +365,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
else
d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this
- setMaterial(m->color, m->surfaceProps, 0.5f);
+ setMaterial(m->color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f);
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
@@ -381,6 +385,9 @@ CreateWorldPipe(void)
#include "shaders/leedsBuilding_VS.inc"
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
assert(leedsBuilding_VS);
+#include "shaders/leedsBuilding_mobile_VS.inc"
+ leedsBuilding_mobile_VS = rw::d3d::createVertexShader(leedsBuilding_mobile_VS_cso);
+ assert(leedsBuilding_mobile_VS);
#include "shaders/scale_PS.inc"
scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
assert(scale_PS);
@@ -397,6 +404,8 @@ DestroyWorldPipe(void)
{
rw::d3d::destroyVertexShader(leedsBuilding_VS);
leedsBuilding_VS = nil;
+ rw::d3d::destroyVertexShader(leedsBuilding_mobile_VS);
+ leedsBuilding_mobile_VS = nil;
rw::d3d::destroyPixelShader(scale_PS);
scale_PS = nil;
@@ -747,7 +756,10 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
setIndices(building->instHeader->indexBuffer);
setVertexDeclaration(building->instHeader->vertexDeclaration);
- setVertexShader(CustomPipes::leedsBuilding_VS);
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
+ else
+ setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(CustomPipes::scale_PS);
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
@@ -767,7 +779,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
}
float cs = 1.0f;
- if(m->texture)
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
@@ -808,7 +820,10 @@ RenderBlendPass(int pass)
using namespace rw::d3d;
using namespace rw::d3d9;
- setVertexShader(CustomPipes::leedsBuilding_VS);
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
+ else
+ setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(CustomPipes::scale_PS);
RGBAf amb, emiss;
@@ -842,7 +857,7 @@ RenderBlendPass(int pass)
continue; // already done this one
float cs = 1.0f;
- if(m->texture) // always true
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp
index 54e212d6..19e37ac1 100644
--- a/src/extras/custompipes_gl.cpp
+++ b/src/extras/custompipes_gl.cpp
@@ -331,6 +331,7 @@ DestroyVehiclePipe(void)
*/
rw::gl3::Shader *leedsWorldShader;
+rw::gl3::Shader *leedsWorldShader_mobile;
static void
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
@@ -353,7 +354,10 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
- leedsWorldShader->use();
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ CustomPipes::leedsWorldShader_mobile->use();
+ else
+ CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
@@ -372,7 +376,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
m = inst->material;
float cs = 1.0f;
- if(m->texture)
+ if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(u_colorscale), 1, colorscale);
@@ -405,10 +409,14 @@ CreateWorldPipe(void)
{
#include "shaders/scale_fs_gl.inc"
#include "shaders/leedsBuilding_vs_gl.inc"
+#include "shaders/leedsBuilding_mobile_vs_gl.inc"
const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil };
+ const char *vs_mobile[] = { shaderDecl, header_vert_src, leedsBuilding_mobile_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil };
leedsWorldShader = Shader::create(vs, fs);
assert(leedsWorldShader);
+ leedsWorldShader_mobile = Shader::create(vs_mobile, fs);
+ assert(leedsWorldShader_mobile);
}
@@ -424,6 +432,8 @@ DestroyWorldPipe(void)
{
leedsWorldShader->destroy();
leedsWorldShader = nil;
+ leedsWorldShader_mobile->destroy();
+ leedsWorldShader_mobile = nil;
((rw::gl3::ObjPipeline*)worldPipe)->destroy();
worldPipe = nil;
@@ -816,8 +826,10 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
// alright we're rendering this atomic
if(!setupDone){
- CustomPipes::leedsWorldShader->use();
-// defaultShader->use();
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ CustomPipes::leedsWorldShader_mobile->use();
+ else
+ CustomPipes::leedsWorldShader->use();
setWorldMatrix(&building->matrix);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(building->instHeader->vao);
@@ -845,7 +857,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setMaterial(m->color, m->surfaceProps, 0.5f);
float cs = 1.0f;
- if(m->texture)
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
@@ -885,7 +897,10 @@ RenderBlendPass(int pass)
using namespace rw;
using namespace rw::gl3;
- CustomPipes::leedsWorldShader->use();
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
+ CustomPipes::leedsWorldShader_mobile->use();
+ else
+ CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
@@ -926,7 +941,7 @@ RenderBlendPass(int pass)
setMaterial(color, m->surfaceProps, 0.5f);
float cs = 1.0f;
- if(m->texture) // always true
+ if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
diff --git a/src/extras/postfx.h b/src/extras/postfx.h
index db702bf3..9538f8e1 100644
--- a/src/extras/postfx.h
+++ b/src/extras/postfx.h
@@ -7,9 +7,13 @@ class CPostFX
public:
enum {
POSTFX_OFF,
- POSTFX_SIMPLE,
+// POSTFX_SIMPLE,
POSTFX_NORMAL,
- POSTFX_MOBILE
+// POSTFX_MOBILE
+
+ // not so sensible for the moment
+ POSTFX_SIMPLE = -1,
+ POSTFX_MOBILE = -2
};
static RwRaster *pFrontBuffer;
static RwRaster *pBackBuffer;
diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile
index 7fa0f125..87777e74 100644
--- a/src/extras/shaders/Makefile
+++ b/src/extras/shaders/Makefile
@@ -4,7 +4,7 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \
neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \
im2d_UV2_gl.inc screenDroplet_fs_gl.inc \
- leedsBuilding_vs_gl.inc scale_fs_gl.inc \
+ leedsBuilding_vs_gl.inc leedsBuilding_mobile_vs_gl.inc scale_fs_gl.inc \
leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc
im2d_gl.inc: im2d.vert
@@ -84,6 +84,11 @@ leedsBuilding_vs_gl.inc: leedsBuilding.vert
sed 's/..*/"&\\n"/' leedsBuilding.vert;\
echo ';') >leedsBuilding_vs_gl.inc
+leedsBuilding_mobile_vs_gl.inc: leedsBuilding_mobile.vert
+ (echo 'const char *leedsBuilding_mobile_vert_src =';\
+ sed 's/..*/"&\\n"/' leedsBuilding_mobile.vert;\
+ echo ';') >leedsBuilding_mobile_vs_gl.inc
+
scale_fs_gl.inc: scale.frag
(echo 'const char *scale_frag_src =';\
sed 's/..*/"&\\n"/' scale.frag;\
diff --git a/src/extras/shaders/leedsBuilding_VS.hlsl b/src/extras/shaders/leedsBuilding_VS.hlsl
index 3c40bef1..1ed939cc 100644
--- a/src/extras/shaders/leedsBuilding_VS.hlsl
+++ b/src/extras/shaders/leedsBuilding_VS.hlsl
@@ -2,7 +2,6 @@
#define surfEmissive (surfProps.w)
-
float4 emissive : register(c41);
float4 ambient : register(c42);
diff --git a/src/extras/shaders/leedsBuilding_mobile.vert b/src/extras/shaders/leedsBuilding_mobile.vert
new file mode 100644
index 00000000..f06628ee
--- /dev/null
+++ b/src/extras/shaders/leedsBuilding_mobile.vert
@@ -0,0 +1,52 @@
+uniform vec4 u_amb;
+uniform vec4 u_emiss;
+
+#define surfEmissive (u_surfProps.w)
+
+#define vertContrast (1.5)
+#define vertBrightness (0.25)
+#define ambientContrast (1.2)
+#define ambientBrightness (0.1)
+#define emissiveContrast (1.25)
+#define emissiveBrightness (0.05)
+
+
+VSIN(ATTRIB_POS) vec3 in_pos;
+
+VSOUT vec4 v_color;
+VSOUT vec2 v_tex0;
+VSOUT float v_fog;
+
+void
+main(void)
+{
+ vec4 Vertex = u_world * vec4(in_pos, 1.0);
+ gl_Position = u_proj * u_view * Vertex;
+ vec3 Normal = mat3(u_world) * in_normal;
+
+ v_tex0 = in_tex0;
+
+ vec4 vertCol = in_color;
+ vec4 amb = u_amb;
+ vec4 emiss = u_emiss;
+
+ vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5;
+ vertCol.xyz += vertBrightness;
+ vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0));
+
+ amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5;
+ amb.xyz += ambientBrightness;
+ amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0));
+
+ emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5;
+ emiss.xyz += emissiveBrightness;
+ emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0));
+ v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz);
+ v_color.w = vertCol.w;
+
+
+ v_color = clamp(v_color, 0.0, 1.0);
+ v_color.a *= u_matColor.a;
+
+ v_fog = DoFog(gl_Position.w);
+}
diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.cso b/src/extras/shaders/leedsBuilding_mobile_VS.cso
new file mode 100644
index 00000000..c3ac2b9b
--- /dev/null
+++ b/src/extras/shaders/leedsBuilding_mobile_VS.cso
Binary files differ
diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.hlsl b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl
new file mode 100644
index 00000000..23accf64
--- /dev/null
+++ b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl
@@ -0,0 +1,64 @@
+#include "standardConstants.h"
+
+#define surfEmissive (surfProps.w)
+
+#define vertContrast (1.5)
+#define vertBrightness (0.25)
+#define ambientContrast (1.2)
+#define ambientBrightness (0.1)
+#define emissiveContrast (1.25)
+#define emissiveBrightness (0.05)
+
+float4 emissive : register(c41);
+float4 ambient : register(c42);
+
+struct VS_in
+{
+ float4 Position : POSITION;
+ float3 Normal : NORMAL;
+ float2 TexCoord : TEXCOORD0;
+ float4 Prelight : COLOR0;
+};
+
+struct VS_out {
+ float4 Position : POSITION;
+ float3 TexCoord0 : TEXCOORD0; // also fog
+ float4 Color : COLOR0;
+};
+
+
+VS_out main(in VS_in input)
+{
+ VS_out output;
+
+ output.Position = mul(combinedMat, input.Position);
+ float3 Vertex = mul(worldMat, input.Position).xyz;
+ float3 Normal = mul(normalMat, input.Normal);
+
+ output.TexCoord0.xy = input.TexCoord;
+
+ float4 vertCol = input.Prelight;
+ float4 amb = ambient;
+ float4 emiss = emissive;
+
+ vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5;
+ vertCol.xyz += vertBrightness;
+ vertCol.xyz = max(vertCol.xyz, float3(0.0,0.0,0.0));
+
+ amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5;
+ amb.xyz += ambientBrightness;
+ amb.xyz = max(amb.xyz, float3(0.0,0.0,0.0));
+
+ emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5;
+ emiss.xyz += emissiveBrightness;
+ emiss.xyz = max(emiss.xyz, float3(0.0,0.0,0.0));
+ output.Color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz);
+ output.Color.w = vertCol.w;
+
+ output.Color = clamp(output.Color, 0.0, 1.0);
+ output.Color.a *= matCol.a;
+
+ output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0);
+
+ return output;
+}
diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.inc b/src/extras/shaders/leedsBuilding_mobile_VS.inc
new file mode 100644
index 00000000..1433ca3f
--- /dev/null
+++ b/src/extras/shaders/leedsBuilding_mobile_VS.inc
@@ -0,0 +1,70 @@
+static unsigned char leedsBuilding_mobile_VS_cso[] = {
+ 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42,
+ 0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff,
+ 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00,
+ 0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
+ 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00,
+ 0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00,
+ 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69,
+ 0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62,
+ 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00,
+ 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67,
+ 0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00,
+ 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f,
+ 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53,
+ 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39,
+ 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05,
+ 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0xc0, 0x3f,
+ 0x00, 0x00, 0x40, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05,
+ 0x05, 0x00, 0x0f, 0xa0, 0x9a, 0x99, 0x99, 0x3f, 0x9a, 0x99, 0x19, 0x3f,
+ 0x00, 0x00, 0xa0, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x51, 0x00, 0x00, 0x05,
+ 0x06, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
+ 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
+ 0x0a, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x02, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0xa0,
+ 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80,
+ 0x04, 0x00, 0x55, 0xa0, 0x04, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0,
+ 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x04, 0x00, 0x00, 0xa0,
+ 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0x00, 0x80,
+ 0x2a, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0e, 0x80,
+ 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0,
+ 0x0b, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xe4, 0x80,
+ 0x04, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80,
+ 0x01, 0x00, 0x00, 0x80, 0x29, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xaa, 0xa0,
+ 0x05, 0x00, 0xff, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xf9, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80,
+ 0x02, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0xa0,
+ 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80,
+ 0x0c, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0xd0,
+ 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
+ 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90,
+ 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80,
+ 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80,
+ 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0,
+ 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03,
+ 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1,
+ 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80,
+ 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80,
+ 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80,
+ 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xa0,
+ 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90,
+ 0xff, 0xff, 0x00, 0x00
+};
diff --git a/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc
new file mode 100644
index 00000000..56bb8a80
--- /dev/null
+++ b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc
@@ -0,0 +1,54 @@
+const char *leedsBuilding_mobile_vert_src =
+"uniform vec4 u_amb;\n"
+"uniform vec4 u_emiss;\n"
+
+"#define surfEmissive (u_surfProps.w)\n"
+
+"#define vertContrast (1.5)\n"
+"#define vertBrightness (0.25)\n"
+"#define ambientContrast (1.2)\n"
+"#define ambientBrightness (0.1)\n"
+"#define emissiveContrast (1.25)\n"
+"#define emissiveBrightness (0.05)\n"
+
+
+"VSIN(ATTRIB_POS) vec3 in_pos;\n"
+
+"VSOUT vec4 v_color;\n"
+"VSOUT vec2 v_tex0;\n"
+"VSOUT float v_fog;\n"
+
+"void\n"
+"main(void)\n"
+"{\n"
+" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
+" gl_Position = u_proj * u_view * Vertex;\n"
+" vec3 Normal = mat3(u_world) * in_normal;\n"
+
+" v_tex0 = in_tex0;\n"
+
+" vec4 vertCol = in_color;\n"
+" vec4 amb = u_amb;\n"
+" vec4 emiss = u_emiss;\n"
+
+" vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5;\n"
+" vertCol.xyz += vertBrightness;\n"
+" vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0));\n"
+" \n"
+" amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5;\n"
+" amb.xyz += ambientBrightness;\n"
+" amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0));\n"
+" \n"
+" emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5;\n"
+" emiss.xyz += emissiveBrightness;\n"
+" emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0));\n"
+" v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz);\n"
+" v_color.w = vertCol.w;\n"
+
+
+" v_color = clamp(v_color, 0.0, 1.0);\n"
+" v_color.a *= u_matColor.a;\n"
+
+" v_fog = DoFog(gl_Position.w);\n"
+"}\n"
+;