adding materials, adding serialization for meshes and materials, random fixes
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
namespace OpenEngine {
|
||||
|
||||
// SHOULD BE MOVED ==================================
|
||||
|
||||
enum class PrimitiveType
|
||||
{
|
||||
None = 0,
|
||||
Quad,
|
||||
Cube
|
||||
};
|
||||
|
||||
struct MeshVertex
|
||||
{
|
||||
glm::vec3 position;
|
||||
@@ -19,6 +27,15 @@ namespace OpenEngine {
|
||||
uint32_t id = -1;
|
||||
};
|
||||
|
||||
struct Material
|
||||
{
|
||||
glm::vec4 albedo = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
float roughness = 1.0f;
|
||||
float metallic = 1.0f;
|
||||
float ambient_strength = 1.0f;
|
||||
float specular_strength = 1.0f;
|
||||
};
|
||||
|
||||
struct Mesh
|
||||
{
|
||||
Ref<VertexArray> vertex_array;
|
||||
@@ -46,7 +63,8 @@ namespace OpenEngine {
|
||||
static void BeginScene(const EditorCamera& camera);
|
||||
static void EndScene();
|
||||
|
||||
static void DrawMesh(const Ref<Mesh>& mesh, const glm::mat4& transform);
|
||||
static void DrawMesh(const Ref<Mesh>& mesh, Material& material,
|
||||
const glm::mat4& transform);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -86,17 +86,28 @@ namespace OpenEngine {
|
||||
(delete nsc->instance);
|
||||
nsc->instance = nullptr;
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct MeshComponent
|
||||
{
|
||||
Ref<Mesh> mesh;
|
||||
PrimitiveType primitive_type = PrimitiveType::None;
|
||||
|
||||
MeshComponent() = default;
|
||||
MeshComponent(const MeshComponent&) = default;
|
||||
MeshComponent(const Ref<Mesh>& mesh)
|
||||
: mesh(mesh) {}
|
||||
: mesh(mesh) {};
|
||||
};
|
||||
|
||||
struct MaterialComponent
|
||||
{
|
||||
Material material;
|
||||
|
||||
MaterialComponent() = default;
|
||||
MaterialComponent(const MaterialComponent&) = default;
|
||||
MaterialComponent(const Material& material)
|
||||
: material(material) {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenEngine {
|
||||
|
||||
uint32_t viewport_width = 0, viewport_height = 0;
|
||||
|
||||
std::vector<entt::entity> entities_to_be_deleted;
|
||||
std::vector<entt::entity> pending_deletion;
|
||||
|
||||
friend class SceneSerializer;
|
||||
friend class Entity;
|
||||
|
||||
Reference in New Issue
Block a user