diff options
| author | yum <yum.food.vr@gmail.com> | 2023-01-25 21:55:31 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-01-25 22:40:22 -0800 |
| commit | e5da172a85368551954332836e52d2c98b37edec (patch) | |
| tree | 2a156fb8a2c644d1149efd4fe2c18a43f98a0c49 /GUI | |
| parent | db83b6b1fef7c830bd13c1c9c71ce9ab4c47f215 (diff) | |
Finish basic PBR shading
TaSTT shader now uses physically based rendering (PBR). Users can pick
smoothness, metallic, and emissive.
This implementation borrows heavily from catlikecoding.com's excellent
tutorials, which are released under MIT No Attribution (MIT-0).
https://catlikecoding.com/unity/tutorials/license/
To retain what little clarity remains in the shader, I have chosen not
to attribute the code in the source itself.
Diffstat (limited to 'GUI')
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index cad9395..60437d2 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -179,7 +179,9 @@ bool PythonWrapper::GenerateAnimator( std::string generate_menu_path = "Resources/Scripts/generate_menu.py"; std::string generate_shader_path = "Resources/Scripts/generate_shader.py"; std::string shader_template_path = "Resources/Shaders/TaSTT_template.shader"; + std::string shader_lighting_template_path = "Resources/Shaders/TaSTT_lighting_template.cginc"; std::string shader_path = "Resources/Shaders/TaSTT.shader"; + std::string shader_lighting_path = "Resources/Shaders/TaSTT_lighting.cginc"; // Generated directory locations std::filesystem::path tastt_generated_dir_path = @@ -211,7 +213,7 @@ bool PythonWrapper::GenerateAnimator( tastt_generated_dir_path / unity_animator_generated_name; { - Log(out, "Generating shader for {}x{} board...", config.rows, config.cols); + Log(out, "Generating shader for {}x{} board (pass 0)...", config.rows, config.cols); std::string py_stdout, py_stderr; if (InvokeWithArgs({ generate_shader_path, @@ -238,6 +240,33 @@ bool PythonWrapper::GenerateAnimator( } } { + Log(out, "Generating shader for {}x{} board (pass 1)...", config.rows, config.cols); + + std::string py_stdout, py_stderr; + if (InvokeWithArgs({ generate_shader_path, + "--bytes_per_char", std::to_string(config.bytes_per_char), + "--rows", std::to_string(config.rows), + "--cols", std::to_string(config.cols), + "--shader_template", shader_lighting_template_path, + "--shader_path", shader_lighting_path }, + &py_stdout, &py_stderr)) { + Log(out, "success!\n"); + Log(out, py_stdout.c_str()); + if (!py_stdout.empty()) { + Log(out, "\n"); + } + Log(out, py_stderr.c_str()); + if (!py_stderr.empty()) { + Log(out, "\n"); + } + } + else { + wxLogError("Failed to generate shader: %s", py_stderr.c_str()); + Log(out, "failed!\n"); + return false; + } + } + { Log(out, "Creating {}\n", tastt_generated_dir_path.string()); std::filesystem::create_directories(tastt_generated_dir_path); } |
