#include "FluidSimulationGame.h"
#include "Actor/DirectionalLightActor.h"
#include "Actor/PointLightActor.h"
#include "Actor/StaticMeshActor.h"
#include "Asset/AssetRegistry.h"

using namespace Seele;

FluidSimulationGame::FluidSimulationGame() {}

FluidSimulationGame::~FluidSimulationGame() {}

void FluidSimulationGame::setupScene(Seele::PScene scene, Seele::PSystemGraph graph) {
    mesh = new StaticMeshActor(scene, AssetRegistry::findMesh("rttest", "rttest"));
    sun = new DirectionalLightActor(scene, Vector(1, -1, 1), 1, Vector(1, 1, 1));
    pointLight = new PointLightActor(scene, Vector(0, 1, 0), 1, Vector(1, 1, 1), 10);

    Seele::Component::Transform transform;
    Seele::Component::FluidGrid grid;
    grid.cellSize = 0.1f;
    grid.viscosity = 0.001f;
    grid.diffusion = 0.0001f;
    grid.gridSize = {64, 64, 64};
    transform.transform.setPosition({0.0f, 0.0f, 0.0f});
    scene->getFluidScene()->updateFluidData(0, transform, grid);
}

extern "C" FluidSimulationGame* createInstance() {
    return new FluidSimulationGame();
}

extern "C" void destroyInstance(FluidSimulationGame* game) {
    delete game;
}