mitiru::effects

Namespace catalog extracted from docs/API_CATALOG.md (12 types, 91 items).

Namespace catalog extracted from docs/API_CATALOG.md (12 types, 91 items).

NameKindItems
Bloomclass4
CameraEffectsclass11
Dissolveclass8
GpuParticleBaseclass12
GpuParticleDx11class7
GpuParticleDx12class5
EmissionShapeenum4
EmissionBurststruct3
CurveKeystruct2
ParameterCurvestruct3
ParticleEmitterstruct22
ScreenShakeclass10
class Bloom 4
float threshold = 0.8f
float intensity = 1.0f
int blurPasses = 3
void apply(std::vector<uint8_t>& pixels, int width, int height) const
class CameraEffects 11
void setTarget(const sgc::Vec2f& target) noexcept
void setSmoothSpeed(float speed) noexcept
void zoomTo(float targetZoom, float duration = 0.5f)
void setBounds(float minX, float minY, float maxX, float maxY) noexcept
void clearBounds() noexcept
void update(float dt)
[[nodiscard]] sgc::Vec2f offset() const noexcept
[[nodiscard]] float zoom() const noexcept
[[nodiscard]] bool isZooming() const noexcept
void setPosition(const sgc::Vec2f& pos) noexcept
void setZoom(float z) noexcept
class Dissolve 8
void start(float duration = 1.0f)
void update(float dt)
[[nodiscard]] bool isComplete() const noexcept
[[nodiscard]] bool isActive() const noexcept
[[nodiscard]] float threshold() const noexcept
[[nodiscard]] static float pixelNoise(int x, int y) noexcept
[[nodiscard]] bool isPixelVisible(int x, int y) const noexcept
void reset() noexcept
class GpuParticleBase : public IGpuParticleSystem 12
void setEmitter(const ParticleEmitter& emitter) override
[[nodiscard]] const ParticleEmitter& emitter() const noexcept override
void emit(const sgc::Vec3f& position, const sgc::Vec3f& velocity, float lifetime, const sgc::Colorf& color, float size) override
void emitFromEmitter(float dt) override
void burst(std::uint32_t count) override
[[nodiscard]] std::uint32_t activeCount() const noexcept override
[[nodiscard]] std::uint32_t maxCount() const noexcept override
void clear() override
[[nodiscard]] bool isValid() const noexcept override
static constexpr std::string_view PARTICLE_COMPUTE_HLSL = R"( struct Particle { float3 position; float3 velocity; float3 acceleration; float4 color; float size; float lifetime; float age; }; cbuffer SimConstants : register(b0) { float deltaTime; float3 gravity; float drag; uint maxParticles; uint activeParticles; float padding; }; StructuredBuffer<Particle> particlesIn : register(t0); RWStructuredBuffer<Particle> particlesOut : register(u0); [numthreads(256, 1, 1)] void CSMain(uint3 dtid : SV_DispatchThreadID) { uint idx = dtid.x; if (idx >= activeParticles) { return; } Particle p = particlesIn[idx]; // 寿命チェック p.age += deltaTime; if (p.age >= p.lifetime) { // 死亡パーティクルはサイズ0にして無効化 p.size = 0; p.color.a = 0; particlesOut[idx] = p; return; } // 物理シミュレーション float3 accel = gravity + p.acceleration; p.velocity += accel * deltaTime; p.velocity *= (1.0 - drag * deltaTime); p.position += p.velocity * deltaTime; // ライフタイム比率に基づくフェード float normalizedAge = p.age / p.lifetime; p.color.a *= (1.0 - normalizedAge * normalizedAge); particlesOut[idx] = p; } )"
static constexpr std::string_view PARTICLE_VS_HLSL = R"( struct Particle { float3 position; float3 velocity; float3 acceleration; float4 color; float size; float lifetime; float age; }; cbuffer RenderConstants : register(b0) { float4x4 viewProjection; float3 cameraRight; float pad0; float3 cameraUp; float pad1; }; StructuredBuffer<Particle> particles : register(t0); struct VSOutput { float4 position : SV_Position; float4 color : COLOR; float2 texCoord : TEXCOORD; }; VSOutput VSMain(uint vertexId : SV_VertexID, uint instanceId : SV_InstanceID) { VSOutput output; Particle p = particles[instanceId]; // クアッド頂点(三角形ストリップ順) // 0: (-1,-1), 1: (1,-1), 2: (-1,1), 3: (1,1) // 三角形リスト: 0,2,1, 1,2,3 static const float2 quadVerts[6] = { float2(-1, -1), float2(-1, 1), float2(1, -1), float2(1, -1), float2(-1, 1), float2(1, 1) }; float2 corner = quadVerts[vertexId]; float halfSize = p.size * 0.5; // ビルボード展開 float3 worldPos = p.position + cameraRight * corner.x * halfSize + cameraUp * corner.y * halfSize; output.position = mul(viewProjection, float4(worldPos, 1.0)); output.color = p.color; output.texCoord = corner * 0.5 + 0.5; return output; } )"
static constexpr std::string_view PARTICLE_PS_HLSL = R"( struct PSInput { float4 position : SV_Position; float4 color : COLOR; float2 texCoord : TEXCOORD; }; float4 PSMain(PSInput input) : SV_Target { // 円形マスク(ソフトエッジ) float2 center = input.texCoord - 0.5; float dist = length(center) * 2.0; float alpha = saturate(1.0 - dist * dist); float4 color = input.color; color.a *= alpha; // アルファが極小のフラグメントを破棄する if (color.a < 0.001) { discard; } return color; } )"
class GpuParticleDx11 : public GpuParticleBase 7
template <typename T> using ComPtr = Microsoft::WRL::ComPtr<T>
explicit GpuParticleDx11(ID3D11Device* device, ID3D11DeviceContext* context, std::uint32_t maxParticles = MAX_GPU_PARTICLES)
void update(float dt) override
void render(const mitiru::render::Camera3D& camera) override
static constexpr std::string_view DX12_PARTICLE_COMPUTE_HLSL = R"( struct Particle { float3 position; float3 velocity; float3 acceleration; float4 color; float size; float lifetime; float age; }; struct DrawArgs { uint vertexCountPerInstance; uint instanceCount; uint startVertexLocation; uint startInstanceLocation; }; cbuffer SimConstants : register(b0) { float deltaTime; float3 gravity; float drag; uint maxParticles; uint activeParticles; float padding; }; StructuredBuffer<Particle> particlesIn : register(t0); RWStructuredBuffer<Particle> particlesOut : register(u0); RWStructuredBuffer<DrawArgs> drawArgs : register(u1); [numthreads(256, 1, 1)] void CSMain(uint3 dtid : SV_DispatchThreadID) { // 最初のスレッドがドローアーギュメントを初期化する if (dtid.x == 0) { DrawArgs args; args.vertexCountPerInstance = 6; args.instanceCount = 0; args.startVertexLocation = 0; args.startInstanceLocation = 0; drawArgs[0] = args; } GroupMemoryBarrierWithGroupSync(); uint idx = dtid.x; if (idx >= activeParticles) { return; } Particle p = particlesIn[idx]; // 寿命チェック p.age += deltaTime; if (p.age >= p.lifetime) { p.size = 0; p.color.a = 0; particlesOut[idx] = p; return; } // 物理シミュレーション float3 accel = gravity + p.acceleration; p.velocity += accel * deltaTime; p.velocity *= (1.0 - drag * deltaTime); p.position += p.velocity * deltaTime; // ライフタイム比率に基づくフェード float normalizedAge = p.age / p.lifetime; p.color.a *= (1.0 - normalizedAge * normalizedAge); particlesOut[idx] = p; // 生存パーティクルのインスタンスカウントをインクリメントする if (p.size > 0 && p.color.a > 0.001) { uint dummy; InterlockedAdd(drawArgs[0].instanceCount, 1, dummy); } } )"
static constexpr std::string_view DX12_PARTICLE_VS_HLSL = R"( struct Particle { float3 position; float3 velocity; float3 acceleration; float4 color; float size; float lifetime; float age; }; cbuffer RenderConstants : register(b0) { float4x4 viewProjection; float3 cameraRight; float pad0; float3 cameraUp; float pad1; }; StructuredBuffer<Particle> particles : register(t0); struct VSOutput { float4 position : SV_Position; float4 color : COLOR; float2 texCoord : TEXCOORD; }; VSOutput VSMain(uint vertexId : SV_VertexID, uint instanceId : SV_InstanceID) { VSOutput output; Particle p = particles[instanceId]; static const float2 quadVerts[6] = { float2(-1, -1), float2(-1, 1), float2(1, -1), float2(1, -1), float2(-1, 1), float2(1, 1) }; float2 corner = quadVerts[vertexId]; float halfSize = p.size * 0.5; float3 worldPos = p.position + cameraRight * corner.x * halfSize + cameraUp * corner.y * halfSize; output.position = mul(viewProjection, float4(worldPos, 1.0)); output.color = p.color; output.texCoord = corner * 0.5 + 0.5; return output; } )"
static constexpr std::string_view DX12_PARTICLE_PS_HLSL = R"( struct PSInput { float4 position : SV_Position; float4 color : COLOR; float2 texCoord : TEXCOORD; }; float4 PSMain(PSInput input) : SV_Target { float2 center = input.texCoord - 0.5; float dist = length(center) * 2.0; float alpha = saturate(1.0 - dist * dist); float4 color = input.color; color.a *= alpha; if (color.a < 0.001) { discard; } return color; } )"
class GpuParticleDx12 : public GpuParticleBase 5
template <typename T> using ComPtr = Microsoft::WRL::ComPtr<T>
explicit GpuParticleDx12(ID3D12Device* device, ID3D12CommandQueue* commandQueue, std::uint32_t maxParticles = MAX_GPU_PARTICLES)
~GpuParticleDx12() override
void update(float dt) override
void render(const mitiru::render::Camera3D& camera) override
enum EmissionShape : std::uint8_t 4
Point
Sphere
Cone
Box
struct EmissionBurst 3
float time = 0.0f
std::uint32_t count = 10
float repeatInterval = 0
struct CurveKey 2
float t = 0.0f
float value = 1.0f
struct ParameterCurve 3
std::uint32_t keyCount = 0
void addKey(float t, float value) noexcept
[[nodiscard]] float evaluate(float t) const noexcept
struct ParticleEmitter 22
EmissionShape shape = EmissionShape::Point
float sphereRadius = 1.0f
float coneAngle = 0.523599f
float coneRadius = 0.0f
float ratePerSecond = 100.0f
std::uint32_t burstCount = 0
float initialSpeed = 5.0f
float initialSpeedVariance = 1.0f
float lifetime = 2.0f
float lifetimeVariance = 0.5f
float initialSize = 0.1f
float initialSizeVariance = 0.02f
float drag = 0.1f
ParameterCurve sizeOverLifetime
ParameterCurve alphaOverLifetime
void addBurst(float time, std::uint32_t count, float interval = 0) noexcept
template <typename Rng> [[nodiscard]] sgc::Vec3f samplePosition(Rng& rng) const noexcept
template <typename Rng> [[nodiscard]] sgc::Vec3f sampleVelocity(Rng& rng, const sgc::Vec3f& emitPos) const noexcept
template <typename Rng> [[nodiscard]] float sampleLifetime(Rng& rng) const noexcept
template <typename Rng> [[nodiscard]] float sampleSize(Rng& rng) const noexcept
[[nodiscard]] sgc::Colorf evaluateColor(float normalizedAge) const noexcept
[[nodiscard]] float evaluateSize(float normalizedAge) const noexcept
class ScreenShake 10
float trauma = 0.0f
float traumaDecay = 2.0f
float maxOffset = 20.0f
float maxRotation = 0.05f
void addTrauma(float amount)
void update(float dt)
[[nodiscard]] sgc::Vec2f offset() const noexcept
[[nodiscard]] float rotation() const noexcept
[[nodiscard]] float intensity() const noexcept
void reset() noexcept

Sourced from docs/API_CATALOG.md, auto-generated by tools/generate_api_catalog.py.