Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/assets/lcd_screen_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ static void LcdScreenEffect_InternalAddRLCD(CPakFileBuilder* const pak, const Pa
rlcd->contrast = JSON_GetNumberRequired<float>(document, "contrast");

// Shutter banding effects.
rlcd->waveScale = JSON_GetNumberRequired<float>(document, "waveScale");
rlcd->waveOffset = JSON_GetNumberRequired<float>(document, "waveOffset");
rlcd->waveScale = JSON_GetNumberRequired<float>(document, "waveScale");
rlcd->waveSpeed = JSON_GetNumberRequired<float>(document, "waveSpeed");
rlcd->wavePeriod = JSON_GetNumberRequired<float>(document, "wavePeriod");

// Noise effects.
rlcd->bloomAdd = JSON_GetNumberRequired<float>(document, "bloomAdd");
rlcd->reserved = JSON_GetNumberOrDefault(document, "reserved", 0u);
rlcd->doBloomLuminance = JSON_GetValueRequired<bool>(document, "doBloomLuminance");
rlcd->pixelFlicker = JSON_GetNumberRequired<float>(document, "pixelFlicker");

asset.InitAsset(hdrLump.GetPointer(), sizeof(LcdScreenEffect_s), PagePtr_t::NullPtr(), RLCD_VERSION, AssetType::RLCD);
Expand Down
9 changes: 6 additions & 3 deletions src/assets/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,19 @@ void MaterialAsset_t::FromJSON(const rapidjson::Value& mapEntry)
// used for blend materials and the like
this->surface2 = JSON_GetValueRequired<const char*>(mapEntry, "surfaceProp2");

// Set samplers properly. Responsible for texture stretching, tiling etc.
if (assetVersion == 12)
*(uint32_t*)this->samplers = JSON_GetNumberRequired<uint32_t>(mapEntry, "samplers");
else // 15 uses 8 samplers, which is 64 bits total.
*(uint64_t*)this->samplers = JSON_GetNumberRequired<uint64_t>(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
// other flags might dictate when and if this gets used, it must be
// provided by the user.
this->features = JSON_GetNumberRequired<uint32_t>(mapEntry, "features");

// Set samplers properly. Responsible for texture stretching, tiling etc.
*(uint32_t*)this->samplers = JSON_GetNumberRequired<uint32_t>(mapEntry, "samplers");

Material_SetDXStates(mapEntry, dxStates);
}

Expand Down
4 changes: 2 additions & 2 deletions src/public/lcd_screen_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
9 changes: 2 additions & 7 deletions src/public/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand Down