diff options
Diffstat (limited to 'src/extras')
21 files changed, 262 insertions, 220 deletions
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp index bb3ebd2e..d6c8e065 100644 --- a/src/extras/custompipes.cpp +++ b/src/extras/custompipes.cpp @@ -337,8 +337,8 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp) * Neo Vehicle pipe */ -int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX; -float VehicleShininess = 0.7f; // the default is a bit extreme +int32 VehiclePipeSwitch = VEHICLEPIPE_NEO; +float VehicleShininess = 1.0f; float VehicleSpecularity = 1.0f; InterpolatedFloat Fresnel(0.4f); InterpolatedFloat Power(18.0f); diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index b39efd47..01de3f78 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -131,6 +131,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) drawInst(header, inst); inst++; } + d3d::setTexture(1, nil); SetRenderState(SRCBLEND, BLENDSRCALPHA); @@ -182,7 +183,7 @@ DestroyVehiclePipe(void) */ static void *neoWorld_VS; -static void *neoWorldIII_PS; +static void *neoWorldVC_PS; static void worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) @@ -240,7 +241,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) d3d::setTexture(0, m->texture); else d3d::setTexture(0, gpWhiteTexture); - setPixelShader(neoWorldIII_PS); + setPixelShader(neoWorldVC_PS); drawInst(header, inst); inst++; @@ -259,9 +260,9 @@ CreateWorldPipe(void) neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso); assert(neoWorld_VS); -#include "shaders/neoWorldIII_PS.inc" - neoWorldIII_PS = rw::d3d::createPixelShader(neoWorldIII_PS_cso); - assert(neoWorldIII_PS); +#include "shaders/neoWorldVC_PS.inc" + neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso); + assert(neoWorldVC_PS); rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create(); @@ -276,8 +277,8 @@ DestroyWorldPipe(void) { rw::d3d::destroyVertexShader(neoWorld_VS); neoWorld_VS = nil; - rw::d3d::destroyPixelShader(neoWorldIII_PS); - neoWorldIII_PS = nil; + rw::d3d::destroyPixelShader(neoWorldVC_PS); + neoWorldVC_PS = nil; ((rw::d3d9::ObjPipeline*)worldPipe)->destroy(); diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index 861a831e..4cd6607b 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -133,9 +133,10 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) inst++; } - SetRenderState(SRCBLEND, BLENDSRCALPHA); setTexture(1, nil); + SetRenderState(SRCBLEND, BLENDSRCALPHA); + #ifndef RW_GL_USE_VAOS disableAttribPointers(header->attribDesc, header->numAttribs); #endif @@ -252,7 +253,6 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) drawInst(header, inst); inst++; } - setTexture(1, nil); #ifndef RW_GL_USE_VAOS disableAttribPointers(header->attribDesc, header->numAttribs); #endif @@ -270,10 +270,10 @@ CreateWorldPipe(void) ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); { -#include "shaders/neoWorldIII_fs_gl.inc" +#include "shaders/neoWorldVC_fs_gl.inc" #include "shaders/default_UV2_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, default_UV2_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, neoWorldIII_frag_src, nil }; + const char *fs[] = { shaderDecl, header_frag_src, neoWorldVC_frag_src, nil }; neoWorldShader = Shader::create(vs, fs); assert(neoWorldShader); } diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp index a3c4b9e3..1f154250 100644 --- a/src/extras/frontendoption.cpp +++ b/src/extras/frontendoption.cpp @@ -13,24 +13,9 @@ int optionCursor = -2; int currentMenu; bool optionOverwrite = false; -void ChangeScreen(int screen, int option, bool fadeIn) +void GoBack() { - FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen; - FrontEndMenuManager.m_nCurrScreen = screen; - FrontEndMenuManager.m_nCurrOption = option; - if (fadeIn) - FrontEndMenuManager.m_nMenuFadeAlpha = 0; -} - -void GoBack(bool fadeIn) -{ - int screen = !FrontEndMenuManager.m_bGameNotLoaded ? - aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0]; - int option = FrontEndMenuManager.GetPreviousPageOption(); - - FrontEndMenuManager.ThingsToDoBeforeGoingBack(); - - ChangeScreen(screen, option, fadeIn); + FrontEndMenuManager.SwitchToNewScreen(-1); } uint8 @@ -51,7 +36,7 @@ GetLastMenuScreen() { int8 page = -1; for (int i = 0; i < MENUPAGES; i++) { - if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].m_PreviousPage[0] == MENUPAGE_NONE) + if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].m_PreviousPage == MENUPAGE_NONE) break; ++page; @@ -68,7 +53,7 @@ int8 RegisterNewScreen(const char *name, int prevPage, ReturnPrevPageFunc return int id = lastOgScreen + numCustomFrontendScreens; assert(id < MENUPAGES && "No room for new custom frontend screens! Increase MENUPAGES"); strncpy(aScreens[id].m_ScreenName, name, 8); - aScreens[id].m_PreviousPage[0] = aScreens[id].m_PreviousPage[1] = prevPage; + aScreens[id].m_PreviousPage = prevPage; aScreens[id].returnPrevPageFunc = returnPrevPageFunc; return id; } @@ -101,7 +86,7 @@ void FrontendOptionSetCursor(int screen, int8 option, bool overwrite) optionOverwrite = overwrite; } -void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMenu, int saveSlot) { +void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu, int saveSlot) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; @@ -118,17 +103,23 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMe strncpy(option.m_EntryName, gxtKey, 8); break; } + option.m_X = x; + option.m_Y = y; + option.m_Align = align; option.m_Action = action; option.m_SaveSlot = saveSlot; option.m_TargetMenu = targetMenu; } -void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName) +void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; option.m_Action = MENUACTION_CFO_SELECT; + option.m_X = x; + option.m_Y = y; + option.m_Align = align; strncpy(option.m_EntryName, gxtKey, 8); option.m_CFOSelect = new CCFOSelect(); option.m_CFOSelect->rightTexts = (char**)malloc(numRightTexts * sizeof(char*)); @@ -144,12 +135,15 @@ void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 n option.m_CFOSelect->changeFunc = changeFunc; } -void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName) +void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName) { int8 screenOptionOrder = RegisterNewOption(); CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder]; option.m_Action = MENUACTION_CFO_DYNAMIC; + option.m_X = x; + option.m_Y = y; + option.m_Align = align; strncpy(option.m_EntryName, gxtKey, 8); option.m_CFODynamic = new CCFODynamic(); option.m_CFODynamic->drawFunc = drawFunc; @@ -158,21 +152,15 @@ void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, option.m_CFODynamic->save = saveName; } -uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight, - int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) { +// lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT +uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) { uint8 screenOrder = RegisterNewScreen(gxtKey, prevPage, returnPrevPageFunc); CCustomScreenLayout *screen = new CCustomScreenLayout(); aScreens[screenOrder].layout = screen; - screen->sprite = sprite; - screen->columnWidth = columnWidth; - screen->headerHeight = headerHeight; screen->lineHeight = lineHeight; - screen->font = font; - screen->fontScaleX = fontScaleX; - screen->fontScaleY = fontScaleY; - screen->alignment = alignment; + screen->showLeftRightHelper = showLeftRightHelper; return screenOrder; } diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h index 19340b20..6670c323 100644 --- a/src/extras/frontendoption.h +++ b/src/extras/frontendoption.h @@ -26,11 +26,6 @@ #define FEOPTION_ACTION_SELECT 2 #define FEOPTION_ACTION_FOCUSLOSS 3 -// -- Passed via FrontendScreenAdd() -#define FESCREEN_CENTER 0 -#define FESCREEN_LEFT_ALIGN 1 -#define FESCREEN_RIGHT_ALIGN 2 - // -- Callbacks // pretty much in everything I guess, and optional in all of them @@ -52,8 +47,7 @@ extern int numCustomFrontendOptions; extern int numCustomFrontendScreens; // -- To be used in ButtonPressFunc / ChangeFunc(this one would be weird): -void ChangeScreen(int screen, int option = 0, bool fadeIn = true); -void GoBack(bool fadeIn = true); +void GoBack(void); uint8 GetNumberOfMenuOptions(int screen); @@ -83,9 +77,10 @@ uint8 GetNumberOfMenuOptions(int screen); void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false); // var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0 -void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE); -void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil); -void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil); +void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE); +void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil); +void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil); -uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight, int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil); +// lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT +uint8 FrontendScreenAdd(const char* gxtKey, int prevPage, int lineHeight, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil); #endif diff --git a/src/extras/postfx.cpp b/src/extras/postfx.cpp index d3b8b8ac..2ea08141 100644 --- a/src/extras/postfx.cpp +++ b/src/extras/postfx.cpp @@ -17,6 +17,7 @@ RwRaster *CPostFX::pFrontBuffer; RwRaster *CPostFX::pBackBuffer; bool CPostFX::bJustInitialised; int CPostFX::EffectSwitch = POSTFX_NORMAL; +bool CPostFX::BlurOn = false; bool CPostFX::MotionBlurOn = false; static RwIm2DVertex Vertex[4]; @@ -24,14 +25,14 @@ static RwIm2DVertex Vertex2[4]; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; #ifdef RW_D3D9 -void *colourfilterIII_PS; +void *colourfilterVC_PS; void *contrast_PS; #endif #ifdef RW_OPENGL int32 u_blurcolor; int32 u_contrastAdd; int32 u_contrastMult; -rw::gl3::Shader *colourFilterIII; +rw::gl3::Shader *colourFilterVC; rw::gl3::Shader *contrast; #endif @@ -142,20 +143,21 @@ CPostFX::Open(RwCamera *cam) #ifdef RW_D3D9 -#include "shaders/colourfilterIII_PS.inc" - colourfilterIII_PS = rw::d3d::createPixelShader(colourfilterIII_PS_cso); +#include "shaders/colourfilterVC_PS.inc" + colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso); #include "shaders/contrastPS.inc" contrast_PS = rw::d3d::createPixelShader(contrastPS_cso); #endif #ifdef RW_OPENGL using namespace rw::gl3; + { #include "shaders/im2d_gl.inc" -#include "shaders/colourfilterIII_fs_gl.inc" +#include "shaders/colourfilterVC_fs_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, colourfilterIII_frag_src, nil }; - colourFilterIII = Shader::create(vs, fs); - assert(colourFilterIII); + const char *fs[] = { shaderDecl, header_frag_src, colourfilterVC_frag_src, nil }; + colourFilterVC = Shader::create(vs, fs); + assert(colourFilterVC); } { @@ -182,9 +184,9 @@ CPostFX::Close(void) pBackBuffer = nil; } #ifdef RW_D3D9 - if(colourfilterIII_PS){ - rw::d3d::destroyPixelShader(colourfilterIII_PS); - colourfilterIII_PS = nil; + if(colourfilterVC_PS){ + rw::d3d::destroyPixelShader(colourfilterVC_PS); + colourfilterVC_PS = nil; } if(contrast_PS){ rw::d3d::destroyPixelShader(contrast_PS); @@ -192,9 +194,9 @@ CPostFX::Close(void) } #endif #ifdef RW_OPENGL - if(colourFilterIII){ - colourFilterIII->destroy(); - colourFilterIII = nil; + if(colourFilterVC){ + colourFilterVC->destroy(); + colourFilterVC = nil; } if(contrast){ contrast->destroy(); @@ -209,37 +211,35 @@ CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); - RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a); - RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a); - RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a); - RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a); + RwIm2DVertexSetIntRGBA(&Vertex[0], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex[1], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex[2], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex[3], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex2[2], r*2, g*2, b*2, 30); + RwIm2DVertexSetIntRGBA(&Vertex2[3], r*2, g*2, b*2, 30); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); -} + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6); -void -CPostFX::RenderOverlaySimple(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) -{ - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); - - r *= 0.6f; - g *= 0.6f; - b *= 0.6f; - a *= 0.6f; + RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a); + RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a); + RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a); + RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6); } void @@ -267,12 +267,12 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) if(EffectSwitch == POSTFX_MOBILE){ float mult[3], add[3]; - mult[0] = (r-64)/384.0f + 1.14f; - mult[1] = (g-64)/384.0f + 1.14f; - mult[2] = (b-64)/384.0f + 1.14f; - add[0] = r/1536.f; - add[1] = g/1536.f; - add[2] = b/1536.f; + mult[0] = (r-64)/256.0f + 1.4f; + mult[1] = (g-64)/256.0f + 1.4f; + mult[2] = (b-64)/256.0f + 1.4f; + add[0] = r/1536.f - 0.05f; + add[1] = g/1536.f - 0.05f; + add[2] = b/1536.f - 0.05f; #ifdef RW_D3D9 rw::d3d::d3ddevice->SetPixelShaderConstantF(10, mult, 1); rw::d3d::d3ddevice->SetPixelShaderConstantF(11, add, 1); @@ -288,18 +288,18 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) }else{ float f = Intensity; float blurcolors[4]; - blurcolors[0] = r/255.0f; - blurcolors[1] = g/255.0f; - blurcolors[2] = b/255.0f; - blurcolors[3] = a*f/255.0f; + blurcolors[0] = r*f/255.0f; + blurcolors[1] = g*f/255.0f; + blurcolors[2] = b*f/255.0f; + blurcolors[3] = 30/255.0f; #ifdef RW_D3D9 rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1); - rw::d3d::im2dOverridePS = colourfilterIII_PS; + rw::d3d::im2dOverridePS = colourfilterVC_PS; #endif #ifdef RW_OPENGL - rw::gl3::im2dOverrideShader = colourFilterIII; - colourFilterIII->use(); - glUniform4fv(colourFilterIII->uniformLocations[u_blurcolor], 1, blurcolors); + rw::gl3::im2dOverrideShader = colourFilterVC; + colourFilterVC->use(); + glUniform4fv(colourFilterVC->uniformLocations[u_blurcolor], 1, blurcolors); #endif } RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); @@ -336,9 +336,8 @@ CPostFX::NeedBackBuffer(void) // Current frame -- needed for non-blur effect switch(EffectSwitch){ case POSTFX_OFF: - // no actual rendering here - return false; case POSTFX_SIMPLE: + // no actual rendering here return false; case POSTFX_NORMAL: if(MotionBlurOn) @@ -355,11 +354,24 @@ bool CPostFX::NeedFrontBuffer(int32 type) { // Last frame -- needed for motion blur - if(MotionBlurOn) + if(CMBlur::Drunkness > 0.0f) return true; if(type == MOTION_BLUR_SNIPER) return true; + switch(EffectSwitch){ + case POSTFX_OFF: + case POSTFX_SIMPLE: + // no actual rendering here + return false; + case POSTFX_NORMAL: + if(MotionBlurOn) + return true; + else + return false; + case POSTFX_MOBILE: + return false; + } return false; } @@ -374,45 +386,19 @@ CPostFX::GetBackBuffer(RwCamera *cam) void CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha) { - switch(type) - { - case MOTION_BLUR_SECURITY_CAM: - red = 0; - green = 255; - blue = 0; - blur = 128; - break; - case MOTION_BLUR_INTRO: - red = 100; - green = 220; - blue = 230; - blur = 158; - break; - case MOTION_BLUR_INTRO2: - red = 80; - green = 255; - blue = 230; - blur = 138; - break; - case MOTION_BLUR_INTRO3: - red = 255; - green = 60; - blue = 60; - blur = 200; - break; - case MOTION_BLUR_INTRO4: - red = 255; - green = 180; - blue = 180; - blur = 128; - break; - } - if(pFrontBuffer == nil) Open(cam); assert(pFrontBuffer); assert(pBackBuffer); + if(type == MOTION_BLUR_LIGHT_SCENE){ + SmoothColor(red, green, blue, blur); + red = AvgRed; + green = AvgGreen; + blue = AvgBlue; + blur = AvgAlpha; + } + if(NeedBackBuffer()) GetBackBuffer(cam); @@ -428,10 +414,8 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu RenderOverlaySniper(cam, red, green, blue, blur); }else switch(EffectSwitch){ case POSTFX_OFF: - // no actual rendering here - break; case POSTFX_SIMPLE: - RenderOverlaySimple(cam, red, green, blue, blur); + // no actual rendering here break; case POSTFX_NORMAL: if(MotionBlurOn){ @@ -446,10 +430,8 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu break; } - // TODO? maybe we want this even without motion blur on sometimes? - if(MotionBlurOn) - if(!bJustInitialised) - RenderMotionBlur(cam, bluralpha); + if(!bJustInitialised) + RenderMotionBlur(cam, 175.0f * CMBlur::Drunkness); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); @@ -467,4 +449,39 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu bJustInitialised = true; } +int CPostFX::PrevRed[NUMAVERAGE], CPostFX::AvgRed; +int CPostFX::PrevGreen[NUMAVERAGE], CPostFX::AvgGreen; +int CPostFX::PrevBlue[NUMAVERAGE], CPostFX::AvgBlue; +int CPostFX::PrevAlpha[NUMAVERAGE], CPostFX::AvgAlpha; +int CPostFX::Next; +int CPostFX::NumValues; + +// This is rather annoying...the blur color can flicker slightly +// which becomes very visible when amplified by the shader +void +CPostFX::SmoothColor(uint32 red, uint32 green, uint32 blue, uint32 alpha) +{ + PrevRed[Next] = red; + PrevGreen[Next] = green; + PrevBlue[Next] = blue; + PrevAlpha[Next] = alpha; + Next = (Next+1) % NUMAVERAGE; + NumValues = Min(NumValues+1, NUMAVERAGE); + + AvgRed = 0; + AvgGreen = 0; + AvgBlue = 0; + AvgAlpha = 0; + for(int i = 0; i < NumValues; i++){ + AvgRed += PrevRed[i]; + AvgGreen += PrevGreen[i]; + AvgBlue += PrevBlue[i]; + AvgAlpha += PrevAlpha[i]; + } + AvgRed /= NumValues; + AvgGreen /= NumValues; + AvgBlue /= NumValues; + AvgAlpha /= NumValues; +} + #endif diff --git a/src/extras/postfx.h b/src/extras/postfx.h index f8779a6d..db702bf3 100644 --- a/src/extras/postfx.h +++ b/src/extras/postfx.h @@ -15,18 +15,28 @@ public: static RwRaster *pBackBuffer; static bool bJustInitialised; static int EffectSwitch; + static bool BlurOn; // or use CMblur for that? static bool MotionBlurOn; // or use CMblur for that? static float Intensity; + // smooth blur color + enum { NUMAVERAGE = 20 }; + static int PrevRed[NUMAVERAGE], AvgRed; + static int PrevGreen[NUMAVERAGE], AvgGreen; + static int PrevBlue[NUMAVERAGE], AvgBlue; + static int PrevAlpha[NUMAVERAGE], AvgAlpha; + static int Next; + static int NumValues; + static void InitOnce(void); static void Open(RwCamera *cam); static void Close(void); static void RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a); - static void RenderOverlaySimple(RwCamera *cam, int32 r, int32 g, int32 b, int32 a); static void RenderOverlaySniper(RwCamera *cam, int32 r, int32 g, int32 b, int32 a); static void RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a); static void RenderMotionBlur(RwCamera *cam, uint32 blur); static void Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha); + static void SmoothColor(uint32 red, uint32 green, uint32 blue, uint32 alpha); static bool NeedBackBuffer(void); static bool NeedFrontBuffer(int32 type); static void GetBackBuffer(RwCamera *cam); diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile index 51e009d6..5089e16a 100644 --- a/src/extras/shaders/Makefile +++ b/src/extras/shaders/Makefile @@ -1,7 +1,7 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \ - colourfilterIII_fs_gl.inc contrast_fs_gl.inc \ + colourfilterVC_fs_gl.inc contrast_fs_gl.inc \ neoRim_gl.inc neoRimSkin_gl.inc \ - neoWorldIII_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 \ im2d_UV2_gl.inc screenDroplet_fs_gl.inc @@ -10,6 +10,10 @@ im2d_gl.inc: im2d.vert sed 's/..*/"&\\n"/' im2d.vert;\ echo ';') >im2d_gl.inc +colourfilterVC_fs_gl.inc: colourfilterVC.frag + (echo 'const char *colourfilterVC_frag_src =';\ + sed 's/..*/"&\\n"/' colourfilterVC.frag;\ + echo ';') >colourfilterVC_fs_gl.inc simple_fs_gl.inc: simple.frag (echo 'const char *simple_frag_src =';\ sed 's/..*/"&\\n"/' simple.frag;\ @@ -22,11 +26,6 @@ default_UV2_gl.inc: default_UV2.vert -colourfilterIII_fs_gl.inc: colourfilterIII.frag - (echo 'const char *colourfilterIII_frag_src =';\ - sed 's/..*/"&\\n"/' colourfilterIII.frag;\ - echo ';') >colourfilterIII_fs_gl.inc - contrast_fs_gl.inc: contrast.frag (echo 'const char *contrast_frag_src =';\ sed 's/..*/"&\\n"/' contrast.frag;\ @@ -43,10 +42,10 @@ neoRimSkin_gl.inc: neoRimSkin.vert sed 's/..*/"&\\n"/' neoRimSkin.vert;\ echo ';') >neoRimSkin_gl.inc -neoWorldIII_fs_gl.inc: neoWorldIII.frag - (echo 'const char *neoWorldIII_frag_src =';\ - sed 's/..*/"&\\n"/' neoWorldIII.frag;\ - echo ';') >neoWorldIII_fs_gl.inc +neoWorldVC_fs_gl.inc: neoWorldVC.frag + (echo 'const char *neoWorldVC_frag_src =';\ + sed 's/..*/"&\\n"/' neoWorldVC.frag;\ + echo ';') >neoWorldVC_fs_gl.inc neoGloss_fs_gl.inc: neoGloss.frag (echo 'const char *neoGloss_frag_src =';\ diff --git a/src/extras/shaders/colourfilterIII_PS.cso b/src/extras/shaders/colourfilterIII_PS.cso Binary files differdeleted file mode 100644 index cc41bcec..00000000 --- a/src/extras/shaders/colourfilterIII_PS.cso +++ /dev/null diff --git a/src/extras/shaders/colourfilterIII_PS.inc b/src/extras/shaders/colourfilterIII_PS.inc deleted file mode 100644 index db49de6c..00000000 --- a/src/extras/shaders/colourfilterIII_PS.inc +++ /dev/null @@ -1,40 +0,0 @@ -static unsigned char colourfilterIII_PS_cso[] = { - 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, - 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, - 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, - 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, - 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x70, 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, 0x00, 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, 0x03, 0xb0, - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, - 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, - 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, - 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, - 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, - 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, - 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, - 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x08, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, - 0x02, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 -}; diff --git a/src/extras/shaders/colourfilterIII.frag b/src/extras/shaders/colourfilterVC.frag index b41cb94a..9db3950e 100644 --- a/src/extras/shaders/colourfilterIII.frag +++ b/src/extras/shaders/colourfilterVC.frag @@ -9,10 +9,13 @@ void main(void) { float a = u_blurcolor.a; + vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0); vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); vec4 prev = dst; for(int i = 0; i < 5; i++){ - vec4 tmp = dst*(1.0-a) + prev*u_blurcolor*a; + vec4 tmp = dst*(1.0-a) + prev*doublec*a; + tmp += prev*u_blurcolor; + tmp += prev*u_blurcolor; prev = clamp(tmp, 0.0, 1.0); } vec4 color; diff --git a/src/extras/shaders/colourfilterVC_PS.cso b/src/extras/shaders/colourfilterVC_PS.cso Binary files differnew file mode 100644 index 00000000..4b0e9f3f --- /dev/null +++ b/src/extras/shaders/colourfilterVC_PS.cso diff --git a/src/extras/shaders/colourfilterIII_PS.hlsl b/src/extras/shaders/colourfilterVC_PS.hlsl index 27f099ef..1e62950b 100644 --- a/src/extras/shaders/colourfilterIII_PS.hlsl +++ b/src/extras/shaders/colourfilterVC_PS.hlsl @@ -1,13 +1,21 @@ sampler2D tex : register(s0); float4 blurcol : register(c10); +//float4 blurcols[10] : register(c15); + + float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 { float a = blurcol.a; + + float4 doublec = saturate(blurcol*2); float4 dst = tex2D(tex, texcoord.xy); float4 prev = dst; for(int i = 0; i < 5; i++){ - float4 tmp = dst*(1-a) + prev*blurcol*a; +// float4 doublec = saturate(blurcol*2); + float4 tmp = dst*(1-a) + prev*doublec*a; + tmp += prev*blurcol; + tmp += prev*blurcol; prev = saturate(tmp); } prev.a = 1.0f; diff --git a/src/extras/shaders/colourfilterVC_PS.inc b/src/extras/shaders/colourfilterVC_PS.inc new file mode 100644 index 00000000..daa18360 --- /dev/null +++ b/src/extras/shaders/colourfilterVC_PS.inc @@ -0,0 +1,56 @@ +static unsigned char colourfilterVC_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, + 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, + 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 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, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, + 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x17, 0x80, + 0x0a, 0x00, 0xe4, 0xa0, 0x0a, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xff, 0xa0, + 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, + 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, + 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, + 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, + 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, + 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/colourfilterIII_fs_gl.inc b/src/extras/shaders/colourfilterVC_fs_gl.inc index 6fd1935b..1f9bf6d8 100644 --- a/src/extras/shaders/colourfilterIII_fs_gl.inc +++ b/src/extras/shaders/colourfilterVC_fs_gl.inc @@ -1,4 +1,4 @@ -const char *colourfilterIII_frag_src = +const char *colourfilterVC_frag_src = "uniform sampler2D tex0;\n" "uniform vec4 u_blurcolor;\n" @@ -10,10 +10,13 @@ const char *colourfilterIII_frag_src = "main(void)\n" "{\n" " float a = u_blurcolor.a;\n" +" vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0);\n" " vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" " vec4 prev = dst;\n" " for(int i = 0; i < 5; i++){\n" -" vec4 tmp = dst*(1.0-a) + prev*u_blurcolor*a;\n" +" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n" +" tmp += prev*u_blurcolor;\n" +" tmp += prev*u_blurcolor;\n" " prev = clamp(tmp, 0.0, 1.0);\n" " }\n" " vec4 color;\n" diff --git a/src/extras/shaders/neoWorldIII_PS.cso b/src/extras/shaders/neoWorldIII_PS.cso Binary files differdeleted file mode 100644 index 817888ef..00000000 --- a/src/extras/shaders/neoWorldIII_PS.cso +++ /dev/null diff --git a/src/extras/shaders/neoWorldIII.frag b/src/extras/shaders/neoWorldVC.frag index d8bb7159..08cae743 100644 --- a/src/extras/shaders/neoWorldIII.frag +++ b/src/extras/shaders/neoWorldVC.frag @@ -14,7 +14,8 @@ main(void) vec4 t0 = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); vec4 t1 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y)); - vec4 color = t0*v_color*(1.0 + u_lightMap*(2.0*t1-1.0)); + vec4 color; + color = t0*v_color*(1.0 + u_lightMap*(t1-1.0)); color.a = v_color.a*t0.a*u_lightMap.a; color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog); diff --git a/src/extras/shaders/neoWorldVC_PS.cso b/src/extras/shaders/neoWorldVC_PS.cso Binary files differnew file mode 100644 index 00000000..5e8d1696 --- /dev/null +++ b/src/extras/shaders/neoWorldVC_PS.cso diff --git a/src/extras/shaders/neoWorldIII_PS.hlsl b/src/extras/shaders/neoWorldVC_PS.hlsl index 8a3d5d86..fc4f1de9 100644 --- a/src/extras/shaders/neoWorldIII_PS.hlsl +++ b/src/extras/shaders/neoWorldVC_PS.hlsl @@ -16,7 +16,7 @@ main(PS_INPUT IN) : COLOR float4 t0 = tex2D(Diffuse, IN.Tex0.xy); float4 t1 = tex2D(Light, IN.Tex1); - float4 col = t0*IN.Color*(1 + lm*(2*t1-1)); + float4 col = t0*IN.Color*(1 + lm*(t1-1)); col.a = IN.Color.a*t0.a*lm.a; col.rgb = lerp(fogColor.rgb, col.rgb, IN.Tex0.z); diff --git a/src/extras/shaders/neoWorldIII_PS.inc b/src/extras/shaders/neoWorldVC_PS.inc index a4631efb..eb8bf2ee 100644 --- a/src/extras/shaders/neoWorldIII_PS.inc +++ b/src/extras/shaders/neoWorldVC_PS.inc @@ -1,4 +1,4 @@ -static unsigned char neoWorldIII_PS_cso[] = { +static unsigned char neoWorldVC_PS_cso[] = { 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x3e, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, @@ -21,7 +21,7 @@ static unsigned char neoWorldIII_PS_cso[] = { 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, 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, @@ -30,17 +30,17 @@ static unsigned char neoWorldIII_PS_cso[] = { 0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x01, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, 0xaa, 0xa0, 0x04, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, - 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x05, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, - 0x01, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, - 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa1, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, - 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 + 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x02, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x02, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, + 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xff, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x90, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, + 0x01, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0x05, 0x00, 0x00, 0x03, + 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xff, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa1, 0x04, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 }; diff --git a/src/extras/shaders/neoWorldIII_fs_gl.inc b/src/extras/shaders/neoWorldVC_fs_gl.inc index afd75f57..b4385fc7 100644 --- a/src/extras/shaders/neoWorldIII_fs_gl.inc +++ b/src/extras/shaders/neoWorldVC_fs_gl.inc @@ -1,4 +1,4 @@ -const char *neoWorldIII_frag_src = +const char *neoWorldVC_frag_src = "uniform sampler2D tex0;\n" "uniform sampler2D tex1;\n" @@ -15,7 +15,8 @@ const char *neoWorldIII_frag_src = " vec4 t0 = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" " vec4 t1 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n" -" vec4 color = t0*v_color*(1.0 + u_lightMap*(2.0*t1-1.0));\n" +" vec4 color;\n" +" color = t0*v_color*(1.0 + u_lightMap*(t1-1.0));\n" " color.a = v_color.a*t0.a*u_lightMap.a;\n" " color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n" |