mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-24 07:11:13 +00:00
Adding a onStart onStop
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "ShaderComponent.hpp"
|
||||
|
||||
#include <utility>
|
||||
#include <Component/Renderer/Drawable3DComponent.hpp>
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
@@ -20,7 +21,6 @@ namespace BBM
|
||||
|
||||
ShaderComponent::ShaderComponent(WAL::Entity &entity, const std::string &fragmentFilePath, const std::string &vertexFilePath)
|
||||
: WAL::Component(entity),
|
||||
_refEntity(entity),
|
||||
_shader(vertexFilePath, fragmentFilePath),
|
||||
_fragmentFilePath(fragmentFilePath),
|
||||
_vertexFilePath(vertexFilePath)
|
||||
@@ -42,6 +42,14 @@ namespace BBM
|
||||
{
|
||||
}
|
||||
|
||||
void ShaderComponentModel::onStart()
|
||||
{
|
||||
auto &drawable = this->_entity.getComponent<Drawable3DComponent>();
|
||||
this->model = dynamic_cast<RAY::Drawables::Drawables3D::Model *>(drawable.drawable.get());
|
||||
if (!this->model)
|
||||
throw std::runtime_error("No model available with a shader model component. This is unsupported.");
|
||||
}
|
||||
|
||||
ShaderComponentDrawable2D::ShaderComponentDrawable2D(WAL::Entity &entity, std::string fragmentFilePath, std::string vertexFilePath)
|
||||
: ShaderComponent(entity, std::move(fragmentFilePath), std::move(vertexFilePath))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user