Skip to content

Commit

Permalink
Fixed EmitShape and RenderShape type/member name overlap and missing …
Browse files Browse the repository at this point in the history
…cstdint include (#1007)
  • Loading branch information
blujai831 authored Mar 24, 2024
1 parent 44bc175 commit df63a09
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
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

0 comments on commit df63a09

Please sign in to comment.