Implement DownloadDataCPU for Mesh and add result entries count
This commit is contained in:
@@ -22,6 +22,7 @@ API_CLASS(NoSpawn) class FLAXENGINE_API Mesh : public MeshBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
|
||||
protected:
|
||||
|
||||
int32 _index;
|
||||
int32 _lodIndex;
|
||||
bool _hasLightmapUVs;
|
||||
@@ -30,8 +31,12 @@ protected:
|
||||
#if USE_PRECISE_MESH_INTERSECTS
|
||||
CollisionProxy _collisionProxy;
|
||||
#endif
|
||||
mutable Array<byte> _cachedVertexBuffer[3];
|
||||
mutable Array<byte> _cachedIndexBuffer;
|
||||
mutable int32 _cachedIndexBufferCount;
|
||||
|
||||
public:
|
||||
|
||||
Mesh(const Mesh& other)
|
||||
: Mesh()
|
||||
{
|
||||
@@ -46,6 +51,7 @@ public:
|
||||
~Mesh();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model owning this mesh.
|
||||
/// </summary>
|
||||
@@ -92,7 +98,6 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether this mesh is initialized (has vertex and index buffers initialized).
|
||||
/// </summary>
|
||||
/// <returns>True if this instance is initialized, otherwise false.</returns>
|
||||
FORCE_INLINE bool IsInitialized() const
|
||||
{
|
||||
return _vertexBuffers[0] != nullptr;
|
||||
@@ -101,13 +106,11 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether this mesh has a vertex colors buffer.
|
||||
/// </summary>
|
||||
/// <returns>True if this mesh has a vertex colors buffers.</returns>
|
||||
API_PROPERTY() bool HasVertexColors() const;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this mesh contains valid lightmap texture coordinates data.
|
||||
/// </summary>
|
||||
/// <returns>True if this mesh has a vertex colors buffers.</returns>
|
||||
API_PROPERTY() FORCE_INLINE bool HasLightmapUVs() const
|
||||
{
|
||||
return _hasLightmapUVs;
|
||||
@@ -118,7 +121,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the collision proxy used by the mesh.
|
||||
/// </summary>
|
||||
/// <returns>The collisions proxy container object reference.</returns>
|
||||
FORCE_INLINE const CollisionProxy& GetCollisionProxy() const
|
||||
{
|
||||
return _collisionProxy;
|
||||
@@ -127,6 +129,7 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -205,6 +208,7 @@ 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>
|
||||
@@ -237,6 +241,7 @@ public:
|
||||
bool UpdateTriangles(uint32 triangleCount, void* ib, bool use16BitIndices);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes instance of the <see cref="Mesh"/> class.
|
||||
/// </summary>
|
||||
@@ -268,6 +273,7 @@ public:
|
||||
void Unload();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the mesh and a ray in given world
|
||||
/// </summary>
|
||||
@@ -288,6 +294,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the draw call geometry for this mesh. Sets the index and vertex buffers.
|
||||
/// </summary>
|
||||
@@ -387,12 +394,14 @@ 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;
|
||||
bool DownloadDataCPU(MeshBufferType type, BytesContainer& result, int32& count) 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);
|
||||
|
||||
Reference in New Issue
Block a user