Optimize C++ compilation time

This commit is contained in:
Wojtek Figat
2021-04-30 16:27:57 +02:00
parent 05ba9b8d45
commit 0e75dba142
222 changed files with 1095 additions and 1506 deletions

View File

@@ -5,6 +5,8 @@
#include "Engine/Content/Assets/Material.h"
#include "Engine/Content/Assets/Model.h"
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Level/Scene/Scene.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Serialization/MemoryReadStream.h"
@@ -131,6 +133,11 @@ namespace
}
}
bool Mesh::HasVertexColors() const
{
return _vertexBuffers[2] != nullptr && _vertexBuffers[2]->IsAllocated();
}
bool Mesh::UpdateMesh(uint32 vertexCount, uint32 triangleCount, VB0ElementType* vb0, VB1ElementType* vb1, VB2ElementType* vb2, void* ib, bool use16BitIndices)
{
auto model = (Model*)_model;

View File

@@ -3,15 +3,16 @@
#pragma once
#include "MeshBase.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Graphics/RenderTask.h"
#include "ModelInstanceEntry.h"
#include "Config.h"
#include "Types.h"
#include "Engine/Level/Types.h"
#if USE_PRECISE_MESH_INTERSECTS
#include "CollisionProxy.h"
#endif
struct GeometryDrawStateData;
class Lightmap;
class GPUBuffer;
/// <summary>
@@ -21,7 +22,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API Mesh : public MeshBase
{
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
protected:
int32 _index;
int32 _lodIndex;
bool _hasLightmapUVs;
@@ -32,7 +32,6 @@ protected:
#endif
public:
Mesh(const Mesh& other)
: Mesh()
{
@@ -47,7 +46,6 @@ public:
~Mesh();
public:
/// <summary>
/// Gets the model owning this mesh.
/// </summary>
@@ -104,10 +102,7 @@ public:
/// Determines whether this mesh has a vertex colors buffer.
/// </summary>
/// <returns>True if this mesh has a vertex colors buffers.</returns>
API_PROPERTY() FORCE_INLINE bool HasVertexColors() const
{
return _vertexBuffers[2] != nullptr && _vertexBuffers[2]->IsAllocated();
}
API_PROPERTY() bool HasVertexColors() const;
/// <summary>
/// Determines whether this mesh contains valid lightmap texture coordinates data.
@@ -132,7 +127,6 @@ public:
#endif
public:
/// <summary>
/// Updates the model mesh (used by the virtual models created with Init rather than Load).
/// </summary>
@@ -211,7 +205,6 @@ public:
bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, Vector3* vertices, uint32* triangles, Vector3* normals = nullptr, Vector3* tangents = nullptr, Vector2* uvs = nullptr, Color32* colors = nullptr);
public:
/// <summary>
/// Updates the model mesh index buffer (used by the virtual models created with Init rather than Load).
/// </summary>
@@ -244,7 +237,6 @@ public:
bool UpdateTriangles(uint32 triangleCount, void* ib, bool use16BitIndices);
public:
/// <summary>
/// Initializes instance of the <see cref="Mesh"/> class.
/// </summary>
@@ -276,7 +268,6 @@ public:
void Unload();
public:
/// <summary>
/// Determines if there is an intersection between the mesh and a ray in given world
/// </summary>
@@ -297,7 +288,6 @@ public:
}
public:
/// <summary>
/// Gets the draw call geometry for this mesh. Sets the index and vertex buffers.
/// </summary>
@@ -397,14 +387,12 @@ public:
void Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const;
public:
// [MeshBase]
bool DownloadDataGPU(MeshBufferType type, BytesContainer& result) const override;
Task* DownloadDataGPUAsync(MeshBufferType type, BytesContainer& result) const override;
bool DownloadDataCPU(MeshBufferType type, BytesContainer& result) const override;
private:
// Internal bindings
API_FUNCTION(NoProxy) ScriptingObject* GetParentModel();
API_FUNCTION(NoProxy) bool UpdateMeshInt(int32 vertexCount, int32 triangleCount, MonoArray* verticesObj, MonoArray* trianglesObj, MonoArray* normalsObj, MonoArray* tangentsObj, MonoArray* uvObj, MonoArray* colorsObj);

View File

@@ -6,6 +6,7 @@
#include "Engine/Core/Log.h"
#include "Engine/Core/Utilities.h"
#include "Engine/Core/Types/DateTime.h"
#include "Engine/Core/Types/TimeSpan.h"
#include "Engine/Core/Collections/BitArray.h"
#include "Engine/Tools/ModelTool/ModelTool.h"
#include "Engine/Tools/ModelTool/VertexTriangleAdjacency.h"

View File

@@ -4,6 +4,8 @@
#include "ModelInstanceEntry.h"
#include "Engine/Content/Assets/Material.h"
#include "Engine/Content/Assets/SkinnedModel.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Level/Scene/Scene.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Serialization/MemoryReadStream.h"

View File

@@ -3,13 +3,13 @@
#pragma once
#include "MeshBase.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Graphics/RenderTask.h"
#include "ModelInstanceEntry.h"
#include "Types.h"
#include "BlendShape.h"
struct GeometryDrawStateData;
struct RenderContext;
class GPUBuffer;
class SkinnedMeshDrawData;
/// <summary>
/// Represents part of the skinned model that is made of vertices and can be rendered using custom material, transformation and skeleton bones hierarchy.

View File

@@ -5,6 +5,12 @@
#include "Engine/Content/Assets/Model.h"
#include "Engine/Serialization/MemoryReadStream.h"
bool SkinnedModelLOD::HasAnyMeshInitialized() const
{
// Note: we initialize all meshes at once so the last one can be used to check it.
return Meshes.HasItems() && Meshes.Last().IsInitialized();
}
bool SkinnedModelLOD::Load(MemoryReadStream& stream)
{
// Load LOD for each mesh

View File

@@ -33,12 +33,7 @@ public:
/// <summary>
/// Determines whether any mesh has been initialized.
/// </summary>
/// <returns>True if any mesh has been initialized, otherwise false.</returns>
FORCE_INLINE bool HasAnyMeshInitialized() const
{
// Note: we initialize all meshes at once so the last one can be used to check it.
return Meshes.HasItems() && Meshes.Last().IsInitialized();
}
bool HasAnyMeshInitialized() const;
public: