1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 19:40:00 +00:00

mobile building rendering

This commit is contained in:
aap 2021-01-10 19:45:58 +01:00
parent c3b6e9da43
commit 93ea98520b
14 changed files with 327 additions and 25 deletions

View file

@ -58,6 +58,19 @@ const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR;
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100); const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
const CRGBA SCROLLBAR_COLOR = LABEL_COLOR; 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_MIN_SIZE 162.f
#define MAP_SIZE_TO_ALLOW_X_MOVE 297.f #define MAP_SIZE_TO_ALLOW_X_MOVE 297.f
@ -465,7 +478,7 @@ CMenuManager::CMenuManager()
m_PrefsMusicVolume = 49; m_PrefsMusicVolume = 49;
m_PrefsRadioStation = 0; m_PrefsRadioStation = 0;
m_PrefsStereoMono = 1; m_PrefsStereoMono = 1;
m_PrefsBrightness = 256; m_PrefsBrightness = DEFAULT_BRIGHTNESS;
m_PrefsLOD = CRenderer::ms_lodDistScale; m_PrefsLOD = CRenderer::ms_lodDistScale;
m_KeyPressedCode = -1; m_KeyPressedCode = -1;
m_bFrontEnd_ReloadObrTxtGxt = false; m_bFrontEnd_ReloadObrTxtGxt = false;
@ -674,8 +687,8 @@ CMenuManager::CheckSliderMovement(int value)
{ {
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS: case MENUACTION_BRIGHTNESS:
m_PrefsBrightness += value * 24.19f; m_PrefsBrightness += value * 32.0f;
m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 384); m_PrefsBrightness = clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
break; break;
case MENUACTION_DRAWDIST: case MENUACTION_DRAWDIST:
if(value > 0) if(value > 0)
@ -1464,7 +1477,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
int lastActiveBarX; int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS: 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; break;
case MENUACTION_DRAWDIST: case MENUACTION_DRAWDIST:
ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true); 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); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
SaveSettings(); SaveSettings();
} else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) {
m_PrefsBrightness = 256; m_PrefsBrightness = DEFAULT_BRIGHTNESS;
m_PrefsLOD = 1.2f; m_PrefsLOD = 1.2f;
#ifdef LEGACY_MENU_OPTIONS #ifdef LEGACY_MENU_OPTIONS
m_PrefsVsync = true; m_PrefsVsync = true;

View file

@ -600,6 +600,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); }); DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); });
DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil); 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", "Backface Culling", &gBackfaceCulling, nil);
DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil); DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil); DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
@ -630,8 +631,8 @@ extern bool gbRenderWorld2;
#endif #endif
#ifdef EXTENDED_COLOURFILTER #ifdef EXTENDED_COLOURFILTER
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" }; static const char *filternames[] = { "None", "PS2" };
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames); e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_NORMAL, filternames);
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f); DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil); DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
@ -642,6 +643,10 @@ extern bool gbRenderWorld2;
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil); DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
#endif #endif
#ifdef EXTENDED_PIPELINES #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" }; static const char *vehpipenames[] = { "MatFX", "Neo" };
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil, e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames); 1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames);

View file

@ -370,6 +370,7 @@ AttachVehiclePipe(rw::Clump *clump)
* Neo World pipe * Neo World pipe
*/ */
int32 WorldPipeSwitch = 0;
bool LightmapEnable; bool LightmapEnable;
float LightmapMult = 1.0f; float LightmapMult = 1.0f;
InterpolatedFloat WorldLightmapBlend(1.0f); InterpolatedFloat WorldLightmapBlend(1.0f);

View file

@ -102,6 +102,11 @@ void DestroyVehiclePipe(void);
void AttachVehiclePipe(rw::Atomic *atomic); void AttachVehiclePipe(rw::Atomic *atomic);
void AttachVehiclePipe(rw::Clump *clump); void AttachVehiclePipe(rw::Clump *clump);
enum {
WORLDPIPE_PS2,
WORLDPIPE_MOBILE
};
extern int32 WorldPipeSwitch;
extern bool LightmapEnable; extern bool LightmapEnable;
extern float LightmapMult; extern float LightmapMult;
extern InterpolatedFloat WorldLightmapBlend; extern InterpolatedFloat WorldLightmapBlend;

View file

@ -315,6 +315,7 @@ DestroyVehiclePipe(void)
*/ */
static void *leedsBuilding_VS; static void *leedsBuilding_VS;
static void *leedsBuilding_mobile_VS;
static void *scale_PS; static void *scale_PS;
static void static void
@ -328,7 +329,10 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
setIndices(header->indexBuffer); setIndices(header->indexBuffer);
setVertexDeclaration(header->vertexDeclaration); 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); setPixelShader(scale_PS);
uploadMatrices(atomic->getFrame()->getLTM()); uploadMatrices(atomic->getFrame()->getLTM());
@ -351,7 +355,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
Material *m = inst->material; Material *m = inst->material;
float cs = 1.0f; float cs = 1.0f;
if(m->texture) if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
@ -361,7 +365,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
else else
d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this 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); SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
@ -381,6 +385,9 @@ CreateWorldPipe(void)
#include "shaders/leedsBuilding_VS.inc" #include "shaders/leedsBuilding_VS.inc"
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso); leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
assert(leedsBuilding_VS); 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" #include "shaders/scale_PS.inc"
scale_PS = rw::d3d::createPixelShader(scale_PS_cso); scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
assert(scale_PS); assert(scale_PS);
@ -397,6 +404,8 @@ DestroyWorldPipe(void)
{ {
rw::d3d::destroyVertexShader(leedsBuilding_VS); rw::d3d::destroyVertexShader(leedsBuilding_VS);
leedsBuilding_VS = nil; leedsBuilding_VS = nil;
rw::d3d::destroyVertexShader(leedsBuilding_mobile_VS);
leedsBuilding_mobile_VS = nil;
rw::d3d::destroyPixelShader(scale_PS); rw::d3d::destroyPixelShader(scale_PS);
scale_PS = nil; scale_PS = nil;
@ -747,6 +756,9 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
setIndices(building->instHeader->indexBuffer); setIndices(building->instHeader->indexBuffer);
setVertexDeclaration(building->instHeader->vertexDeclaration); setVertexDeclaration(building->instHeader->vertexDeclaration);
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
else
setVertexShader(CustomPipes::leedsBuilding_VS); setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(CustomPipes::scale_PS); setPixelShader(CustomPipes::scale_PS);
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
@ -767,7 +779,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
} }
float cs = 1.0f; float cs = 1.0f;
if(m->texture) if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
@ -808,6 +820,9 @@ RenderBlendPass(int pass)
using namespace rw::d3d; using namespace rw::d3d;
using namespace rw::d3d9; using namespace rw::d3d9;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
else
setVertexShader(CustomPipes::leedsBuilding_VS); setVertexShader(CustomPipes::leedsBuilding_VS);
setPixelShader(CustomPipes::scale_PS); setPixelShader(CustomPipes::scale_PS);
@ -842,7 +857,7 @@ RenderBlendPass(int pass)
continue; // already done this one continue; // already done this one
float cs = 1.0f; float cs = 1.0f;
if(m->texture) // always true if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);

View file

@ -331,6 +331,7 @@ DestroyVehiclePipe(void)
*/ */
rw::gl3::Shader *leedsWorldShader; rw::gl3::Shader *leedsWorldShader;
rw::gl3::Shader *leedsWorldShader_mobile;
static void static void
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
@ -353,7 +354,10 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
InstanceData *inst = header->inst; InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes; rw::int32 n = header->numMeshes;
leedsWorldShader->use(); if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
CustomPipes::leedsWorldShader_mobile->use();
else
CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss; RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed(); amb.red = CTimeCycle::GetAmbientRed();
@ -372,7 +376,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
m = inst->material; m = inst->material;
float cs = 1.0f; float cs = 1.0f;
if(m->texture) if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(u_colorscale), 1, colorscale); glUniform4fv(U(u_colorscale), 1, colorscale);
@ -405,10 +409,14 @@ CreateWorldPipe(void)
{ {
#include "shaders/scale_fs_gl.inc" #include "shaders/scale_fs_gl.inc"
#include "shaders/leedsBuilding_vs_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[] = { 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 }; const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil };
leedsWorldShader = Shader::create(vs, fs); leedsWorldShader = Shader::create(vs, fs);
assert(leedsWorldShader); assert(leedsWorldShader);
leedsWorldShader_mobile = Shader::create(vs_mobile, fs);
assert(leedsWorldShader_mobile);
} }
@ -424,6 +432,8 @@ DestroyWorldPipe(void)
{ {
leedsWorldShader->destroy(); leedsWorldShader->destroy();
leedsWorldShader = nil; leedsWorldShader = nil;
leedsWorldShader_mobile->destroy();
leedsWorldShader_mobile = nil;
((rw::gl3::ObjPipeline*)worldPipe)->destroy(); ((rw::gl3::ObjPipeline*)worldPipe)->destroy();
worldPipe = nil; worldPipe = nil;
@ -816,8 +826,10 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
// alright we're rendering this atomic // alright we're rendering this atomic
if(!setupDone){ if(!setupDone){
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
CustomPipes::leedsWorldShader_mobile->use();
else
CustomPipes::leedsWorldShader->use(); CustomPipes::leedsWorldShader->use();
// defaultShader->use();
setWorldMatrix(&building->matrix); setWorldMatrix(&building->matrix);
#ifdef RW_GL_USE_VAOS #ifdef RW_GL_USE_VAOS
glBindVertexArray(building->instHeader->vao); glBindVertexArray(building->instHeader->vao);
@ -845,7 +857,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
setMaterial(m->color, m->surfaceProps, 0.5f); setMaterial(m->color, m->surfaceProps, 0.5f);
float cs = 1.0f; float cs = 1.0f;
if(m->texture) if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
@ -885,6 +897,9 @@ RenderBlendPass(int pass)
using namespace rw; using namespace rw;
using namespace rw::gl3; using namespace rw::gl3;
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
CustomPipes::leedsWorldShader_mobile->use();
else
CustomPipes::leedsWorldShader->use(); CustomPipes::leedsWorldShader->use();
RGBAf amb, emiss; RGBAf amb, emiss;
@ -926,7 +941,7 @@ RenderBlendPass(int pass)
setMaterial(color, m->surfaceProps, 0.5f); setMaterial(color, m->surfaceProps, 0.5f);
float cs = 1.0f; float cs = 1.0f;
if(m->texture) // always true if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
cs = 255/128.0f; cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs; colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);

View file

@ -7,9 +7,13 @@ class CPostFX
public: public:
enum { enum {
POSTFX_OFF, POSTFX_OFF,
POSTFX_SIMPLE, // POSTFX_SIMPLE,
POSTFX_NORMAL, POSTFX_NORMAL,
POSTFX_MOBILE // POSTFX_MOBILE
// not so sensible for the moment
POSTFX_SIMPLE = -1,
POSTFX_MOBILE = -2
}; };
static RwRaster *pFrontBuffer; static RwRaster *pFrontBuffer;
static RwRaster *pBackBuffer; static RwRaster *pBackBuffer;

View file

@ -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 \ neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \ neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \
im2d_UV2_gl.inc screenDroplet_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 leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc
im2d_gl.inc: im2d.vert im2d_gl.inc: im2d.vert
@ -84,6 +84,11 @@ leedsBuilding_vs_gl.inc: leedsBuilding.vert
sed 's/..*/"&\\n"/' leedsBuilding.vert;\ sed 's/..*/"&\\n"/' leedsBuilding.vert;\
echo ';') >leedsBuilding_vs_gl.inc 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 scale_fs_gl.inc: scale.frag
(echo 'const char *scale_frag_src =';\ (echo 'const char *scale_frag_src =';\
sed 's/..*/"&\\n"/' scale.frag;\ sed 's/..*/"&\\n"/' scale.frag;\

View file

@ -2,7 +2,6 @@
#define surfEmissive (surfProps.w) #define surfEmissive (surfProps.w)
float4 emissive : register(c41); float4 emissive : register(c41);
float4 ambient : register(c42); float4 ambient : register(c42);

View file

@ -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);
}

Binary file not shown.

View file

@ -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;
}

View file

@ -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
};

View file

@ -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"
;