diff options
Diffstat (limited to 'src/extras')
21 files changed, 275 insertions, 240 deletions
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp index 092b3e23..a485138e 100644 --- a/src/extras/custompipes.cpp +++ b/src/extras/custompipes.cpp @@ -342,7 +342,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp) */ int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX; -float VehicleShininess = 0.7f; // the default is a bit extreme +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 8b984448..3ad824e3 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -132,6 +132,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) drawInst(header, inst); inst++; } + d3d::setTexture(1, nil); SetRenderState(SRCBLEND, BLENDSRCALPHA); @@ -186,7 +187,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) @@ -244,7 +245,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++; @@ -264,9 +265,9 @@ CreateWorldPipe(void) neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso); assert(neoWorld_VS); -#include "shaders/obj/neoWorldIII_PS.inc" - neoWorldIII_PS = rw::d3d::createPixelShader(neoWorldIII_PS_cso); - assert(neoWorldIII_PS); +#include "shaders/obj/neoWorldVC_PS.inc" + neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso); + assert(neoWorldVC_PS); rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create(); @@ -281,8 +282,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(); @@ -568,7 +569,6 @@ struct BuildingInst { rw::RawMatrix combinedMat; rw::d3d9::InstanceDataHeader *instHeader; - uint32 cullMode; uint8 fadeAlpha; bool lighting; }; @@ -613,7 +613,6 @@ AtomicFirstPass(RpAtomic *atomic, int pass) assert(building->instHeader->platform == PLATFORM_D3D9); building->fadeAlpha = 255; building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->cullMode = rw::GetRenderState(rw::CULLMODE); rw::uint32 flags = atomic->geometry->flags; bool setupDone = false; @@ -632,7 +631,6 @@ AtomicFirstPass(RpAtomic *atomic, int pass) // alright we're rendering this atomic if(!setupDone){ - rw::SetRenderState(rw::CULLMODE, building->cullMode); setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); setIndices(building->instHeader->indexBuffer); setVertexDeclaration(building->instHeader->vertexDeclaration); @@ -674,7 +672,6 @@ AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) assert(building->instHeader->platform == PLATFORM_D3D9); building->fadeAlpha = fadeAlpha; building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->cullMode = rw::GetRenderState(rw::CULLMODE); SetMatrix(building, atomic->getFrame()->getLTM()); numBlendInsts[pass]++; } @@ -692,7 +689,6 @@ RenderBlendPass(int pass) for(i = 0; i < numBlendInsts[pass]; i++){ BuildingInst *building = &blendInsts[pass][i]; - rw::SetRenderState(rw::CULLMODE, building->cullMode); setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); setIndices(building->instHeader->indexBuffer); setVertexDeclaration(building->instHeader->vertexDeclaration); diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index 2b28cb52..d74e40db 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -128,9 +128,10 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) inst++; } - SetRenderState(SRCBLEND, BLENDSRCALPHA); setTexture(1, nil); + SetRenderState(SRCBLEND, BLENDSRCALPHA); + teardownVertexInput(header); } @@ -255,10 +256,10 @@ CreateWorldPipe(void) ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); { -#include "shaders/obj/neoWorldIII_frag.inc" +#include "shaders/obj/neoWorldVC_frag.inc" #include "shaders/obj/default_UV2_vert.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); } @@ -595,7 +596,6 @@ struct BuildingInst { rw::Matrix matrix; rw::gl3::InstanceDataHeader *instHeader; - uint32 cullMode; uint8 fadeAlpha; bool lighting; }; @@ -628,7 +628,6 @@ AtomicFirstPass(RpAtomic *atomic, int pass) assert(building->instHeader->platform == PLATFORM_GL3); building->fadeAlpha = 255; building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->cullMode = rw::GetRenderState(rw::CULLMODE); rw::uint32 flags = atomic->geometry->flags; WorldLights lights; @@ -656,7 +655,6 @@ AtomicFirstPass(RpAtomic *atomic, int pass) // alright we're rendering this atomic if(!setupDone){ - rw::SetRenderState(rw::CULLMODE, building->cullMode); defaultShader->use(); setWorldMatrix(&building->matrix); setupVertexInput(building->instHeader); @@ -689,7 +687,6 @@ AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) assert(building->instHeader->platform == PLATFORM_GL3); building->fadeAlpha = fadeAlpha; building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->cullMode = rw::GetRenderState(rw::CULLMODE); building->matrix = *atomic->getFrame()->getLTM(); numBlendInsts[pass]++; } @@ -710,7 +707,6 @@ RenderBlendPass(int pass) for(i = 0; i < numBlendInsts[pass]; i++){ BuildingInst *building = &blendInsts[pass][i]; - rw::SetRenderState(rw::CULLMODE, building->cullMode); setupVertexInput(building->instHeader); setWorldMatrix(&building->matrix); if(building->lighting) diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h index 45b65d04..f1357c0a 100644 --- a/src/extras/debugmenu.h +++ b/src/extras/debugmenu.h @@ -30,61 +30,61 @@ class CTweakVar { public: - virtual void AddDBG(const char* path) = 0; + virtual void AddDBG(const char *path) = 0; }; class CTweakVars { public: - static void Add(CTweakVar* var); - static void AddDBG(const char* path); + static void Add(CTweakVar *var); + static void AddDBG(const char *path); }; class CTweakFunc : public CTweakVar { - const char* m_pPath, * m_pVarName; + const char *m_pPath, *m_pVarName; void (*m_pFunc)(); public: - CTweakFunc(void (*pFunc)(), const char* strName, const char* strPath) : + CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) : m_pPath(strPath), m_pVarName(strName), m_pFunc(pFunc) { CTweakVars::Add(this); } - - void AddDBG(const char* path); + + void AddDBG(const char *path); }; class CTweakBool : public CTweakVar { - const char* m_pPath, * m_pVarName; - bool* m_pBoolVar; + const char *m_pPath, *m_pVarName; + bool *m_pBoolVar; public: - CTweakBool(bool* pBool, const char* strName, const char* strPath) : + CTweakBool(bool *pBool, const char *strName, const char *strPath) : m_pPath(strPath), m_pVarName(strName), m_pBoolVar(pBool) { CTweakVars::Add(this); } - - void AddDBG(const char* path); + + void AddDBG(const char *path); }; class CTweakSwitch : public CTweakVar { - const char* m_pPath, * m_pVarName; - void* m_pIntVar; + const char *m_pPath, *m_pVarName; + void *m_pIntVar; int32 m_nMin, m_nMax; - const char** m_aStr; + const char **m_aStr; void (*m_pFunc)(); public: - CTweakSwitch(void* pInt, const char* strName, int32 nMin, int32 nMax, const char** aStr, - void (*pFunc)(), const char* strPath) - : m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax), - m_aStr(aStr) + CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr, + void (*pFunc)(), const char *strPath) + : m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax), + m_aStr(aStr) { CTweakVars::Add(this); } - void AddDBG(const char* path); + void AddDBG(const char *path); }; #define _TWEEKCLASS(name, type) \ diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp index 5d388bfd..2660e75e 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* saveCat, const char* saveKey, bool disableIfGameLoaded) +void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat, const char* saveName, bool disableIfGameLoaded) { 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*)); @@ -140,42 +131,39 @@ void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 n option.m_CFOSelect->lastSavedValue = *var; } option.m_CFOSelect->saveCat = saveCat; - option.m_CFOSelect->save = saveKey; + option.m_CFOSelect->save = saveName; option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter; option.m_CFOSelect->changeFunc = changeFunc; option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded; } -void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, const char* saveKey) +void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, 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; option.m_CFODynamic->buttonPressFunc = buttonPressFunc; option.m_CFODynamic->value = var; option.m_CFODynamic->saveCat = saveCat; - option.m_CFODynamic->save = saveKey; + 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 a571170f..db1b9021 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 @@ -54,8 +49,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); @@ -84,10 +78,11 @@ 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 and saveCat saveKey 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* saveCat = nil, const char* saveKey = nil, bool disableIfGameLoaded = false); -void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat = nil, const char* saveKey = nil); +// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveCat and saveKey param. obv), otherwise pass nil/0 +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* saveCat = nil, const char* saveKey = nil, bool disableIfGameLoaded = false); +void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat = nil, const char* saveKey = 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 425a22d4..ee6c3964 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 @@ -145,20 +146,21 @@ CPostFX::Open(RwCamera *cam) #ifdef RW_D3D9 -#include "shaders/obj/colourfilterIII_PS.inc" - colourfilterIII_PS = rw::d3d::createPixelShader(colourfilterIII_PS_cso); +#include "shaders/obj/colourfilterVC_PS.inc" + colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso); #include "shaders/obj/contrastPS.inc" contrast_PS = rw::d3d::createPixelShader(contrastPS_cso); #endif #ifdef RW_OPENGL using namespace rw::gl3; + { #include "shaders/obj/im2d_vert.inc" -#include "shaders/obj/colourfilterIII_frag.inc" +#include "shaders/obj/colourfilterVC_frag.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); } { @@ -185,9 +187,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); @@ -195,9 +197,9 @@ CPostFX::Close(void) } #endif #ifdef RW_OPENGL - if(colourFilterIII){ - colourFilterIII->destroy(); - colourFilterIII = nil; + if(colourFilterVC){ + colourFilterVC->destroy(); + colourFilterVC = nil; } if(contrast){ contrast->destroy(); @@ -212,37 +214,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 @@ -270,12 +270,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); @@ -291,18 +291,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); @@ -339,9 +339,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) @@ -358,11 +357,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; } @@ -377,46 +389,21 @@ 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; - } - PUSH_RENDERGROUP("CPostFX::Render"); + 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); @@ -432,10 +419,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){ @@ -450,10 +435,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); @@ -473,4 +456,39 @@ CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blu POP_RENDERGROUP(); } +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/colourfilterIII.frag b/src/extras/shaders/colourfilterVC.frag index 95e5d052..283aa817 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/colourfilterIII_PS.hlsl b/src/extras/shaders/colourfilterVC_PS.hlsl index 3d893c3c..90d3b50c 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.0; 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/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/obj/colourfilterIII_PS.cso b/src/extras/shaders/obj/colourfilterIII_PS.cso Binary files differdeleted file mode 100644 index cc41bcec..00000000 --- a/src/extras/shaders/obj/colourfilterIII_PS.cso +++ /dev/null diff --git a/src/extras/shaders/obj/colourfilterIII_PS.inc b/src/extras/shaders/obj/colourfilterIII_PS.inc deleted file mode 100644 index db49de6c..00000000 --- a/src/extras/shaders/obj/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/obj/colourfilterVC_PS.cso b/src/extras/shaders/obj/colourfilterVC_PS.cso Binary files differnew file mode 100644 index 00000000..4b0e9f3f --- /dev/null +++ b/src/extras/shaders/obj/colourfilterVC_PS.cso diff --git a/src/extras/shaders/obj/colourfilterVC_PS.inc b/src/extras/shaders/obj/colourfilterVC_PS.inc new file mode 100644 index 00000000..daa18360 --- /dev/null +++ b/src/extras/shaders/obj/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/obj/colourfilterIII_frag.inc b/src/extras/shaders/obj/colourfilterVC_frag.inc index 05f92785..b61322d9 100644 --- a/src/extras/shaders/obj/colourfilterIII_frag.inc +++ b/src/extras/shaders/obj/colourfilterVC_frag.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/obj/neoWorldIII_PS.cso b/src/extras/shaders/obj/neoWorldIII_PS.cso Binary files differdeleted file mode 100644 index 817888ef..00000000 --- a/src/extras/shaders/obj/neoWorldIII_PS.cso +++ /dev/null diff --git a/src/extras/shaders/obj/neoWorldVC_PS.cso b/src/extras/shaders/obj/neoWorldVC_PS.cso Binary files differnew file mode 100644 index 00000000..5e8d1696 --- /dev/null +++ b/src/extras/shaders/obj/neoWorldVC_PS.cso diff --git a/src/extras/shaders/obj/neoWorldIII_PS.inc b/src/extras/shaders/obj/neoWorldVC_PS.inc index a4631efb..eb8bf2ee 100644 --- a/src/extras/shaders/obj/neoWorldIII_PS.inc +++ b/src/extras/shaders/obj/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/obj/neoWorldIII_frag.inc b/src/extras/shaders/obj/neoWorldVC_frag.inc index afd75f57..b4385fc7 100644 --- a/src/extras/shaders/obj/neoWorldIII_frag.inc +++ b/src/extras/shaders/obj/neoWorldVC_frag.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" |