Kelsidavis-WoWee/include/rendering/swim_effects.hpp
Kelsi e12141a673 Add configurable MSAA anti-aliasing, update auth screen and terrain shader
- MSAA: conditional 2-att (off) vs 3-att (on) render pass with auto-resolve
- MSAA: multisampled color+depth images, query max supported sample count
- MSAA: .setMultisample() on all 25+ main-pass pipelines across 17 renderers
- MSAA: recreatePipelines() on every sub-renderer for runtime MSAA changes
- MSAA: Renderer::setMsaaSamples() orchestrates swapchain+pipeline+ImGui rebuild
- MSAA: Anti-Aliasing combo (Off/2x/4x/8x) in Video settings, persisted
- Update auth screen assets and terrain fragment shader
2026-02-22 02:59:24 -08:00

74 lines
2 KiB
C++

#pragma once
#include <vulkan/vulkan.h>
#include <vk_mem_alloc.h>
#include <glm/glm.hpp>
#include <vector>
namespace wowee {
namespace rendering {
class Camera;
class CameraController;
class WaterRenderer;
class VkContext;
class SwimEffects {
public:
SwimEffects();
~SwimEffects();
bool initialize(VkContext* ctx, VkDescriptorSetLayout perFrameLayout);
void shutdown();
void recreatePipelines();
void update(const Camera& camera, const CameraController& cc,
const WaterRenderer& water, float deltaTime);
void render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet);
private:
struct Particle {
glm::vec3 position;
glm::vec3 velocity;
float lifetime;
float maxLifetime;
float size;
float alpha;
};
static constexpr int MAX_RIPPLE_PARTICLES = 200;
static constexpr int MAX_BUBBLE_PARTICLES = 150;
std::vector<Particle> ripples;
std::vector<Particle> bubbles;
// Vulkan objects
VkContext* vkCtx = nullptr;
// Ripple pipeline + dynamic buffer
VkPipeline ripplePipeline = VK_NULL_HANDLE;
VkPipelineLayout ripplePipelineLayout = VK_NULL_HANDLE;
::VkBuffer rippleDynamicVB = VK_NULL_HANDLE;
VmaAllocation rippleDynamicVBAlloc = VK_NULL_HANDLE;
VmaAllocationInfo rippleDynamicVBAllocInfo{};
VkDeviceSize rippleDynamicVBSize = 0;
// Bubble pipeline + dynamic buffer
VkPipeline bubblePipeline = VK_NULL_HANDLE;
VkPipelineLayout bubblePipelineLayout = VK_NULL_HANDLE;
::VkBuffer bubbleDynamicVB = VK_NULL_HANDLE;
VmaAllocation bubbleDynamicVBAlloc = VK_NULL_HANDLE;
VmaAllocationInfo bubbleDynamicVBAllocInfo{};
VkDeviceSize bubbleDynamicVBSize = 0;
std::vector<float> rippleVertexData;
std::vector<float> bubbleVertexData;
float rippleSpawnAccum = 0.0f;
float bubbleSpawnAccum = 0.0f;
void spawnRipple(const glm::vec3& pos, const glm::vec3& moveDir, float waterH);
void spawnBubble(const glm::vec3& pos, float waterH);
};
} // namespace rendering
} // namespace wowee