Skip to content
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
23 changes: 11 additions & 12 deletions .github/workflows/cpp-cmake-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Copy exe to root
run: |
cp ./build/ParticleEngine/Release/ParticleEngine.exe .
cp ./build/PhysicalEngine/Release/PhysicalEngine.exe .
- name: Upload artifact release
uses: actions/upload-artifact@v2
with:
name: artifact-windows
path: |
./ParticleEngine.exe
./PhysicalEngine.exe
./imgui.ini
build-ubuntu:
name: Build ubuntu
Expand All @@ -38,19 +38,18 @@ jobs:
- name: Install libs
run: |
sudo apt-get install libglfw3-dev
sudo apt install xorg-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Copy exe to root
run: cp ./build/ParticleEngine/ParticleEngine ./ParticleEngineLauncher
run: cp ./build/PhysicalEngine/PhysicalEngine ./PhysicalEngineLauncher
- name: Upload artifact release
uses: actions/upload-artifact@v2
with:
name: artifact-ubuntu
path: |
./ParticleEngineLauncher
./PhysicalEngineLauncher
./imgui.ini
build-macos:
name: Build macos
Expand All @@ -64,13 +63,13 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Copy exe to root
run: cp ./build/ParticleEngine/ParticleEngine ./ParticleEngineLauncher
run: cp ./build/PhysicalEngine/PhysicalEngine ./PhysicalEngineLauncher
- name: Upload artifact release
uses: actions/upload-artifact@v2
with:
name: artifact-macos
path: |
./ParticleEngineLauncher
./PhysicalEngineLauncher
./imgui.ini
release-project:
name: Release project
Expand Down Expand Up @@ -102,12 +101,12 @@ jobs:
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
asset_path: release-windows.zip
asset_name: ParticleEngine-windows-v${{ github.run_number }}.zip
asset_name: PhysicalEngine-windows-v${{ github.run_number }}.zip
asset_content_type: application/zip
- name: Delete windows release files
run: |
rm release-windows.zip
rm ParticleEngine.exe
rm PhysicalEngine.exe
- name: Download ubuntu artifact content
uses: actions/download-artifact@v2
with:
Expand All @@ -125,12 +124,12 @@ jobs:
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
asset_path: release-linux.tar.gz
asset_name: ParticleEngine-linux-v${{ github.run_number }}.tar.gz
asset_name: PhysicalEngine-linux-v${{ github.run_number }}.tar.gz
asset_content_type: application/zip
- name: Delete ubuntu release files
run: |
rm release-linux.tar.gz
rm ParticleEngineLauncher
rm PhysicalEngineLauncher
- name: Download macos artifact content
uses: actions/download-artifact@v2
with:
Expand All @@ -148,5 +147,5 @@ jobs:
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
asset_path: release-macos.tar.gz
asset_name: ParticleEngine-macos-v${{ github.run_number }}.tar.gz
asset_name: PhysicalEngine-macos-v${{ github.run_number }}.tar.gz
asset_content_type: application/zip
173 changes: 96 additions & 77 deletions PhysicalEngine/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Force/Spring.h"
#include "Scene/Components/Mesh/Cylinder/Cylinder.h"
#include "Scene/Components/Mesh/Sphere/Sphere.h"
#include "Scene/Components/PhysicalComponent/Particle/Particle.h"
#include "Scene/GameObject.h"
#include "Scene/Prefabs/ParticlePrefab.h"
Expand Down Expand Up @@ -51,99 +52,117 @@ void Game::start(Scene* s) {
scene->addGameObject(plan);
plan->addComponent(new RigidbodyPlaneCollider(plan, 10, 10));

auto* sphere = new RigidbodyPrefab(scene, new Sphere(1));
sphere->addComponent(new RigidbodySphereCollider(sphere, 1));
sphere->transform.setPosition({ -4, 0, 0 });
scene->addGameObject(sphere);

auto* rigidbodyPrefab = new RigidbodyPrefab(scene);
scene->addGameObject(rigidbodyPrefab);
rigidbodyPrefab->transform.positionX = -3;
rigidbodyPrefab->transform.positionX = -1.5;
rigidbodyPrefab->transform.positionY = 3;
rigidbodyPrefab->transform.positionZ = -3;
rigidbodyPrefab->transform.positionZ = 0;
Rigidbody* rigidbody;
rigidbodyPrefab->getComponentByClass(rigidbody);
rigidbody->setAngularSpeed({ 0, 1, 0 });
RigidbodyCuboidRectangleCollider* rigidbodyCuboidRectangleCollider = new RigidbodyCuboidRectangleCollider(rigidbodyPrefab, 1, 0.5f, 0.5f);
rigidbodyPrefab->addComponent(rigidbodyCuboidRectangleCollider);

auto* rigidbodyPrefab2 = new RigidbodyPrefab(scene);
rigidbodyPrefab2->transform.positionX = 3;
rigidbodyPrefab2->transform.positionX = 1.5;
rigidbodyPrefab2->transform.positionY = 3;
rigidbodyPrefab2->transform.positionZ = -3;
scene->addGameObject(rigidbodyPrefab2);
Rigidbody* rigidbody2;
rigidbodyPrefab2->getComponentByClass(rigidbody2);
rigidbody2->setAngularSpeed({ 0, 0, -1 });
RigidbodyCuboidRectangleCollider* rigidbodyCuboidRectangleCollider2 = new RigidbodyCuboidRectangleCollider(rigidbodyPrefab2, 1, 0.5f, 0.5f);
rigidbodyPrefab2->addComponent(rigidbodyCuboidRectangleCollider2);
}

