Skip to content

Commit

Permalink
Moved some checks to vanilla parallax only
Browse files Browse the repository at this point in the history
  • Loading branch information
hakasapl committed Jul 23, 2024
1 parent 7597616 commit c07fd53
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog

## [0.4.5] - UNRELEASED
## [0.4.5] - 2024-07-23

- Shaders are no longer pre-compiled, they are compiled at runtime
- Skinned meshes are only checked for vanilla parallax now
- Havok animations are only checked for vanilla parallax now

## [0.4.4] - 2024-07-23

Expand Down
38 changes: 22 additions & 16 deletions src/ParallaxGen/ParallaxGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ void ParallaxGen::processNIF(const fs::path& nif_file, vector<fs::path>& heightM
bool nif_modified = false;

// ignore nif if has attached havok animations
bool has_attached_havok = false;
vector<NiObject*> block_tree;
nif.GetTree(block_tree);

// loop through blocks
for (NiObject* block : block_tree) {
if (block->GetBlockName() == "BSBehaviorGraphExtraData") {
spdlog::trace(L"Rejecting NIF file {} due to attached havok animations", nif_file.wstring());
return;
has_attached_havok = true;
}
}

Expand All @@ -240,12 +240,6 @@ void ParallaxGen::processNIF(const fs::path& nif_file, vector<fs::path>& heightM
continue;
}

// ignore skinned meshes, these don't support parallax
if (shape->HasSkinInstance() || shape->IsSkinned()) {
spdlog::trace(L"Rejecting shape {} in NIF file {}: Skinned mesh", block_id, nif_file.wstring());
continue;
}

// get shader from shape
NiShader* shader = nif.GetShader(shape);
if (shader == nullptr) {
Expand Down Expand Up @@ -318,6 +312,25 @@ void ParallaxGen::processNIF(const fs::path& nif_file, vector<fs::path>& heightM
// processing for parallax
search_path = search_prefix + "_p.dds";
if (!ignore_parallax && pgd->isHeightMap(search_path)) {
// Check if nif has attached havok (results in crashes for vanilla parallax)
if (has_attached_havok) {
spdlog::trace(L"Rejecting NIF file {} due to attached havok animations", nif_file.wstring());
return;
}

// ignore skinned meshes, these don't support parallax
if (shape->HasSkinInstance() || shape->IsSkinned()) {
spdlog::trace(L"Rejecting shape {} in NIF file {}: Skinned mesh", block_id, nif_file.wstring());
continue;
}

// Enable regular parallax for this shape!
if (shader_type != BSLSP::BSLSP_DEFAULT && shader_type != BSLSP::BSLSP_PARALLAX) {
// don't overwrite existing shaders
spdlog::trace(L"Rejecting shape {} in NIF file {}: Incorrect shader type", block_id, nif_file.wstring());
continue;
}

BSLightingShaderProperty* cur_bslsp = dynamic_cast<BSLightingShaderProperty*>(shader);

// decals don't work with regular parallax
Expand All @@ -332,14 +345,7 @@ void ParallaxGen::processNIF(const fs::path& nif_file, vector<fs::path>& heightM
continue;
}

// Enable regular parallax for this shape!
if (shader_type != BSLSP::BSLSP_DEFAULT && shader_type != BSLSP::BSLSP_PARALLAX) {
// don't overwrite existing shaders
spdlog::trace(L"Rejecting shape {} in NIF file {}: Incorrect shader type", block_id, nif_file.wstring());
continue;
}

// verify that maps match each other
// verify that maps match each other (this is somewhat expense so it happens last)
if (!hasSameAspectRatio(diffuse_map, search_path)) {
spdlog::trace(L"Rejecting shape {} in NIF file {}: Height map does not match diffuse map", block_id, nif_file.wstring());
continue;
Expand Down

0 comments on commit c07fd53

Please sign in to comment.