mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 16:30:15 +00:00
feat: add frustum culling to quest marker rendering for consistency
Add view-frustum intersection testing to QuestMarkerRenderer::render() using Frustum::intersectsSphere(), bringing quest marker culling in line with the character instance and WMO group frustum culling improvements. Reduces marker visibility testing overhead in scenes with many off-screen quest givers.
This commit is contained in:
parent
2c25e08a25
commit
fe2987dae1
1 changed files with 10 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "rendering/quest_marker_renderer.hpp"
|
||||
#include "rendering/camera.hpp"
|
||||
#include "rendering/frustum.hpp"
|
||||
#include "rendering/vk_context.hpp"
|
||||
#include "rendering/vk_shader.hpp"
|
||||
#include "rendering/vk_pipeline.hpp"
|
||||
|
|
@ -374,6 +375,10 @@ void QuestMarkerRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSe
|
|||
glm::mat4 view = camera.getViewMatrix();
|
||||
glm::vec3 cameraPos = camera.getPosition();
|
||||
|
||||
// Extract frustum planes for visibility testing
|
||||
Frustum frustum;
|
||||
frustum.extractFromMatrix(camera.getViewProjectionMatrix());
|
||||
|
||||
// Get camera right and up vectors for billboarding
|
||||
glm::vec3 cameraRight = glm::vec3(view[0][0], view[1][0], view[2][0]);
|
||||
glm::vec3 cameraUp = glm::vec3(view[0][1], view[1][1], view[2][1]);
|
||||
|
|
@ -398,6 +403,11 @@ void QuestMarkerRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSe
|
|||
glm::vec3 toCamera = cameraPos - marker.position;
|
||||
float distSq = glm::dot(toCamera, toCamera);
|
||||
if (distSq > CULL_DIST_SQ) continue;
|
||||
|
||||
// Frustum cull quest markers (small sphere for icon)
|
||||
constexpr float markerCullRadius = 0.5f;
|
||||
if (!frustum.intersectsSphere(marker.position, markerCullRadius)) continue;
|
||||
|
||||
float dist = std::sqrt(distSq);
|
||||
|
||||
// Calculate fade alpha
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue