8#include "../../../Opengl-Core/include/Core.hpp"
9#include "Component.hpp"
102 void updatePosition(
const unsigned int &
id,
const glm::vec3 &position);
110 void updateScale(
const unsigned int &
id,
const glm::vec3 &scale);
121 void updateRotation(
const unsigned int &
id,
const glm::vec3 &rotation);
129 void addPosition(
const unsigned int &
id,
const glm::vec3 &offset);
137 void addScale(
const unsigned int &
id,
const glm::vec3 &offset);
148 void addRotation(
const unsigned int &
id,
const glm::vec3 &offset);
165 glm::vec3
getScale(
const unsigned int &
id);
285 bool isColliding(
const unsigned int &first,
const unsigned int &second);
307 Shared<ogl::Camera>
getCamera(
const unsigned int &
id);
316 void updateCameraCollider(
const unsigned int &
id,
const glm::vec3 &position,
const glm::vec3 &size);
330 void addChild(
const unsigned int &
parent,
const unsigned int &child);
354 std::vector<std::pair<
unsigned int, std::function<void()>>>
getKeysCallback(
const unsigned int &
id);
363 void setKeyCallback(
const unsigned int &
id,
const unsigned int &key, std::function<
void()> func);
470 void updateAmbient(
const unsigned int &
id,
const glm::vec3 &val);
478 void updateDiffuse(
const unsigned int &
id,
const glm::vec3 &val);
486 void updateSpecular(
const unsigned int &
id,
const glm::vec3 &val);
525 void updateColor(
const unsigned int &
id,
const glm::vec3 &color);
541 void updateAmbient(
const unsigned int &
id,
const glm::vec3 &ambient);
549 void updateDiffuse(
const unsigned int &
id,
const glm::vec3 &diffuse);
557 void updateSpecular(
const unsigned int &
id,
const glm::vec3 &specular);
565 void updateDirection(
const unsigned int &
id,
const glm::vec3 &direction);
573 void updatePosition(
const unsigned int &
id,
const glm::vec3 &position);
581 void updateConstant(
const unsigned int &
id,
const float &constant);
589 void updateLinear(
const unsigned int &
id,
const float &linear);
605 void updateCutoff(
const unsigned int &
id,
const float &cutoff);
652 void prepareInstancedMesh(
const std::vector<glm::mat4> &models,
const std::vector<glm::vec4> &colors);
698 void sendLightDataShader(
const Shared<ogl::ShaderProgram> &shader, std::array<LightShaderBlock, SHADER_MAX_LIGHTS> data);
706 void renderSkybox(
const unsigned int &
id,
const Shared<ogl::ShaderProgram> &shader);
727 std::vector<glm::vec3>
getBoxLines(glm::vec3 &botLeft, glm::vec3 &topRight);
Basic class to store material information for texturing and light computation.
Definition Component.hpp:635
Definition Component.hpp:552
All utilities to handle animations.
void executeNextFrame(const float ¤tTime)
This method updates all the TimeAnimation components, it needs the curren time in seconds.
Definition System.cpp:414
All utilities to manage the world camera.
Shared< ogl::Camera > getCamera(const unsigned int &id)
Retrieves a pointer to the camera given.
Definition System.cpp:361
void updateCameraCollider(const unsigned int &id, const glm::vec3 &position, const glm::vec3 &size)
Updates the collider of the camera given.
Definition System.cpp:367
It contains all utilities to retrieve, handle and update mesh ColliderComponent.
void updateParentCollider(const unsigned int &id)
Updates the collider of a parent mesh.
Definition System.cpp:206
void updateSimulated(const unsigned int &id, const bool &simulated)
Updates the simulation of the entity in a PhysicWorld.
Definition System.cpp:273
void updateColliderType(const unsigned int &id, const ColliderType &type)
Updates the collider type of the given entity.
Definition System.cpp:266
Pair< glm::vec3 > getCollider(const unsigned int &id)
Retrieves the collider corners of the entity given.
Definition System.cpp:252
void compressBoundingBox()
This method optimize children bounding box of all parent entities in a single square/cube bounding bo...
Definition System.cpp:280
ColliderType getColliderType(const unsigned int &id)
Retrieves the type of the entity collider.
Definition System.cpp:259
void updateAllColliders()
Updates all the entities collider by calling systems::collision::updateCollider().
Definition System.cpp:234
std::vector< Pair< unsigned int > > getCollisions()
Retrieves all entities overlapping each other using simple AABB detection.
Definition System.cpp:328
bool isColliding(const unsigned int &first, const unsigned int &second)
Calculate if two entities are colliding or not.
Definition System.cpp:241
void updateCollider(const unsigned int &id)
Updates the collider of the given entity. If this entity is a parent entity (an entity with a ParentC...
Definition System.cpp:215
All utilities to manage the entities in the EntityManager.
std::string getEntityName(const unsigned int &id)
Retrieves the name of the given entity.
Definition System.cpp:80
void cleanAll()
Clean the EntityManager from all entities and Components and from the BasicScene too.
Definition System.cpp:71
bool removeEntityFromAll(const unsigned int &id)
Removes an entity from the EntityManager and from the BasicScene.
Definition System.cpp:66
void updateEntityName(const unsigned int &id, const std::string &name)
Updates the name of the given entity.
Definition System.cpp:84
bool removeEntityFromManager(const unsigned int &id)
Removes an entity from the EntityManager, if the entity has children they will be removed too.
Definition System.cpp:46
void removeEntityFromScene(const unsigned int &id)
Removes the given entity from the BasicScene, if entity has children they will be removed too.
Definition System.cpp:56
void updateAmbient(const unsigned int &id, const glm::vec3 &ambient)
Updates the light ambient vector.
Definition System.cpp:563
void updateIntensity(const unsigned int &id, const float &intensity)
Updates the light intensity value.
Definition System.cpp:557
void updateSpecular(const unsigned int &id, const glm::vec3 &specular)
Updates the light specular vector.
Definition System.cpp:575
void updateConstant(const unsigned int &id, const float &constant)
Updates the light constant value.
Definition System.cpp:593
void updateDirection(const unsigned int &id, const glm::vec3 &direction)
Updates the light direction vector.
Definition System.cpp:581
void updatePosition(const unsigned int &id, const glm::vec3 &position)
Updates the light position vector.
Definition System.cpp:587
void updateOuterCutoff(const unsigned int &id, const float &outerCutoff)
Updates the light outer cutoff value.
Definition System.cpp:617
void updateCutoff(const unsigned int &id, const float &cutoff)
Updates the light cutoff value.
Definition System.cpp:611
LightComputation getLightComputation(const unsigned int &id)
Retrieves the light computation of an entity.
Definition System.cpp:629
void updateDiffuse(const unsigned int &id, const glm::vec3 &diffuse)
Updates the light diffuse vector.
Definition System.cpp:569
void setLightComputation(const unsigned int &id, const LightComputation &comp)
Updates the light computaion of an entity.
Definition System.cpp:623
LightShaderBlock getLightInfo(const unsigned int &id)
Retrieves a block (struct data) that will be sent to a shader program. The block will contain all the...
Definition System.cpp:532
void updateColor(const unsigned int &id, const glm::vec3 &color)
Updates the light color vector.
Definition System.cpp:551
void updateQuadratic(const unsigned int &id, const float &quadratic)
Updates the light quadratic value.
Definition System.cpp:605
void updateLinear(const unsigned int &id, const float &linear)
Updates the light linear value.
Definition System.cpp:599
void updateMaterial(const unsigned int &id, const Material &material)
Updates the material of the entity given.
Definition System.cpp:522
Material getMaterial(const unsigned int &id)
Retrieves the material of the given entity.
Definition System.cpp:480
std::string getMaterialName(const unsigned int &id)
Retrieves the material name of the entity given.
Definition System.cpp:487
void updateDiffuse(const unsigned int &id, const glm::vec3 &val)
Updates the diffuse vector of a material.
Definition System.cpp:501
void updateShininess(const unsigned int &id, const float &val)
Updates the shininess value of a material.
Definition System.cpp:515
void updateSpecular(const unsigned int &id, const glm::vec3 &val)
Updates the specular vector of a material.
Definition System.cpp:508
void updateAmbient(const unsigned int &id, const glm::vec3 &val)
Updates the ambient vector of a material.
Definition System.cpp:494
All utilities for a parent entity.
void addChild(const unsigned int &parent, const unsigned int &child)
Adds a child to the parent entity.
Definition System.cpp:375
void removeChild(const unsigned int &parent, const unsigned int &child)
Removes the given child from the parent entity.
Definition System.cpp:382
All utilities for rendering entities.
void renderSkybox(const unsigned int &id, const Shared< ogl::ShaderProgram > &shader)
This method draws the Skybox of the scene.
Definition System.cpp:737
void getOtherLightData(LightShaderBlock &block, const Shared< LightComponent > &light)
Retrieves all the light data and stores them in a shader block.
Definition System.cpp:645
std::array< LightShaderBlock, SHADER_MAX_LIGHTS > prepareLightData()
Prepares data of all lights in the scene and put them in an array with defined size.
Definition System.cpp:673
std::vector< glm::vec3 > getBoxLines(glm::vec3 &botLeft, glm::vec3 &topRight)
This method calculates the lines to be drawn from two corners of a ColliderComponent.
Definition System.cpp:856
void renderInstancedMeshes()
Renders all entities with instanced rendering available.
Definition System.cpp:852
void prepareInstancedMesh(const std::vector< glm::mat4 > &models, const std::vector< glm::vec4 > &colors)
This methods calls the renderer and prepares the buffers with the model matrixes and colors.
Definition System.cpp:641
void initStencilShader()
Initialize the stencil shader.
Definition System.cpp:637
void renderBoundingBox()
Renders all bounding box of the entities with a ColliderComponent.
Definition System.cpp:891
void sendOtherLightData(const Shared< ogl::ShaderProgram > &shader, LightShaderBlock &data, size_t &index)
This method sends to the used shader program the specific data for that light caster.
Definition System.cpp:692
void renderAllMeshes()
Renders all the entities in the scene.
Definition System.cpp:749
void sendLightDataShader(const Shared< ogl::ShaderProgram > &shader, std::array< LightShaderBlock, SHADER_MAX_LIGHTS > data)
This method sends to the used shader program the common lights data.
Definition System.cpp:720
All utilities to manage entities texture.
void setTexture(const unsigned int &id, const ogl::Texture &texture)
Sets the texture for the given entity.
Definition System.cpp:440
void setMeshReflective(const unsigned int &id, const bool &val)
Sets the reflectiveness of an entity.
Definition System.cpp:471
std::string getTexturePath(const unsigned int &id)
Retrieves the entity texture path.
Definition System.cpp:447
ogl::Texture getTexture(const unsigned int &id)
Retrieves the texture of the given entity.
Definition System.cpp:434
void updateTexturePath(const unsigned int &id, const std::string &path)
Updates the entity texture path.
Definition System.cpp:453
bool isMeshReflective(const unsigned int &id)
This method sets the reflection of an entity. If the entity is reflective it will reflect the skybox ...
Definition System.cpp:465
It contains all the ECS systems.
Data structure for instanced mesh rendering. It stores for each primitive its color and model matrix.
Definition System.hpp:15
std::vector< unsigned int > spheresIds
spheres id
Definition System.hpp:19
std::vector< glm::mat4 > spheresModel
spheres model matrix
Definition System.hpp:23
std::vector< glm::vec4 > spheresColor
spheres color
Definition System.hpp:21
unsigned int nspheres
spheres counter
Definition System.hpp:17