Adding more stuff

This commit is contained in:
Dynamitos
2024-05-16 19:45:44 +02:00
parent 79bfb1fd65
commit d12508818f
224 changed files with 16092 additions and 11 deletions
+31 -6
View File
@@ -3,6 +3,7 @@
#include "Asset/AssetRegistry.h"
#include "Component/Transform.h"
#include "System/FlyCamSystem.h"
#include "Graphics/StaticMeshVertexData.h"
MeshShadingDemoGame::MeshShadingDemoGame()
{
@@ -14,15 +15,39 @@ MeshShadingDemoGame::~MeshShadingDemoGame()
void MeshShadingDemoGame::setupScene(PScene scene, PSystemGraph graph)
{
cube = new StaticMeshActor(scene, AssetRegistry::findMesh("", "cube"));
cube->getTransform().setPosition(Vector(200, 0, 40));
cube->getTransform().setRotation(Quaternion(Vector(0, 1, 0.6f)));
cube->getTransform().setScale(Vector(50, 50, 50));
lights.add(new PointLightActor(scene, Vector(4.588, 3.085, 4.934), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(7.953, 3.121, -3.686), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.556, 3.187, -20.951), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(28.248, 3.119, -12.431), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(21.286, 3.132, -3.812), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(16.584, 3.1152, 4.822), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(14.232, 3.151, 13.474), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.178, 3.144, 22.079), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.074, 3.176, 30.716), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.053, 3.136, 39.339), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.062, 3.163, 48.746), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.067, 3.097, 56.555), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.051, 3.109, 65.204), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(13.073, 3.107, 73.822), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(2.997, 3.1082, 73.903), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(2.951, 3.127, 65.324), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(2.939, 3.117, 56.713), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(2.939, 3.100, 48.078), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(1.819, 3.048, 30.881), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(1.812, 3.076, 22.211), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
lights.add(new PointLightActor(scene, Vector(2.647, 3.154, 13.573), Vector(251 / 255.f, 207 / 255.f, 107 / 255.f), 3));
//cube = new StaticMeshActor(scene, AssetRegistry::findMesh("", "cube"));
//cube->getTransform().setPosition(Vector(2, 0, 4));
////cube->getTransform().setRotation(Quaternion(Vector(0, 1, 0.6f)));
//cube->getTransform().setScale(Vector(5, 5, 5));
//car = new StaticMeshActor(scene, AssetRegistry::findMesh("Volvo", "Volvo S90"));
//chapel = new StaticMeshActor(scene, AssetRegistry::findMesh("Whitechapel", "Whitechapel"));
chapel = new StaticMeshActor(scene, AssetRegistry::findMesh("Whitechapel", "Whitechapel"));
//chapel->getTransform().setRotation(Quaternion(Vector(0, 1.5, 0)));
//chapel->getTransform().setScale(Vector(0.01, 0.01, 0.01));
//test = new StaticMeshActor(scene, AssetRegistry::findMesh("", "Arissa"));
camera = new FlyCam(scene);
light = new DirectionalLightActor(scene, Vector4(1, 1, 1, 1), Vector(0, -1, 0));
camera->attachComponent<Component::PointLight>(Vector4(0, 0, 0, 0), Vector4(1, 1, 1, 2));
//light = new DirectionalLightActor(scene, Vector4(0.0, 0.0, 0.2, 1), Vector(0, -1, 0));
graph->addSystem(new FlyCamSystem(scene));
}
+2
View File
@@ -3,6 +3,7 @@
#include "Define.h"
#include <Actor/StaticMeshActor.h>
#include <Actor/DirectionalLightActor.h>
#include <Actor/PointLightActor.h>
#include <Game.h>
class MESHSHADINGDEMO_API MeshShadingDemoGame : public Game {
@@ -15,6 +16,7 @@ private:
OStaticMeshActor cube;
OStaticMeshActor car;
OStaticMeshActor test;
Array<OPointLightActor> lights;
OStaticMeshActor chapel;
OFlyCam camera;
ODirectionalLightActor light;
+5 -3
View File
@@ -1,15 +1,15 @@
#include "FlyCamSystem.h"
FlyCamSystem::FlyCamSystem(PScene scene)
: System::ComponentSystem<Component::KeyboardInput, Component::Camera, Component::Transform>(scene) {}
: System::ComponentSystem<Component::KeyboardInput, Component::Camera, Component::Transform, Component::PointLight>(scene) {}
FlyCamSystem::~FlyCamSystem() {}
void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& camera, Component::Transform& transform) {
void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& camera, Component::Transform& transform, Component::PointLight& light) {
float cameraMove = static_cast<float>(deltaTime);
if(input.keys[KeyCode::KEY_LEFT_SHIFT])
{
cameraMove *= 500;
cameraMove *= 5;
}
Vector forward = transform.getForward();
Vector side = transform.getRight();
@@ -49,4 +49,6 @@ void FlyCamSystem::update(Component::KeyboardInput& input, Component::Camera& ca
{
camera.mouseMove(input.deltaX, input.deltaY);
}
light.colorRange.w += input.scrollY * 0.1;
light.positionWS = Vector4(transform.getPosition(), 1);
}
+3 -2
View File
@@ -9,12 +9,13 @@
class FlyCamSystem : public System::ComponentSystem<
Component::KeyboardInput,
Component::Camera,
Component::Transform>
Component::Transform,
Component::PointLight>
{
public:
FlyCamSystem(PScene scene);
virtual ~FlyCamSystem();
virtual void update(Seele::Component::KeyboardInput& input, Seele::Component::Camera& camera, Seele::Component::Transform& transform) override;
virtual void update(Seele::Component::KeyboardInput& input, Seele::Component::Camera& camera, Seele::Component::Transform& transform, Seele::Component::PointLight& pointLight) override;
private:
float lastMouseX;
float lastMouseY;