adding red color for collisions boxes

This commit is contained in:
Clément Le Bihan
2021-06-14 14:41:04 +02:00
parent a36ab11b6d
commit a229452dc4
4 changed files with 22 additions and 4 deletions

View File

@@ -39,4 +39,15 @@ namespace RAY::Drawables
void ADrawable3D::drawWiresOn(RAY::Window &)
{}
const RAY::Color &ADrawable3D::getDebugColor(void) const
{
return this->_debugColor;
}
ADrawable3D &ADrawable3D::setDebugColor(const Color &debugColor)
{
this->_debugColor = debugColor;
return *this;
}
}

View File

@@ -39,6 +39,12 @@ namespace RAY::Drawables {
//! @brief set color
ADrawable3D &setColor(const RAY::Color &color);
//! @return the debug color of the ADrawable
const RAY::Color &getDebugColor(void) const;
//! @brief set the debug color
ADrawable3D &setDebugColor(const RAY::Color &debugColor);
//! @return the position of the ADrawable
virtual const RAY::Vector3 &getPosition(void) const;

View File

@@ -165,7 +165,7 @@ namespace BBM
for (int i = 0; i < width + 1; i++) {
for (int j = 0; j < height + 1; j++) {
if (map[std::make_tuple(i, 0, j)] != HOLE && map[std::make_tuple(i, -1, j)] != BUMPER)
scene->addEntity("Unbreakable Wall")
scene->addEntity("Floor")
.addComponent<PositionComponent>(Vector3f(i, -1, j))
.addComponent<Drawable3DComponent, RAY3D::Model>(floorObj, false,
std::make_pair(MAP_DIFFUSE, floorPng));

View File

@@ -33,6 +33,7 @@ namespace BBM
//draws hitbox
if (dimsComponent) {
RAY::Drawables::Drawables3D::Cube boundingBox(posComponent.position, dimsComponent->bound, WHITE);
boundingBox.setDebugColor(RED);
boundingBox.drawWiresOn(this->_window);
}
//draws models contours
@@ -52,11 +53,11 @@ namespace BBM
if (modelShader)
modelShader->model->setShader(modelShader->getShader());
drawable.drawable->setPosition(pos.position);
if (this->_debugMode)
this->drawBoundingBox(entity, pos, drawable);
drawable.drawable->drawOn(this->_window);
if (modelShader)
modelShader->model->resetShader();
if (this->_debugMode)
this->drawBoundingBox(entity, pos, drawable);
}
this->_window.unuseCamera();