Added ParticleSystem skeleton plus basic temporary implementation.
This commit is contained in:
+1
-1
@@ -98,7 +98,7 @@ void GameWorld::AddSystems()
|
|||||||
//AddSystem("LevelGenerationSystem");
|
//AddSystem("LevelGenerationSystem");
|
||||||
AddSystem("InputSystem");
|
AddSystem("InputSystem");
|
||||||
//AddSystem("CollisionSystem");
|
//AddSystem("CollisionSystem");
|
||||||
////AddSystem("ParticleSystem");
|
//AddSystem("ParticleSystem");
|
||||||
//AddSystem("PlayerSystem");
|
//AddSystem("PlayerSystem");
|
||||||
AddSystem("FreeSteeringSystem");
|
AddSystem("FreeSteeringSystem");
|
||||||
AddSystem("SoundSystem");
|
AddSystem("SoundSystem");
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#include "ParticleSystem.h"
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
|
||||||
|
#include "World.h"
|
||||||
|
void Systems::ParticleSystem::Update(double dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
|
{
|
||||||
|
auto transformComponent = m_World->GetComponent<Components::Transform>(entity, "Transform");
|
||||||
|
if(!transformComponent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
transformComponent->Position.y --;
|
||||||
|
|
||||||
|
timeLived[entity] += dt;
|
||||||
|
|
||||||
|
auto emitterComponent = m_World->GetComponent<Components::ParticleEmitter>(entity, "ParticleEmitter");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Systems::ParticleSystem::RegisterComponents(ComponentFactory* cf)
|
||||||
|
{
|
||||||
|
cf->Register("ParticleEmitter", []() { return new Components::ParticleEmitter(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void Systems::ParticleSystem::SpawnParticles()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
auto particle = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(particle, "Transform");
|
||||||
|
transform->Position = glm::vec3(0);
|
||||||
|
particles.push_back(particle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Systems::ParticleSystem::Draw(double dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef ParticleSystem_h__
|
||||||
|
#define ParticleSystem_h__
|
||||||
|
|
||||||
|
#include "System.h"
|
||||||
|
#include "Components/Transform.h"
|
||||||
|
#include "Components/ParticleEmitter.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Systems
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class ParticleSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ParticleSystem(World* world);
|
||||||
|
void RegisterComponents(ComponentFactory* cf) override;
|
||||||
|
|
||||||
|
void Update(double dt) override;
|
||||||
|
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SpawnParticles();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ParticleSystem_h__
|
||||||
@@ -109,6 +109,7 @@
|
|||||||
<ClCompile Include="..\..\src\Systems\DebugSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\DebugSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\Systems\FreeSteeringSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\FreeSteeringSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\Systems\InputSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\InputSystem.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\Systems\ParticleSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\Systems\PhysicsSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\PhysicsSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\Systems\RenderSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\RenderSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\Systems\SoundSystem.cpp" />
|
<ClCompile Include="..\..\src\Systems\SoundSystem.cpp" />
|
||||||
@@ -151,6 +152,7 @@
|
|||||||
<ClInclude Include="..\..\src\Systems\DebugSystem.h" />
|
<ClInclude Include="..\..\src\Systems\DebugSystem.h" />
|
||||||
<ClInclude Include="..\..\src\Systems\FreeSteeringSystem.h" />
|
<ClInclude Include="..\..\src\Systems\FreeSteeringSystem.h" />
|
||||||
<ClInclude Include="..\..\src\Systems\InputSystem.h" />
|
<ClInclude Include="..\..\src\Systems\InputSystem.h" />
|
||||||
|
<ClInclude Include="..\..\src\Systems\ParticleSystem.h" />
|
||||||
<ClInclude Include="..\..\src\Systems\PhysicsSystem.h" />
|
<ClInclude Include="..\..\src\Systems\PhysicsSystem.h" />
|
||||||
<ClInclude Include="..\..\src\Systems\RenderSystem.h" />
|
<ClInclude Include="..\..\src\Systems\RenderSystem.h" />
|
||||||
<ClInclude Include="..\..\src\Systems\SoundSystem.h" />
|
<ClInclude Include="..\..\src\Systems\SoundSystem.h" />
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ResourceManager.cpp" />
|
<ClCompile Include="..\..\src\ResourceManager.cpp" />
|
||||||
<ClCompile Include="..\..\src\Sound.cpp" />
|
<ClCompile Include="..\..\src\Sound.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\Systems\ParticleSystem.cpp">
|
||||||
|
<Filter>Particle System\Systems</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Util">
|
<Filter Include="Util">
|
||||||
@@ -157,36 +160,6 @@
|
|||||||
<ClInclude Include="..\..\src\CubemapTexture.h">
|
<ClInclude Include="..\..\src\CubemapTexture.h">
|
||||||
<Filter>Rendering</Filter>
|
<Filter>Rendering</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\Components\BoxShape.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\CompoundShape.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\BallSocketConstraint.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\HingeConstraint.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\MeshShape.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\SliderConstraint.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\SphereShape.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\StaticMeshShape.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\Vehicle.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\Wheel.h">
|
|
||||||
<Filter>Physics\Components</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\Components\Physics.h">
|
<ClInclude Include="..\..\src\Components\Physics.h">
|
||||||
<Filter>Physics\Components</Filter>
|
<Filter>Physics\Components</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -242,6 +215,11 @@
|
|||||||
<ClInclude Include="..\..\src\Sound.h">
|
<ClInclude Include="..\..\src\Sound.h">
|
||||||
<Filter>Audio</Filter>
|
<Filter>Audio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\Components\Box.h" />
|
||||||
|
<ClInclude Include="..\..\src\Components\Sphere.h" />
|
||||||
|
<ClInclude Include="..\..\src\Systems\ParticleSystem.h">
|
||||||
|
<Filter>Particle System\Systems</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\src\Shaders\AABB.frag.glsl">
|
<None Include="..\..\src\Shaders\AABB.frag.glsl">
|
||||||
|
|||||||
Reference in New Issue
Block a user