Add BoxBrush::SetMaterial
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -153,6 +153,13 @@ public:
|
||||
/// <param name="surfaces">Surfaces</param>
|
||||
void GetSurfaces(CSG::Surface surfaces[6]);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the brush surface material.
|
||||
/// </summary>
|
||||
/// <param name="surfaceIndex">The brush surface index.</param>
|
||||
/// <param name="material">The material.</param>
|
||||
API_FUNCTION() void SetMaterial(int32 surfaceIndex, MaterialBase* material);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
@@ -169,7 +176,7 @@ public:
|
||||
/// Otherwise performs simple <see cref="BoundingBox"/> vs <see cref="Ray"/> test.
|
||||
/// For more efficient collisions detection and ray casting use physics.
|
||||
/// </summary>
|
||||
/// <param name="surfaceIndex">The brush surface index..</param>
|
||||
/// <param name="surfaceIndex">The brush surface index.</param>
|
||||
/// <param name="ray">The ray to test.</param>
|
||||
/// <param name="distance">When the method completes and returns true, contains the distance of the intersection (if any valid).</param>
|
||||
/// <param name="normal">When the method completes, contains the intersection surface normal vector (if any valid).</param>
|
||||
@@ -179,7 +186,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the brush surface triangles array (group by 3 vertices).
|
||||
/// </summary>
|
||||
/// <param name="surfaceIndex">The brush surface index..</param>
|
||||
/// <param name="surfaceIndex">The brush surface index.</param>
|
||||
/// <param name="outputData">The output vertices buffer with triangles or empty if no data loaded.</param>
|
||||
API_FUNCTION() void GetVertices(int32 surfaceIndex, API_PARAM(Out) Array<Vector3>& outputData) const;
|
||||
|
||||
@@ -204,32 +211,12 @@ public:
|
||||
#endif
|
||||
|
||||
// [CSG::Brush]
|
||||
Scene* GetBrushScene() const override
|
||||
{
|
||||
return GetScene();
|
||||
}
|
||||
|
||||
Guid GetBrushID() const override
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
bool CanUseCSG() const override
|
||||
{
|
||||
return IsActiveInHierarchy();
|
||||
}
|
||||
|
||||
CSG::Mode GetBrushMode() const override
|
||||
{
|
||||
return _mode;
|
||||
}
|
||||
|
||||
Scene* GetBrushScene() const override;
|
||||
Guid GetBrushID() const override;
|
||||
bool CanUseCSG() const override;
|
||||
CSG::Mode GetBrushMode() const override;
|
||||
void GetSurfaces(Array<CSG::Surface>& surfaces) override;
|
||||
|
||||
int32 GetSurfacesCount() override
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
int32 GetSurfacesCount() override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user