Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EmitShape and RenderShape type/member name overlap and missing cstdint include #1007

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dev/Cpp/EditorCommon/IO/FileReader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <cstdint>
#include <string>
#include <vector>

Expand Down Expand Up @@ -39,4 +40,4 @@ class StaticFileReader

#endif

} // namespace Effekseer
} // namespace Effekseer
14 changes: 7 additions & 7 deletions Dev/Cpp/Effekseer/Effekseer/Parameter/GpuParticlesParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ GpuParticles::ParamSet LoadGpuParticlesParameter(uint8_t*& pos, int32_t version)
paramSet.Basic.EmitOffset = Read<float>(pos);
paramSet.Basic.LifeTime = Read<std::array<float, 2>>(pos);

paramSet.EmitShape.Type = (EmitShape)Read<uint8_t>(pos);
paramSet.EmitShape.Type = (EmitShapeT)Read<uint8_t>(pos);
paramSet.EmitShape.RotationApplied = Read<uint8_t>(pos) != 0;
switch (paramSet.EmitShape.Type)
{
case EmitShape::Point:
case EmitShapeT::Point:
break;
case EmitShape::Line:
case EmitShapeT::Line:
paramSet.EmitShape.Line.Start = Read<float3>(pos);
paramSet.EmitShape.Line.End = Read<float3>(pos);
paramSet.EmitShape.Line.Width = Read<float>(pos);
break;
case EmitShape::Circle:
case EmitShapeT::Circle:
paramSet.EmitShape.Circle.Axis = Read<float3>(pos);
paramSet.EmitShape.Circle.Inner = Read<float>(pos);
paramSet.EmitShape.Circle.Outer = Read<float>(pos);
break;
case EmitShape::Sphere:
case EmitShapeT::Sphere:
paramSet.EmitShape.Sphere.Radius = Read<float>(pos);
break;
case EmitShape::Model:
case EmitShapeT::Model:
paramSet.EmitShape.Model.Index = Read<int32_t>(pos);
paramSet.EmitShape.Model.Size = Read<float>(pos);
break;
Expand Down Expand Up @@ -105,7 +105,7 @@ GpuParticles::ParamSet LoadGpuParticlesParameter(uint8_t*& pos, int32_t version)
paramSet.RenderBasic.ZWrite = Read<uint8_t>(pos);
paramSet.RenderBasic.ZTest = Read<uint8_t>(pos);

paramSet.RenderShape.Type = (RenderShape)Read<uint8_t>(pos);
paramSet.RenderShape.Type = (RenderShapeT)Read<uint8_t>(pos);
paramSet.RenderShape.Data = Read<uint32_t>(pos);
paramSet.RenderShape.Size = Read<float>(pos);

Expand Down
8 changes: 4 additions & 4 deletions Dev/Cpp/Effekseer/Effekseer/Renderer/Effekseer.GpuParticles.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ inline vector4<T> operator*(vector4<T> a, T b)
}


enum class EmitShape : uint32_t
enum class EmitShapeT : uint32_t
{
Point, Line, Circle, Sphere, Model,
};
Expand All @@ -116,7 +116,7 @@ enum class ColorSpaceType : uint32_t
{
RGBA, HSVA,
};
enum class RenderShape : uint32_t
enum class RenderShapeT : uint32_t
{
Sprite, Model, Trail,
};
Expand Down Expand Up @@ -162,7 +162,7 @@ struct ParamSet
float Size;
};

EmitShape Type;
EmitShapeT Type;
bool RotationApplied;
union
{
Expand Down Expand Up @@ -241,7 +241,7 @@ struct ParamSet

struct RenderShapeParams
{
RenderShape Type;
RenderShapeT Type;
uint32_t Data;
float Size;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void GpuParticleSystem::ComputeFrame()
}
}

if (paramSet.EmitShape.Type == EmitShape::Model)
if (paramSet.EmitShape.Type == EmitShapeT::Model)
{
if (!emitter.resource->emitPoints)
{
Expand Down Expand Up @@ -673,9 +673,9 @@ void GpuParticleSystem::RenderFrame()
Effekseer::ModelRef model;
switch (paramSet.RenderShape.Type)
{
case RenderShape::Sprite: model = m_modelSprite; break;
case RenderShape::Model: model = effect->GetModel(paramSet.RenderShape.Data); break;
case RenderShape::Trail: model = m_modelTrail; break;
case RenderShapeT::Sprite: model = m_modelSprite; break;
case RenderShapeT::Model: model = effect->GetModel(paramSet.RenderShape.Data); break;
case RenderShapeT::Trail: model = m_modelTrail; break;
}

if (model)
Expand Down Expand Up @@ -747,7 +747,7 @@ GpuParticleSystem::EmitterID GpuParticleSystem::NewEmitter(Effekseer::GpuParticl
emitter.data.ParticleHead = particleBlock.offset;
emitter.data.ParticleSize = particleBlock.size;

if (paramSet.RenderShape.Type == RenderShape::Trail)
if (paramSet.RenderShape.Type == RenderShapeT::Trail)
{
Block trailBlock = m_trailAllocator.Allocate(particlesMaxCount * paramSet.RenderShape.Data);
if (trailBlock.size == 0)
Expand Down
Loading