added quad primitive, shortcuts and safe entity deletion
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "open_engine/renderer/editor_camera.hpp"
|
||||
#include "open_engine/renderer/vertex_array.hpp"
|
||||
#include "open_engine/renderer/camera.hpp"
|
||||
#include "open_engine/renderer/buffer.hpp"
|
||||
#include "open_engine/scene/scene_camera.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenEngine {
|
||||
@@ -33,6 +33,7 @@ namespace OpenEngine {
|
||||
Ref<Mesh> CreateMesh(const std::vector<MeshVertex>& vertices,
|
||||
const std::vector<uint32_t>& indices);
|
||||
Ref<Mesh> CreateCube(uint32_t id = -1);
|
||||
Ref<Mesh> CreateQuad(uint32_t id = -1, bool back_face = false);
|
||||
// ==================================================
|
||||
|
||||
class Renderer3D
|
||||
@@ -41,20 +42,11 @@ namespace OpenEngine {
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
static void BeginScene(const Camera& camera, const glm::mat4& transform);
|
||||
static void BeginScene(const SceneCamera& camera, const glm::mat4& transform);
|
||||
static void BeginScene(const EditorCamera& camera);
|
||||
static void EndScene();
|
||||
|
||||
static void DrawMesh(const Ref<Mesh>& mesh, const glm::mat4& transform);
|
||||
|
||||
/*
|
||||
static void DrawCube(const glm::mat4& transform, const glm::vec4& color,
|
||||
int entity_id);
|
||||
static void DrawCube(const glm::mat4& transform, Ref<Texture2D>,
|
||||
int entity_id);
|
||||
static void DrawCube(const glm::mat4& transform, Ref<Texture2D>,
|
||||
const glm::vec4& color, int entity_id);
|
||||
*/
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "open_engine/renderer/editor_camera.hpp"
|
||||
|
||||
#include <entt/entity/fwd.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -13,11 +14,14 @@ namespace OpenEngine {
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
Scene() {};
|
||||
Scene() = default;
|
||||
~Scene() = default;
|
||||
|
||||
Entity CreateEntity(const std::string& name = std::string());
|
||||
void DeleteEntity(Entity entity);
|
||||
void DeleteEntity(entt::entity entity);
|
||||
void MarkEntityForDeletion(Entity entity);
|
||||
|
||||
void UpdateEntities();
|
||||
|
||||
void OnUpdateRuntime();
|
||||
void OnUpdateEditor(EditorCamera& camera);
|
||||
@@ -36,6 +40,8 @@ namespace OpenEngine {
|
||||
|
||||
uint32_t viewport_width = 0, viewport_height = 0;
|
||||
|
||||
std::vector<entt::entity> entities_to_be_deleted;
|
||||
|
||||
friend class SceneSerializer;
|
||||
friend class Entity;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user