Format more engine code

This commit is contained in:
Wojtek Figat
2022-06-14 20:17:00 +02:00
parent 7c923198e0
commit b49e5e9984
219 changed files with 348 additions and 1236 deletions

View File

@@ -200,7 +200,7 @@ void Foliage::DrawCluster(RenderContext& renderContext, FoliageCluster* cluster,
instance.DrawState.PrevLOD = lodIndex;
}
}
// Check if there was a gap between frames in drawing this model instance
// Check if there was a gap between frames in drawing this model instance
else if (modelFrame < frame || instance.DrawState.PrevLOD == -1)
{
// Reset state
@@ -846,7 +846,7 @@ bool Foliage::Intersects(const Ray& ray, Real& distance, Vector3& normal, int32&
void Foliage::Draw(RenderContext& renderContext)
{
if (renderContext.View.Pass == DrawPass::GlobalSDF)
return; // TODO: Foliage rendering to Global SDF
return; // TODO: Foliage rendering to Global SDF
if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas)
return; // Not supported
if (Instances.IsEmpty())

View File

@@ -14,14 +14,12 @@
/// <seealso cref="Actor" />
API_CLASS() class FLAXENGINE_API Foliage final : public Actor
{
DECLARE_SCENE_OBJECT(Foliage);
DECLARE_SCENE_OBJECT(Foliage);
private:
bool _disableFoliageTypeEvents;
int32 _sceneRenderingKey = -1;
public:
/// <summary>
/// The allocated foliage instances. It's read-only.
/// </summary>
@@ -46,7 +44,6 @@ public:
Array<FoliageType> FoliageTypes;
public:
/// <summary>
/// Gets the total amount of the instanced of foliage.
/// </summary>
@@ -138,7 +135,6 @@ public:
API_FUNCTION() void UpdateCullDistance();
public:
/// <summary>
/// Gets the global density scale for all foliage instances. The default value is 1. Use values from range 0-1. Lower values decrease amount of foliage instances in-game. Use it to tweak game performance for slower devices.
/// </summary>
@@ -150,7 +146,6 @@ public:
API_PROPERTY() static void SetGlobalDensityScale(float value);
private:
void AddToCluster(ChunkedArray<FoliageCluster, FOLIAGE_CLUSTER_CHUNKS_SIZE>& clusters, FoliageCluster* cluster, FoliageInstance& instance);
#if !FOLIAGE_USE_SINGLE_QUAD_TREE && FOLIAGE_USE_DRAW_CALLS_BATCHING
struct DrawKey
@@ -182,7 +177,6 @@ private:
#endif
public:
/// <summary>
/// Determines if there is an intersection between the current object or any it's child and a ray.
/// </summary>
@@ -194,7 +188,6 @@ public:
API_FUNCTION() bool Intersects(API_PARAM(Ref) const Ray& ray, API_PARAM(Out) Real& distance, API_PARAM(Out) Vector3& normal, API_PARAM(Out) int32& instanceIndex);
public:
// [Actor]
void Draw(RenderContext& renderContext) override;
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
@@ -203,7 +196,6 @@ public:
void OnLayerChanged() override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -13,7 +13,6 @@
class FLAXENGINE_API FoliageCluster
{
public:
/// <summary>
/// The cluster bounds (in world space). Made of subdivided parent node in quad-tree.
/// </summary>
@@ -45,7 +44,6 @@ public:
Array<FoliageInstance*, FixedAllocation<FOLIAGE_CLUSTER_CAPACITY>> Instances;
public:
/// <summary>
/// Initializes this instance.
/// </summary>

View File

@@ -12,7 +12,7 @@
/// </summary>
API_STRUCT(NoPod) struct FLAXENGINE_API FoliageInstance
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(FoliageInstance);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(FoliageInstance);
/// <summary>
/// The local-space transformation of the mesh relative to the foliage actor.
@@ -55,7 +55,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(FoliageInstance);
LightmapEntry Lightmap;
public:
bool operator==(const FoliageInstance& v) const
{
return Type == v.Type && Math::NearEqual(Random, v.Random) && Transform == v.Transform;

View File

@@ -43,16 +43,14 @@ API_ENUM() enum class FoliageScalingModes
/// </summary>
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API FoliageType : public ScriptingObject, public ISerializable
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(FoliageType);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(FoliageType);
friend Foliage;
private:
int8 _isReady : 1;
int8 _canDraw : 1; // Cached and used internally by foliage actor
DrawPass _drawModes; // Cached mask during rendering
public:
/// <summary>
/// Initializes a new instance of the <see cref="FoliageType"/> class.
/// </summary>
@@ -67,7 +65,6 @@ public:
FoliageType& operator=(const FoliageType& other);
public:
/// <summary>
/// The parent foliage actor.
/// </summary>
@@ -87,7 +84,7 @@ public:
/// The shared model instance entries.
/// </summary>
ModelInstanceEntries Entries;
#if !FOLIAGE_USE_SINGLE_QUAD_TREE
/// <summary>
/// The root cluster. Contains all the instances and it's the starting point of the quad-tree hierarchy. Null if no foliage added. It's read-only.
@@ -101,7 +98,6 @@ public:
#endif
public:
/// <summary>
/// Gets the foliage instance type materials buffer (overrides).
/// </summary>
@@ -113,7 +109,6 @@ public:
API_PROPERTY() void SetMaterials(const Array<MaterialBase*>& value);
public:
/// <summary>
/// The per-instance cull distance.
/// </summary>
@@ -215,7 +210,6 @@ public:
API_FIELD() int8 PlacementRandomYaw : 1;
public:
/// <summary>
/// Determines whether this instance is ready (model is loaded).
/// </summary>
@@ -230,12 +224,10 @@ public:
Float3 GetRandomScale() const;
private:
void OnModelChanged();
void OnModelLoaded();
public:
// [ISerializable]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;