diff --git a/premake5.lua b/premake5.lua index 6ae7134..50e102f 100644 --- a/premake5.lua +++ b/premake5.lua @@ -4,7 +4,7 @@ workspace "skygfx" defines { "rsc_CompanyName=\"aap\"" } defines { "rsc_LegalCopyright=\"\""} - defines { "rsc_FileVersion=\"4.1.0.0\"", "rsc_ProductVersion=\"4.1.0.0\"" } + defines { "rsc_FileVersion=\"4.2.0.0\"", "rsc_ProductVersion=\"4.2.0.0\"" } defines { "rsc_InternalName=\"%{prj.name}\"", "rsc_ProductName=\"%{prj.name}\"", "rsc_OriginalFilename=\"%{prj.name}.dll\"" } defines { "rsc_FileDescription=\"https://github.com/aap\"" } defines { "rsc_UpdateUrl=\"https://github.com/aap/skygfx\"" } diff --git a/resources/VersionInfo.rc b/resources/VersionInfo.rc index 223c334..a662853 100644 Binary files a/resources/VersionInfo.rc and b/resources/VersionInfo.rc differ diff --git a/shaders/vs/envCarVS.hlsl b/shaders/vs/envCarVS.hlsl index dc4e925..c601bf1 100644 --- a/shaders/vs/envCarVS.hlsl +++ b/shaders/vs/envCarVS.hlsl @@ -9,9 +9,6 @@ float4 fxParams : register(c21); float4x4 world : register(c30); float3 eye : register(c34); -// spec test -float3x3 specmat : register(c40); - #define fresnel (fxParams.x) //#define power (fxParams.y) //#define lightmult (fxParams.z) diff --git a/src/envmap.cpp b/src/envmap.cpp index 4e33757..546f65a 100644 --- a/src/envmap.cpp +++ b/src/envmap.cpp @@ -108,7 +108,6 @@ class CAtomicModelInfo : public CBaseModelInfo WRAPPER void CEntity::GetBoundCentre(CVector *v) { EAXJMP(0x534290); } WRAPPER bool CEntity::GetIsOnScreen_orig(void) { EAXJMP(0x534540); } -// TODO: FLAify this? CBaseModelInfo **CModelInfo__ms_modelInfoPtrs;// = (CBaseModelInfo**)0xA9B0C8; CBaseModelInfo* GetModelInfo(CEntity *e) @@ -413,17 +412,19 @@ RenderSphereReflections(void) RwCameraSetFarClipPlane(cam, sphereRadius); RwCameraSetFogDistance(cam, sphereRadius*0.75f); + RwRGBA skyBot = { skyBotRed, skyBotGreen, skyBotBlue, 255 }; + RwRGBA skyTop = { skyTopRed, skyTopGreen, skyTopBlue, 255 }; RwRGBA color; if(config->vehiclePipe == CAR_ENV){ - // like Neo - static RwRGBA skyBot = { skyBotRed, skyBotGreen, skyBotBlue, 255 }; - color = skyBot; + // more like Neo + // color = skyBot; + color = skyTop; // blend a bit of white into the sky color, otherwise it tends to be very blue - color.red = color.red*0.6f + 255*0.4f; - color.green = color.green*0.6f + 255*0.4f; - color.blue = color.blue*0.6f + 255*0.4f; + float f = 0.7f; + color.red = color.red*f + 255*(1.0f - f); + color.green = color.green*f + 255*(1.0f - f); + color.blue = color.blue*f + 255*(1.0f - f); }else{ - static RwRGBA skyTop = { skyTopRed, skyTopGreen, skyTopBlue, 255 }; color = skyTop; if(color.red < 64) color.red = 64; if(color.green < 64) color.green = 64; diff --git a/src/main.cpp b/src/main.cpp index f1ecc98..dfc483b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1613,6 +1613,10 @@ DllMain(HINSTANCE hInst, DWORD reason, LPVOID) static float multipassMultiplier = 1000.0f; // default 45.0 Patch(0x73290A+2, &multipassMultiplier); + // increase env mat pool + // better do it in a limit adjuster + //Patch(0x5DA08D + 1, 0x4000); + // Get rid of the annoying dotproduct check in visibility renderCBs Nop(0x733313, 2); // VehicleHiDetailCB Nop(0x73405A, 2); // VehicleHiDetailAlphaCB diff --git a/src/vehiclePipe.cpp b/src/vehiclePipe.cpp index a1ad9af..6e98009 100644 --- a/src/vehiclePipe.cpp +++ b/src/vehiclePipe.cpp @@ -1273,7 +1273,7 @@ CCustomCarEnvMapPipeline__CustomPipeRenderCB_Env(RwResEntry *repEntry, void *obj RwD3D9SetVertexShaderConstant(30, transform, 4); eye = RwFrameGetLTM(RwCameraGetFrame((RwCamera*)RWSRCGLOBAL(curCamera)))->pos; RwD3D9SetVertexShaderConstant(34, &eye, 1); -RwD3D9SetPixelShaderConstant(2, &eye, 1); + RwD3D9SetPixelShaderConstant(2, &eye, 1); RwMatrixInvert(&lightmat, RwFrameGetLTM(RpAtomicGetFrame(atomic))); if(flags & rpGEOMETRYLIGHT) uploadLights(&lightmat); @@ -1306,24 +1306,17 @@ RwD3D9SetPixelShaderConstant(2, &eye, 1); pipeSetTexture(reflectionTex, 1); pipeSetTexture(CarPipe::reflectionMask, 2); -// spectest -RwMatrix specmat; -RwV3d specdir; -CCustomCarEnvMapPipeline__SetupSpec(atomic, &specmat, &specdir); -RwD3D9SetVertexShaderConstant(40, &specmat, 3); -//specdir = RwFrameGetMatrix(RpLightGetFrame(pDirect))->at; -//RwD3D9SetPixelShaderConstant(3, &specdir, 1); - -pipeUploadLightColorPS(pDirect, REG_directCol); -pipeUploadLightDirectionPS(pDirect, REG_directDir); -for(int i = 0; i < 6; i++) - if(i < NumExtraDirLightsInWorld && RpLightGetType(pExtraDirectionals[i]) == rpLIGHTDIRECTIONAL){ - pipeUploadLightColorPS(pExtraDirectionals[i], REG_directCol+i+1); - pipeUploadLightDirectionPS(pExtraDirectionals[i], REG_directDir+i+1); - }else{ - pipeUploadZeroPS(REG_directCol+i+1); - pipeUploadZeroPS(REG_directDir+i+1); - } + // Per pixel lights + pipeUploadLightColorPS(pDirect, REG_directCol); + pipeUploadLightDirectionPS(pDirect, REG_directDir); + for(int i = 0; i < 6; i++) + if(i < NumExtraDirLightsInWorld && RpLightGetType(pExtraDirectionals[i]) == rpLIGHTDIRECTIONAL){ + pipeUploadLightColorPS(pExtraDirectionals[i], REG_directCol+i+1); + pipeUploadLightDirectionPS(pExtraDirectionals[i], REG_directDir+i+1); + }else{ + pipeUploadZeroPS(REG_directCol+i+1); + pipeUploadZeroPS(REG_directDir+i+1); + } for(; numMeshes--; instancedData++){ @@ -1374,8 +1367,8 @@ for(int i = 0; i < 6; i++) surfProps.ambient = max(surfProps.ambient, 0.8f); RwD3D9SetVertexShaderConstant(REG_surfProps, &surfProps, 1); RwD3D9SetVertexShaderConstant(21, &fxParams, 1); -RwD3D9SetPixelShaderConstant(0, &surfProps, 1); -RwD3D9SetPixelShaderConstant(1, &fxParams, 1); + RwD3D9SetPixelShaderConstant(0, &surfProps, 1); + RwD3D9SetPixelShaderConstant(1, &fxParams, 1); RwD3D9SetVertexShader(envCarVS); RwD3D9SetPixelShader(envCarPS);