diff --git a/src/assets/lcd_screen_effect.cpp b/src/assets/lcd_screen_effect.cpp index 74856631..be25de85 100644 --- a/src/assets/lcd_screen_effect.cpp +++ b/src/assets/lcd_screen_effect.cpp @@ -25,14 +25,14 @@ static void LcdScreenEffect_InternalAddRLCD(CPakFileBuilder* const pak, const Pa rlcd->contrast = JSON_GetNumberRequired(document, "contrast"); // Shutter banding effects. - rlcd->waveScale = JSON_GetNumberRequired(document, "waveScale"); rlcd->waveOffset = JSON_GetNumberRequired(document, "waveOffset"); + rlcd->waveScale = JSON_GetNumberRequired(document, "waveScale"); rlcd->waveSpeed = JSON_GetNumberRequired(document, "waveSpeed"); rlcd->wavePeriod = JSON_GetNumberRequired(document, "wavePeriod"); // Noise effects. rlcd->bloomAdd = JSON_GetNumberRequired(document, "bloomAdd"); - rlcd->reserved = JSON_GetNumberOrDefault(document, "reserved", 0u); + rlcd->doBloomLuminance = JSON_GetValueRequired(document, "doBloomLuminance"); rlcd->pixelFlicker = JSON_GetNumberRequired(document, "pixelFlicker"); asset.InitAsset(hdrLump.GetPointer(), sizeof(LcdScreenEffect_s), PagePtr_t::NullPtr(), RLCD_VERSION, AssetType::RLCD); diff --git a/src/assets/material.cpp b/src/assets/material.cpp index c4546f4c..62e3bd8e 100644 --- a/src/assets/material.cpp +++ b/src/assets/material.cpp @@ -416,6 +416,12 @@ void MaterialAsset_t::FromJSON(const rapidjson::Value& mapEntry) // used for blend materials and the like this->surface2 = JSON_GetValueRequired(mapEntry, "surfaceProp2"); + // Set samplers properly. Responsible for texture stretching, tiling etc. + if (assetVersion == 12) + *(uint32_t*)this->samplers = JSON_GetNumberRequired(mapEntry, "samplers"); + else // 15 uses 8 samplers, which is 64 bits total. + *(uint64_t*)this->samplers = JSON_GetNumberRequired(mapEntry, "samplers"); + // This seems to be set on all materials, i haven't it being used yet in // the engine by hardware breakpointing it. but given that it was // preinitialized in the pak file, and the possible fact that various @@ -423,9 +429,6 @@ void MaterialAsset_t::FromJSON(const rapidjson::Value& mapEntry) // provided by the user. this->features = JSON_GetNumberRequired(mapEntry, "features"); - // Set samplers properly. Responsible for texture stretching, tiling etc. - *(uint32_t*)this->samplers = JSON_GetNumberRequired(mapEntry, "samplers"); - Material_SetDXStates(mapEntry, dxStates); } diff --git a/src/public/lcd_screen_effect.h b/src/public/lcd_screen_effect.h index 051588c2..611b78a1 100644 --- a/src/public/lcd_screen_effect.h +++ b/src/public/lcd_screen_effect.h @@ -7,11 +7,11 @@ struct LcdScreenEffect_s float pixelScaleY; float brightness; float contrast; - float waveScale; float waveOffset; + float waveScale; float waveSpeed; float wavePeriod; float bloomAdd; - uint32_t reserved; // [amos]: always 0 and appears to do nothing in the runtime. + bool doBloomLuminance; float pixelFlicker; }; diff --git a/src/public/material.h b/src/public/material.h index ce577d9a..dee5007a 100644 --- a/src/public/material.h +++ b/src/public/material.h @@ -514,9 +514,7 @@ struct __declspec(align(16)) MaterialAssetHeader_v15_t // array of indices into sampler states array. must be set properly to have accurate texture tiling // used in CShaderGlue::SetupShader (1403B3C60) - char samplers[4];// = 0x1D0300; - - uint32_t unk_7C; + char samplers[8];// = 0x1D0300; // most materials have this set as '0x1F5A92BD', PTCS/PTCU // materials have it set as 0x75C8DF6F typically, and in @@ -568,11 +566,9 @@ struct MaterialAsset_t short height; short depth; - uint32_t unk_7C; + char samplers[8]; uint32_t features; // 0x1F5A92BD, REQUIRED but why? - char samplers[4]; - uint32_t flags; uint32_t flags2; @@ -652,7 +648,6 @@ struct MaterialAsset_t matl->height = this->height; matl->depth = this->depth; - matl->unk_7C = this->unk_7C; matl->features = this->features; memcpy(matl->samplers, this->samplers, sizeof(matl->samplers));