mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-25 22:25:07 +00:00
- Added ShaderManager to handle shader paths loading from Lua. - Integrated SceneManager for managing scene objects within ScriptEngine. - Updated ScriptEngine to utilize ShaderManager and SceneManager. - Refactored audio command handling to use AudioManager. - Improved error handling and Lua integration for shader and scene loading. - Cleaned up code structure and dependencies in script_engine.hpp.
38 lines
894 B
C++
38 lines
894 B
C++
#pragma once
|
|
|
|
#include <lua.hpp>
|
|
#include <lauxlib.h>
|
|
#include "script/lua_helpers.hpp"
|
|
#include "core/vertex.hpp"
|
|
|
|
#include <array>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace sdl3cpp::script {
|
|
|
|
class SceneManager {
|
|
public:
|
|
struct SceneObject {
|
|
std::vector<core::Vertex> vertices;
|
|
std::vector<uint16_t> indices;
|
|
int computeModelMatrixRef = LUA_REFNIL;
|
|
std::string shaderKey = "default";
|
|
};
|
|
|
|
explicit SceneManager(lua_State* L);
|
|
|
|
std::vector<SceneObject> LoadSceneObjects();
|
|
std::array<float, 16> ComputeModelMatrix(int functionRef, float time);
|
|
std::array<float, 16> GetViewProjectionMatrix(float aspect);
|
|
|
|
private:
|
|
lua_State* L_;
|
|
|
|
std::vector<core::Vertex> ReadVertexArray(int index);
|
|
std::vector<uint16_t> ReadIndexArray(int index);
|
|
std::string GetLuaError();
|
|
};
|
|
|
|
} // namespace sdl3cpp::script
|