Skip to content

Commit

Permalink
Don't hardcode scene keys anymore
Browse files Browse the repository at this point in the history
This allows us to properly support a wider variety of shader packages
and also don't have to worry about Dawntrail specifically for now.
  • Loading branch information
redstrate committed Nov 3, 2024
1 parent 8632786 commit 0d593ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion extern/libphysis
Submodule libphysis updated 2 files
+1 −1 Cargo.lock
+19 −0 src/shpk.rs
35 changes: 14 additions & 21 deletions renderer/src/gamerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,32 +327,25 @@ void GameRenderer::render(VkCommandBuffer commandBuffer, Camera &camera, Scene &
if (renderMaterial.type == MaterialType::Skin && !m_dawntrailMode) {
systemKeys.push_back(physis_shpk_crc("DecodeDepthBuffer_RAWZ"));
}

std::vector<uint32_t> sceneKeys;
if (m_dawntrailMode) {
sceneKeys.push_back(physis_shpk_crc("ApplyDitherClipOff"));
sceneKeys.push_back(physis_shpk_crc("ApplyDissolveColorOff"));
sceneKeys.push_back(physis_shpk_crc("GetCustumizeColorAuraOff"));
for (int j = 0; j < renderMaterial.shaderPackage.num_scene_keys; j++) {
auto id = renderMaterial.shaderPackage.scene_keys[j].id;

if (model.skinned) {
sceneKeys.push_back(physis_shpk_crc("TransformViewSkin"));
} else {
sceneKeys.push_back(physis_shpk_crc("TransformViewRigid"));
bool found = false;
if (id == physis_shpk_crc("TransformView")) {
if (model.skinned) {
sceneKeys.push_back(physis_shpk_crc("TransformViewSkin"));
} else {
sceneKeys.push_back(physis_shpk_crc("TransformViewRigid"));
}
found = true;
}

sceneKeys.push_back(physis_shpk_crc("ApplyVertexMovementOff"));
sceneKeys.push_back(physis_shpk_crc("CalculateInstancingPosition_Off"));

} else {
if (model.skinned) {
sceneKeys.push_back(physis_shpk_crc("TransformViewSkin"));
} else {
sceneKeys.push_back(physis_shpk_crc("TransformViewRigid"));
// Fall back to default if needed
if (!found) {
sceneKeys.push_back(renderMaterial.shaderPackage.scene_keys[j].default_value);
}

sceneKeys.push_back(physis_shpk_crc("GetAmbientLight_SH"));
sceneKeys.push_back(physis_shpk_crc("GetReflectColor_Texture"));
sceneKeys.push_back(physis_shpk_crc("GetAmbientOcclusion_None"));
sceneKeys.push_back(physis_shpk_crc("ApplyDitherClipOff"));
}

std::vector<uint32_t> materialKeys;
Expand Down

0 comments on commit 0d593ba

Please sign in to comment.