Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.0 Test 1 (WIP) #162

Merged
merged 9 commits into from
Dec 21, 2024
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
## [0.8.0] - UNRELEASED

- Added pgtools.exe modding tools
- Added pgtools patcher to convert particle lights to light placer lights
- Parallax maps included in the pbr subdirectory will be considered a different "height pbr" texture type
- Closing mod sort dialog will now close the whole app
- BSMeshLODTriShapes will also be patched now
- Existing TXST records will no longer be patched, only new ones will be created
- Added support for PBR fuzz
- Added support for PBR hair
- Removed simplicity of snow warning as the mod is not inherently incompatible

## [0.7.3] - 2024-12-09
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
set(PROJECT_NAME "ParallaxGen")

# Initialize Project
set(PARALLAXGEN_VERSION 0.7.3)
set(PARALLAXGEN_VERSION 0.8.0)
project(${PROJECT_NAME} VERSION ${PARALLAXGEN_VERSION})
add_compile_definitions(PARALLAXGEN_VERSION="${PARALLAXGEN_VERSION}")

# Set test version (set this to 0 for prod releases)
add_compile_definitions(PARALLAXGEN_TEST_VERSION=0)
add_compile_definitions(PARALLAXGEN_TEST_VERSION=1)

# Setup Folders
set(EXTRN_BUILD_DIR ${CMAKE_BINARY_DIR}/external/blds)
Expand Down
9 changes: 9 additions & 0 deletions PGTools/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "patchers/PatcherTruePBR.hpp"
#include "patchers/PatcherUpgradeParallaxToCM.hpp"
#include "patchers/PatcherVanillaParallax.hpp"
#include "patchers/PatcherParticleLightsToLP.hpp"

using namespace std;

Expand Down Expand Up @@ -136,9 +137,17 @@ void mainRunner(PGToolsCLIArgs &Args) {
Patchers.ShaderTransformPatchers[PatcherUpgradeParallaxToCM::getFromShader()].emplace(
PatcherUpgradeParallaxToCM::getToShader(), PatcherUpgradeParallaxToCM::getFactory());
}
if (Args.Patch.Patchers.contains("particlelightstolp")) {
Patchers.GlobalPatchers.emplace_back(PatcherParticleLightsToLP::getFactory());
}

PG.patchMeshes(Patchers, nullptr, Args.Multithreading, false);

// Finalize step
if (Args.Patch.Patchers.contains("particlelightstolp")) {
PatcherParticleLightsToLP::finalize();
}

// Release cached files, if any
PGD.clearCache();

