Merge branch 'develop' of github.com:AnonymusRaccoon/Bomberman into bonus

# Conflicts:
#	CMakeLists.txt
#	sources/Map/Map.cpp
This commit is contained in:
Clément Le Bihan
2021-06-10 12:29:58 +02:00
153 changed files with 6063 additions and 159 deletions

View File

@@ -10,21 +10,23 @@
#include <unordered_map>
namespace RAY::Drawables::Drawables3D {
namespace RAY::Drawables::Drawables3D
{
RAY::Cache<::Model> Model::_modelsCache(LoadModel, UnloadModel);
Model::Model(const std::string &filename,
std::optional<std::pair<MaterialType, std::string>> texture,
const RAY::Vector3 &scale,
const RAY::Vector3 &position,
const RAY::Vector3 &rotationAxis,
float rotationAngle, bool lonely)
bool lonely,
std::optional<std::pair<MaterialType, std::string>> texture,
const RAY::Vector3 &scale,
const RAY::Vector3 &position,
const RAY::Vector3 &rotationAxis,
float rotationAngle)
: ADrawable3D(position, WHITE),
_model(_modelsCache.fetch(filename, lonely)),
_rotationAxis(rotationAxis),
_rotationAngle(rotationAngle),
_scale(scale)
_model(_modelsCache.fetch(filename, lonely)),
_rotationAxis(rotationAxis),
_rotationAngle(rotationAngle),
_scale(scale)
{
if (texture.has_value())
this->setTextureToMaterial(texture->first, texture->second);
@@ -32,7 +34,7 @@ namespace RAY::Drawables::Drawables3D {
Model::Model(const Mesh &mesh)
: ADrawable3D({0, 0, 0}, WHITE),
_model(std::make_shared<::Model>(LoadModelFromMesh(mesh)))
_model(std::make_shared<::Model>(LoadModelFromMesh(mesh)))
{
}
@@ -54,8 +56,8 @@ namespace RAY::Drawables::Drawables3D {
{
this->_textureList.emplace(materialType, texturePath);
SetMaterialTexture(&this->_model->materials[materialType],
materialType,
this->_textureList.at(materialType));
materialType,
this->_textureList.at(materialType));
return true;
}
@@ -104,6 +106,22 @@ namespace RAY::Drawables::Drawables3D {
void Model::drawOn(RAY::Window &)
{
DrawModelEx(*this->_model, this->_position, this->_rotationAxis, this->_rotationAngle, this->_scale, this->_color);
DrawModelEx(*this->_model,
this->_position,
this->_rotationAxis,
this->_rotationAngle,
this->_scale,
this->_color);
}
void Model::setShader(const RAY::Shader &shader)
{
this->_originalShader = this->_model->materials[0].shader;
this->_model->materials[0].shader = *shader.getShaderPtr();
}
void Model::resetShader()
{
this->_model->materials[0].shader = this->_originalShader;
}
}