Add BoxBrush::SetMaterial

This commit is contained in:
Wojtek Figat
2021-04-12 19:07:18 +02:00
parent b2d041c9b3
commit 3bfeb1db76
2 changed files with 47 additions and 28 deletions

View File

@@ -128,6 +128,13 @@ void BoxBrush::GetSurfaces(CSG::Surface surfaces[6])
}
}
void BoxBrush::SetMaterial(int32 surfaceIndex, MaterialBase* material)
{
CHECK(Math::IsInRange(surfaceIndex, 0, 5));
Surfaces[surfaceIndex].Material = material;
OnBrushModified();
}
bool BoxBrush::Intersects(int32 surfaceIndex, const Ray& ray, float& distance, Vector3& normal) const
{
distance = MAX_float;
@@ -232,6 +239,26 @@ void BoxBrush::OnDebugDrawSelected()
#endif
Scene* BoxBrush::GetBrushScene() const
{
return GetScene();
}
Guid BoxBrush::GetBrushID() const
{
return GetID();
}
bool BoxBrush::CanUseCSG() const
{
return IsActiveInHierarchy();
}
CSG::Mode BoxBrush::GetBrushMode() const
{
return _mode;
}
void BoxBrush::GetSurfaces(Array<CSG::Surface>& surfaces)
{
surfaces.Clear();
@@ -240,6 +267,11 @@ void BoxBrush::GetSurfaces(Array<CSG::Surface>& surfaces)
GetSurfaces(surfaces.Get());
}
int32 BoxBrush::GetSurfacesCount()
{
return 6;
}
void BoxBrush::OnTransformChanged()
{
// Base
@@ -272,7 +304,7 @@ void BoxBrush::OnParentChanged()
{
// Base
Actor::OnParentChanged();
if (!IsDuringPlay())
return;