Expand Down
9 changes: 9 additions & 0 deletions ParallaxGen/include/GUI/ModSortDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ModSortDialog : public wxDialog {
bool SortAscending; /** Stores whether the list is in asc or desc order */

public:
static inline bool UIExitTriggered = false;

/**
* @brief Construct a new Mod Sort Dialog object
*
Expand Down Expand Up @@ -103,6 +105,13 @@ class ModSortDialog : public wxDialog {
*/
void onTimer(wxTimerEvent &Event);

/**
* @brief Resets indices for the list after drag or sort
*
* @param Event wxWidgets event object
*/
void onClose(wxCloseEvent &Event);

/**
* @brief Get the Header Height for positioning
*
Expand Down
7 changes: 7 additions & 0 deletions ParallaxGen/src/GUI/ModSortDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ModSortDialog::ModSortDialog(const std::vector<std::wstring> &Mods, const std::v
// Add OK button
auto *OkButton = new wxButton(this, wxID_OK, "OK");
MainSizer->Add(OkButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
Bind(wxEVT_CLOSE_WINDOW, &ModSortDialog::onClose, this);

SetSizer(MainSizer);

Expand Down Expand Up @@ -373,3 +374,9 @@ auto ModSortDialog::getSortedItems() const -> std::vector<std::wstring> {

return SortedItems;
}

void ModSortDialog::onClose( // NOLINT(readability-convert-member-functions-to-static)
[[maybe_unused]] wxCloseEvent &Event) {
UIExitTriggered = true;
wxTheApp->Exit();
}
3 changes: 2 additions & 1 deletion ParallaxGen/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "BethesdaGame.hpp"
#include "GUI/LauncherWindow.hpp"
#include "GUI/ModSortDialog.hpp"
#include "ModManagerDirectory.hpp"
#include "NIFUtil.hpp"
#include "ParallaxGen.hpp"
Expand Down Expand Up @@ -326,7 +327,7 @@ void mainRunner(ParallaxGenCLIArgs &Args, const filesystem::path &ExePath) {
}

void exitBlocking() {
if (LauncherWindow::UIExitTriggered) {
if (LauncherWindow::UIExitTriggered || ModSortDialog::UIExitTriggered) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions ParallaxGenLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ set(HEADERS
"include/patchers/PatcherUpgradeParallaxToCM.hpp"
"include/patchers/Patcher.hpp"
"include/patchers/PatcherUtil.hpp"
"include/patchers/PatcherGlobal.hpp"
"include/patchers/PatcherParticleLightsToLP.hpp"
)

set(SOURCES
Expand All @@ -43,6 +45,8 @@ set(SOURCES
"src/patchers/PatcherUpgradeParallaxToCM.cpp"
"src/patchers/Patcher.cpp"
"src/patchers/PatcherUtil.cpp"
"src/patchers/PatcherGlobal.cpp"
"src/patchers/PatcherParticleLightsToLP.cpp"
)

include_directories("include")
Expand Down
2 changes: 2 additions & 0 deletions ParallaxGenLib/include/NIFUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ enum class TextureType {
SKINTINT,
SUBSURFACECOLOR,
HEIGHT,
HEIGHTPBR,
CUBEMAP,
ENVIRONMENTMASK,
COMPLEXMATERIAL,
RMAOS,
SUBSURFACETINT,
INNERLAYER,
FUZZPBR,
COATNORMALROUGHNESS,
BACKLIGHT,
SPECULAR,
Expand Down
36 changes: 36 additions & 0 deletions ParallaxGenLib/include/patchers/PatcherGlobal.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include <Geometry.hpp>
#include <NifFile.hpp>

#include "patchers/Patcher.hpp"

/**
* @class PrePatcher
* @brief Base class for prepatchers
*/
class PatcherGlobal : public Patcher {
public:
// type definitions
using PatcherGlobalFactory = std::function<std::unique_ptr<PatcherGlobal>(std::filesystem::path, nifly::NifFile *)>;
using PatcherGlobalObject = std::unique_ptr<PatcherGlobal>;

// Constructors
PatcherGlobal(std::filesystem::path NIFPath, nifly::NifFile *NIF, std::string PatcherName);
virtual ~PatcherGlobal() = default;
PatcherGlobal(const PatcherGlobal &Other) = default;
auto operator=(const PatcherGlobal &Other) -> PatcherGlobal & = default;
PatcherGlobal(PatcherGlobal &&Other) noexcept = default;
auto operator=(PatcherGlobal &&Other) noexcept -> PatcherGlobal & = default;

/**
* @brief Apply the patch to the NIFShape if able
*
* @param NIFShape Shape to apply patch to
* @param NIFModified Whether the NIF was modified
* @param ShapeDeleted Whether the shape was deleted
* @return true Patch was applied
* @return false Patch was not applied
*/
virtual auto applyPatch(bool &NIFModified) -> bool = 0;
};
71 changes: 71 additions & 0 deletions ParallaxGenLib/include/patchers/PatcherParticleLightsToLP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pragma once

#include <Animation.hpp>
#include <BasicTypes.hpp>
#include <Geometry.hpp>
#include <Nodes.hpp>
#include <mutex>

#include "patchers/PatcherGlobal.hpp"
#include <Shaders.hpp>

/**
* @class PrePatcherParticleLightsToLP
* @brief patcher to transform particle lights to LP
*/
class PatcherParticleLightsToLP : public PatcherGlobal {
private:
static nlohmann::json LPJsonData; /** < LP JSON data */
static std::mutex LPJsonDataMutex; /** < Mutex for LP JSON data */

public:
/**
* @brief Get the Factory object
*
* @return PatcherShaderTransform::PatcherShaderTransformFactory
*/
static auto getFactory() -> PatcherGlobal::PatcherGlobalFactory;

/**
* @brief Construct a new PrePatcher Particle Lights To LP patcher
*
* @param NIFPath NIF path to be patched
* @param NIF NIF object to be patched
*/
PatcherParticleLightsToLP(std::filesystem::path NIFPath, nifly::NifFile *NIF);

/**
* @brief Apply this patcher to shape
*
* @param NIFShape Shape to patch
* @param NIFModified Whether NIF was modified
* @param ShapeDeleted Whether shape was deleted
* @return true Shape was patched
* @return false Shape was not patched
*/
auto applyPatch(bool &NIFModified) -> bool override;

/**
* @brief Save output JSON
*/
static void finalize();

private:
/**
* @brief Apply patch to single particle light in mesh
*
* @param NiAlphaProperty Alpha property to patch
* @return true patch was applied
* @return false patch was not applied
*/
auto applySinglePatch(nifly::NiBillboardNode *Node, nifly::NiShape *Shape, nifly::BSEffectShaderProperty *EffectShader) -> bool;

/**
* @brief Get LP JSON for a specific NIF controller
*
* @param Controller Controller to get JSON for
* @param JSONField JSON field to store controller JSON in LP
* @return nlohmann::json JSON for controller
*/
auto getControllerJSON(nifly::NiTimeController *Controller, std::string &JSONField) -> nlohmann::json;
};
3 changes: 3 additions & 0 deletions ParallaxGenLib/include/patchers/PatcherUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <unordered_map>

#include "patchers/PatcherGlobal.hpp"
#include "patchers/PatcherShader.hpp"
#include "patchers/PatcherShaderTransform.hpp"

Expand All @@ -18,6 +19,7 @@ class PatcherUtil {
* @brief Stores the patcher objects for a given run
*/
struct PatcherObjectSet {
std::vector<PatcherGlobal::PatcherGlobalObject> GlobalPatchers;
std::unordered_map<NIFUtil::ShapeShader, PatcherShader::PatcherShaderObject> ShaderPatchers;
std::unordered_map<NIFUtil::ShapeShader,
std::map<NIFUtil::ShapeShader, PatcherShaderTransform::PatcherShaderTransformObject>>
Expand All @@ -29,6 +31,7 @@ class PatcherUtil {
* @brief Stores the patcher factories for a given run
*/
struct PatcherSet {
std::vector<PatcherGlobal::PatcherGlobalFactory> GlobalPatchers;
std::unordered_map<NIFUtil::ShapeShader, PatcherShader::PatcherShaderFactory> ShaderPatchers;
std::unordered_map<NIFUtil::ShapeShader,
std::map<NIFUtil::ShapeShader, PatcherShaderTransform::PatcherShaderTransformFactory>>
Expand Down
Loading
Loading