Skip to content

Commit

Permalink
4.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
aap committed Jan 7, 2020
1 parent 4f272eb commit 8d19425
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 33 deletions.
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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\"" }
Expand Down
Binary file modified resources/VersionInfo.rc
Binary file not shown.
3 changes: 0 additions & 3 deletions shaders/vs/envCarVS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions src/envmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,10 @@ DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
static float multipassMultiplier = 1000.0f; // default 45.0
Patch<float*>(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
Expand Down
35 changes: 14 additions & 21 deletions src/vehiclePipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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++){
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8d19425

Please sign in to comment.