Starting basic physics, nothing fancy

This commit is contained in:
2023-02-20 00:29:28 -08:00
parent da3613a7ff
commit 467f4d5a3f
32 changed files with 779 additions and 286 deletions

View File

@ -11,4 +11,6 @@
#define INPUT_BIND_NEGATIVE_X INPUT_BIND(2)
#define INPUT_BIND_POSITIVE_X INPUT_BIND(3)
#define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4)
#define INPUT_BIND_POSITIVE_Y INPUT_BIND(5)
#define INPUT_BIND_POSITIVE_Y INPUT_BIND(5)
#define INPUT_BIND_MOUSE_X INPUT_BIND(6)
#define INPUT_BIND_MOUSE_Y INPUT_BIND(7)

View File

@ -7,6 +7,9 @@
#include "scene/Scene.hpp"
#include "prefabs/SimpleSpinningCubePrefab.hpp"
#include "prefabs/TicTacToeTilePrefab.hpp"
#include "display/mesh/SphereMesh.hpp"
#include "scene/components/physics/3d/RayTester3D.hpp"
namespace Dawn {
class TicTacToeScene : public Scene {
@ -16,19 +19,34 @@ namespace Dawn {
void stage() override {
camera = Camera::create(this);
camera->transform->lookAt(glm::vec3(5, 5, 5), glm::vec3(0, 0, 0));
camera->transform->lookAt(glm::vec3(0, 0, 5), glm::vec3(0, 0, 0));
camera->type = CAMERA_TYPE_ORTHONOGRAPHIC;
float_t s = 2.0f;
camera->orthoTop = -s;
camera->orthoBottom = s;
float_t ratio = 1.0f / 9.0f * 16.0f;
camera->orthoLeft = -s * ratio;
camera->orthoRight = s * ratio;
auto cube = SimpleSpinningCubePrefab::create(this);
// SphereMesh::createSphere(&cube->meshHost->mesh, 1.0f, 16, 16);
auto tester = cube->addComponent<RayTester3D>();
tester->prefab = cube;
tester->camera = camera;
int32_t i = 0;
for(int32_t x = -1; x <= 1; x++) {
for(int32_t y = -1; y <= 1; y++) {
auto tile = TicTacToeTilePrefab::prefabCreate(this);
continue;
auto tile = TicTacToeTilePrefab::create(this);
tile->transform.setLocalPosition(glm::vec3(x * 1.25f, y * 1.25f, 0));
// tile->ticTacToe->setState(i % 2 == 0 ? TIC_TAC_TOE_CROSS : TIC_TAC_TOE_NOUGHT);
tile->ticTacToe->setState(i % 2 == 0 ? TIC_TAC_TOE_CROSS : TIC_TAC_TOE_NOUGHT);
tiles[i++] = tile;
}
}
}
std::vector<Asset*> getRequiredAssets() override {