void Game::goLeft() {
// m_p->setSpeed(-m_speed, 0, 0);

for (auto& gameObject : scene->getGameObjects())
{
auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
if (particle != nullptr)
{
AnchoredSpring* anchoredSpring;
particle->getForceByClass(anchoredSpring);
if (anchoredSpring != nullptr)
{
anchoredSpring->translate({ -m_speed, 0, 0 });
}
}
}
auto* rigidbodyPrefab3 = new RigidbodyPrefab(scene);
rigidbodyPrefab3->transform.positionX = 3;
rigidbodyPrefab3->transform.positionY = 3;
rigidbodyPrefab3->transform.positionZ = 0;
scene->addGameObject(rigidbodyPrefab3);
Rigidbody* rigidbody3;
rigidbodyPrefab3->getComponentByClass(rigidbody3);
rigidbody3->setAngularSpeed({ 2, 0, 0 });
RigidbodyCuboidRectangleCollider* rigidbodyCuboidRectangleCollider3 = new RigidbodyCuboidRectangleCollider(rigidbodyPrefab3, 1, 0.5f, 0.5f);
rigidbodyPrefab3->addComponent(rigidbodyCuboidRectangleCollider3);
}

void Game::goRight() {
// m_p->setSpeed(m_speed, 0, 0);

for (auto& gameObject : scene->getGameObjects())
{
auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
if (particle != nullptr)
{
AnchoredSpring* anchoredSpring;
particle->getForceByClass(anchoredSpring);
if (anchoredSpring != nullptr)
{
anchoredSpring->translate({ m_speed, 0, 0 });
}
}
}
}

void Game::goUp() {
// m_p->setSpeed(0, m_speed, 0);

for (auto& gameObject : scene->getGameObjects())
{
auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
if (particle != nullptr)
{
AnchoredSpring* anchoredSpring;
particle->getForceByClass(anchoredSpring);
if (anchoredSpring != nullptr)
{
anchoredSpring->translate({ 0, m_speed, 0 });
}
}
}
}

void Game::goDown() {
// m_p->setSpeed(0, -m_speed, 0);

for (auto& gameObject : scene->getGameObjects())
{
auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
if (particle != nullptr)
{
AnchoredSpring* anchoredSpring;
particle->getForceByClass(anchoredSpring);
if (anchoredSpring != nullptr)
{
anchoredSpring->translate({ 0, -m_speed, 0 });
}
}
}
}

float* Game::getPtrSpeed() {
return &m_speed;
}
//void Game::goLeft() {
// // m_p->setSpeed(-m_speed, 0, 0);
//
// for (auto& gameObject : scene->getGameObjects())
// {
// auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
// if (particle != nullptr)
// {
// AnchoredSpring* anchoredSpring;
// particle->getForceByClass(anchoredSpring);
// if (anchoredSpring != nullptr)
// {
// anchoredSpring->translate({ -m_speed, 0, 0 });
// }
// }
// }
//}
//
//void Game::goRight() {
// // m_p->setSpeed(m_speed, 0, 0);
//
// for (auto& gameObject : scene->getGameObjects())
// {
// auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
// if (particle != nullptr)
// {
// AnchoredSpring* anchoredSpring;
// particle->getForceByClass(anchoredSpring);
// if (anchoredSpring != nullptr)
// {
// anchoredSpring->translate({ m_speed, 0, 0 });
// }
// }
// }
//}
//
//void Game::goUp() {
// // m_p->setSpeed(0, m_speed, 0);
//
// for (auto& gameObject : scene->getGameObjects())
// {
// auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
// if (particle != nullptr)
// {
// AnchoredSpring* anchoredSpring;
// particle->getForceByClass(anchoredSpring);
// if (anchoredSpring != nullptr)
// {
// anchoredSpring->translate({ 0, m_speed, 0 });
// }
// }
// }
//}
//
//void Game::goDown() {
// // m_p->setSpeed(0, -m_speed, 0);
//
// for (auto& gameObject : scene->getGameObjects())
// {
// auto* particle = dynamic_cast<Particle*>(gameObject->getComponentByName(PARTICLE_COMPONENT));
// if (particle != nullptr)
// {
// AnchoredSpring* anchoredSpring;
// particle->getForceByClass(anchoredSpring);
// if (anchoredSpring != nullptr)
// {
// anchoredSpring->translate({ 0, -m_speed, 0 });
// }
// }
// }
//}

//float* Game::getPtrSpeed() {
// return &m_speed;
//}
16 changes: 8 additions & 8 deletions PhysicalEngine/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ class Game {

void start(Scene* scene);

void goLeft();

void goRight();

void goUp();

void goDown();
// void goLeft();
//
// void goRight();
//
// void goUp();
//
// void goDown();

public:
float* getPtrSpeed();
// float* getPtrSpeed();
};

#endif // GAME_H
Loading