Base water set up

This commit is contained in:
tleety
2015-09-17 17:35:17 +02:00
parent 692e0ca9df
commit b69413d9c9
7 changed files with 73 additions and 26 deletions
+11 -9
View File
@@ -44,8 +44,9 @@
#include "Physics/PhysicsSystem.h"
#include "Physics/CPhysics.h"
#include "Physics/CBoxShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/ESetImpulse.h"
#include "Physics/CWaterVolume.h"
namespace dd
{
@@ -91,6 +92,7 @@ public:
m_World->ComponentFactory.Register<Components::Model>();
m_World->ComponentFactory.Register<Components::Template>();
m_World->ComponentFactory.Register<Components::PointLight>();
m_World->ComponentFactory.Register<Components::WaterVolume>();
m_World->Initialize();
@@ -145,15 +147,15 @@ public:
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
}
//Brick test model
//Water test
{
auto t_Brick = m_World->CreateEntity();
auto transform = m_World->AddComponent<Components::Transform>(t_Brick);
transform->Position = glm::vec3(0.f, 0.f, -12.f);
transform->Orientation = glm::rotate(glm::quat(), 0.5f, glm::vec3(0,-1,-1));
auto model = m_World->AddComponent<Components::Model>(t_Brick);
model->ModelFile = "Models/Test/Brick/Brick.obj";
auto t_waterBody = m_World->CreateEntity();
auto transform = m_World->AddComponent<Components::Transform>(t_waterBody);
transform->Position = glm::vec3(0.f, 0.f, -10.f);
auto water = m_World->AddComponent<Components::WaterVolume>(t_waterBody);
auto sprite = m_World->AddComponent<Components::Sprite>(t_waterBody);
sprite->SpriteFile = "Textures/Test/Brick_Diffuse.png";
auto body = m_World->AddComponent<Components::RectangleShape>(t_waterBody);
}
{
+1 -1
View File
@@ -18,7 +18,7 @@
#include "Game/ELifeLost.h"
#include "Game/EResetBall.h"
#include "Game/EScoreEvent.h"
#include "Physics/CBoxShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
+1 -1
View File
@@ -14,7 +14,7 @@
#include "Core/EKeyUp.h"
#include "Input/EBindKey.h"
#include "Physics/EContact.h"
#include "Physics/CBoxShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
+19
View File
@@ -0,0 +1,19 @@
#ifndef CWATERVOLUME_H
#define CWATERVOLUME_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct WaterVolume : public Component
{
};
}
}
#endif
Regular → Executable
+11 -1
View File
@@ -5,7 +5,7 @@
#include "Core/System.h"
#include "Core/World.h"
#include "Physics/CBoxShape.h"
#include "CRectangleShape.h"
#include "Physics/CPhysics.h"
#include <Box2D/Box2D.h>
#include "Core/CTransform.h"
@@ -14,6 +14,7 @@
#include "Physics/ESetImpulse.h"
#include "Physics/CCircleShape.h"
#include "Core/EventBroker.h"
#include "Physics/CWaterVolume.h"
namespace dd
@@ -64,6 +65,15 @@ private:
void CreateBody(EntityID entity);
const b2ParticleSystemDef m_ParticleSystemDef;
b2ParticleSystem *m_ParticleSystem;
void InitializeWater();
void SyncWater(); //TODO: Probably remove this
void CreateParticleGroup(EntityID entity);
class ContactListener : public b2ContactListener
{