mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-26 13:47:46 +00:00
Use material's own shader keys if available
Instead of using the shader package default values
This commit is contained in:
parent
2325fdbad0
commit
88e64b859d
3 changed files with 17 additions and 2 deletions
|
@ -219,6 +219,7 @@ void MDLPart::reloadBoneData()
|
|||
RenderMaterial MDLPart::createMaterial(const physis_Material &material)
|
||||
{
|
||||
RenderMaterial newMaterial;
|
||||
newMaterial.mat = material;
|
||||
|
||||
if (material.shpk_name != nullptr) {
|
||||
std::string shpkPath = "shader/sm5/shpk/" + std::string(material.shpk_name);
|
||||
|
|
|
@ -21,6 +21,7 @@ struct RenderTexture {
|
|||
enum class MaterialType { Object, Skin };
|
||||
|
||||
struct RenderMaterial {
|
||||
physis_Material mat;
|
||||
MaterialType type = MaterialType::Object;
|
||||
physis_SHPK shaderPackage;
|
||||
|
||||
|
|
|
@ -224,8 +224,21 @@ void GameRenderer::render(VkCommandBuffer commandBuffer, uint32_t imageIndex, Ca
|
|||
};
|
||||
std::vector<uint32_t> materialKeys;
|
||||
for (int j = 0; j < renderMaterial.shaderPackage.num_material_keys; j++) {
|
||||
auto value = renderMaterial.shaderPackage.material_keys[j].default_value;
|
||||
materialKeys.push_back(renderMaterial.shaderPackage.material_keys[j].default_value);
|
||||
auto id = renderMaterial.shaderPackage.material_keys[j].id;
|
||||
|
||||
bool found = false;
|
||||
for (int z = 0; z < renderMaterial.mat.num_shader_keys; z++) {
|
||||
if (renderMaterial.mat.shader_keys[z].category == id) {
|
||||
materialKeys.push_back(renderMaterial.mat.shader_keys[z].value);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to default if needed
|
||||
if (!found) {
|
||||
auto value = renderMaterial.shaderPackage.material_keys[j].default_value;
|
||||
materialKeys.push_back(renderMaterial.shaderPackage.material_keys[j].default_value);
|
||||
}
|
||||
}
|
||||
std::vector<uint32_t> subviewKeys = {physis_shpk_crc("Default"), physis_shpk_crc("SUB_VIEW_MAIN")};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue