mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add ambient insect particles near water vegetation, fix firefly particles, and improve water foam
- Spawn dark point-sprite insects buzzing around cattails/reeds/kelp/seaweed - Fix firefly M2 particles: exempt from alpha dampening and forced gravity - Make water shoreline/crest foam more irregular with UV warping and bluer tint
This commit is contained in:
parent
c35b40391f
commit
4db97e37b7
9 changed files with 332 additions and 20 deletions
|
|
@ -76,6 +76,8 @@ struct M2ModelGPU {
|
|||
bool isSmallFoliage = false; // Small foliage (bushes, grass, plants) - skip during taxi
|
||||
bool isInvisibleTrap = false; // Invisible trap objects (don't render, no collision)
|
||||
bool isGroundDetail = false; // Ground clutter/detail doodads (special fallback render path)
|
||||
bool isWaterVegetation = false; // Cattails, reeds, kelp etc. near water (insect spawning)
|
||||
bool isFireflyEffect = false; // Firefly/fireflies M2 (exempt from particle dampeners)
|
||||
|
||||
// Collision mesh with spatial grid (from M2 bounding geometry)
|
||||
struct CollisionMesh {
|
||||
|
|
@ -307,6 +309,8 @@ public:
|
|||
void setInsideInterior(bool inside) { insideInterior = inside; }
|
||||
void setOnTaxi(bool onTaxi) { onTaxi_ = onTaxi; }
|
||||
|
||||
std::vector<glm::vec3> getWaterVegetationPositions(const glm::vec3& camPos, float maxDist) const;
|
||||
|
||||
private:
|
||||
bool initialized_ = false;
|
||||
bool insideInterior = false;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace rendering {
|
|||
class Camera;
|
||||
class CameraController;
|
||||
class WaterRenderer;
|
||||
class M2Renderer;
|
||||
class VkContext;
|
||||
|
||||
class SwimEffects {
|
||||
|
|
@ -25,6 +26,7 @@ public:
|
|||
const WaterRenderer& water, float deltaTime);
|
||||
void render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet);
|
||||
void spawnFootSplash(const glm::vec3& footPos, float waterH);
|
||||
void setM2Renderer(M2Renderer* renderer) { m2Renderer = renderer; }
|
||||
|
||||
private:
|
||||
struct Particle {
|
||||
|
|
@ -36,14 +38,30 @@ private:
|
|||
float alpha;
|
||||
};
|
||||
|
||||
struct InsectParticle {
|
||||
glm::vec3 position;
|
||||
glm::vec3 orbitCenter; // vegetation position to orbit around
|
||||
float lifetime;
|
||||
float maxLifetime;
|
||||
float size;
|
||||
float alpha;
|
||||
float phase; // random phase offset for erratic motion
|
||||
float orbitRadius;
|
||||
float orbitSpeed;
|
||||
float heightOffset; // height above plant
|
||||
};
|
||||
|
||||
static constexpr int MAX_RIPPLE_PARTICLES = 200;
|
||||
static constexpr int MAX_BUBBLE_PARTICLES = 150;
|
||||
static constexpr int MAX_INSECT_PARTICLES = 50;
|
||||
|
||||
std::vector<Particle> ripples;
|
||||
std::vector<Particle> bubbles;
|
||||
std::vector<InsectParticle> insects;
|
||||
|
||||
// Vulkan objects
|
||||
VkContext* vkCtx = nullptr;
|
||||
M2Renderer* m2Renderer = nullptr;
|
||||
|
||||
// Ripple pipeline + dynamic buffer
|
||||
VkPipeline ripplePipeline = VK_NULL_HANDLE;
|
||||
|
|
@ -61,14 +79,25 @@ private:
|
|||
VmaAllocationInfo bubbleDynamicVBAllocInfo{};
|
||||
VkDeviceSize bubbleDynamicVBSize = 0;
|
||||
|
||||
// Insect pipeline + dynamic buffer
|
||||
VkPipeline insectPipeline = VK_NULL_HANDLE;
|
||||
VkPipelineLayout insectPipelineLayout = VK_NULL_HANDLE;
|
||||
::VkBuffer insectDynamicVB = VK_NULL_HANDLE;
|
||||
VmaAllocation insectDynamicVBAlloc = VK_NULL_HANDLE;
|
||||
VmaAllocationInfo insectDynamicVBAllocInfo{};
|
||||
VkDeviceSize insectDynamicVBSize = 0;
|
||||
|
||||
std::vector<float> rippleVertexData;
|
||||
std::vector<float> bubbleVertexData;
|
||||
std::vector<float> insectVertexData;
|
||||
|
||||
float rippleSpawnAccum = 0.0f;
|
||||
float bubbleSpawnAccum = 0.0f;
|
||||
float insectSpawnAccum = 0.0f;
|
||||
|
||||
void spawnRipple(const glm::vec3& pos, const glm::vec3& moveDir, float waterH);
|
||||
void spawnBubble(const glm::vec3& pos, float waterH);
|
||||
void spawnInsect(const glm::vec3& vegPos);
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue