Merge remote-tracking branch 'refs/remotes/origin/master' into vulkan
Former-commit-id: e4243c916b02d58153bbda5cb317a75dbaba4a1c [formerly b061bd4916fdfb2ddb8f9a5321a2474427cd1e0b] Former-commit-id: 45002c1ea81078974e4c77a2f70273515c09a134
This commit is contained in:
@@ -20,12 +20,41 @@ namespace Nz
|
||||
class NAZARA_UTILITY_API OBJParser
|
||||
{
|
||||
public:
|
||||
struct FaceVertex
|
||||
{
|
||||
int normal;
|
||||
int position;
|
||||
int texCoord;
|
||||
};
|
||||
struct Face;
|
||||
struct FaceVertex;
|
||||
struct Mesh;
|
||||
|
||||
OBJParser() = default;
|
||||
~OBJParser() = default;
|
||||
|
||||
inline void Clear();
|
||||
|
||||
inline String* GetMaterials();
|
||||
inline const String* GetMaterials() const;
|
||||
inline unsigned int GetMaterialCount() const;
|
||||
inline Mesh* GetMeshes();
|
||||
inline const Mesh* GetMeshes() const;
|
||||
inline unsigned int GetMeshCount() const;
|
||||
inline const String& GetMtlLib() const;
|
||||
inline Vector3f* GetNormals();
|
||||
inline const Vector3f* GetNormals() const;
|
||||
inline unsigned int GetNormalCount() const;
|
||||
inline Vector4f* GetPositions();
|
||||
inline const Vector4f* GetPositions() const;
|
||||
inline unsigned int GetPositionCount() const;
|
||||
inline Vector3f* GetTexCoords();
|
||||
inline const Vector3f* GetTexCoords() const;
|
||||
inline unsigned int GetTexCoordCount() const;
|
||||
|
||||
bool Parse(Stream& stream, std::size_t reservedVertexCount = 100);
|
||||
|
||||
bool Save(Stream& stream) const;
|
||||
|
||||
inline String* SetMaterialCount(std::size_t materialCount);
|
||||
inline Mesh* SetMeshCount(std::size_t meshCount);
|
||||
inline Vector3f* SetNormalCount(std::size_t normalCount);
|
||||
inline Vector4f* SetPositionCount(std::size_t positionCount);
|
||||
inline Vector3f* SetTexCoordCount(std::size_t texCoordCount);
|
||||
|
||||
struct Face
|
||||
{
|
||||
@@ -33,6 +62,13 @@ namespace Nz
|
||||
std::size_t vertexCount;
|
||||
};
|
||||
|
||||
struct FaceVertex
|
||||
{
|
||||
std::size_t normal;
|
||||
std::size_t position;
|
||||
std::size_t texCoord;
|
||||
};
|
||||
|
||||
struct Mesh
|
||||
{
|
||||
std::vector<Face> faces;
|
||||
@@ -41,25 +77,6 @@ namespace Nz
|
||||
std::size_t material;
|
||||
};
|
||||
|
||||
OBJParser() = default;
|
||||
~OBJParser() = default;
|
||||
|
||||
inline const String* GetMaterials() const;
|
||||
inline unsigned int GetMaterialCount() const;
|
||||
inline const Mesh* GetMeshes() const;
|
||||
inline unsigned int GetMeshCount() const;
|
||||
inline const String& GetMtlLib() const;
|
||||
inline const Vector3f* GetNormals() const;
|
||||
inline unsigned int GetNormalCount() const;
|
||||
inline const Vector4f* GetPositions() const;
|
||||
inline unsigned int GetPositionCount() const;
|
||||
inline const Vector3f* GetTexCoords() const;
|
||||
inline unsigned int GetTexCoordCount() const;
|
||||
|
||||
bool Parse(Stream& stream, std::size_t reservedVertexCount = 100);
|
||||
|
||||
bool Save(Stream& stream) const;
|
||||
|
||||
private:
|
||||
bool Advance(bool required = true);
|
||||
template<typename T> void Emit(const T& text) const;
|
||||
|
||||
@@ -8,6 +8,20 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void OBJParser::Clear()
|
||||
{
|
||||
m_materials.clear();
|
||||
m_meshes.clear();
|
||||
m_positions.clear();
|
||||
m_normals.clear();
|
||||
m_texCoords.clear();
|
||||
}
|
||||
|
||||
inline String* OBJParser::GetMaterials()
|
||||
{
|
||||
return m_materials.data();
|
||||
}
|
||||
|
||||
inline const String* OBJParser::GetMaterials() const
|
||||
{
|
||||
return m_materials.data();
|
||||
@@ -18,6 +32,11 @@ namespace Nz
|
||||
return m_materials.size();
|
||||
}
|
||||
|
||||
inline OBJParser::Mesh* OBJParser::GetMeshes()
|
||||
{
|
||||
return m_meshes.data();
|
||||
}
|
||||
|
||||
inline const OBJParser::Mesh* OBJParser::GetMeshes() const
|
||||
{
|
||||
return m_meshes.data();
|
||||
@@ -33,6 +52,11 @@ namespace Nz
|
||||
return m_mtlLib;
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::GetNormals()
|
||||
{
|
||||
return m_normals.data();
|
||||
}
|
||||
|
||||
inline const Vector3f* OBJParser::GetNormals() const
|
||||
{
|
||||
return m_normals.data();
|
||||
@@ -43,6 +67,11 @@ namespace Nz
|
||||
return m_normals.size();
|
||||
}
|
||||
|
||||
inline Vector4f* OBJParser::GetPositions()
|
||||
{
|
||||
return m_positions.data();
|
||||
}
|
||||
|
||||
inline const Vector4f* OBJParser::GetPositions() const
|
||||
{
|
||||
return m_positions.data();
|
||||
@@ -53,6 +82,11 @@ namespace Nz
|
||||
return m_positions.size();
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::GetTexCoords()
|
||||
{
|
||||
return m_texCoords.data();
|
||||
}
|
||||
|
||||
inline const Vector3f* OBJParser::GetTexCoords() const
|
||||
{
|
||||
return m_texCoords.data();
|
||||
@@ -63,6 +97,36 @@ namespace Nz
|
||||
return m_texCoords.size();
|
||||
}
|
||||
|
||||
inline String* OBJParser::SetMaterialCount(std::size_t materialCount)
|
||||
{
|
||||
m_materials.resize(materialCount);
|
||||
return m_materials.data();
|
||||
}
|
||||
|
||||
inline OBJParser::Mesh* OBJParser::SetMeshCount(std::size_t meshCount)
|
||||
{
|
||||
m_meshes.resize(meshCount);
|
||||
return m_meshes.data();
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::SetNormalCount(std::size_t normalCount)
|
||||
{
|
||||
m_normals.resize(normalCount);
|
||||
return m_normals.data();
|
||||
}
|
||||
|
||||
inline Vector4f* OBJParser::SetPositionCount(std::size_t positionCount)
|
||||
{
|
||||
m_positions.resize(positionCount);
|
||||
return m_positions.data();
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::SetTexCoordCount(std::size_t texCoordCount)
|
||||
{
|
||||
m_texCoords.resize(texCoordCount);
|
||||
return m_texCoords.data();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void OBJParser::Emit(const T& text) const
|
||||
{
|
||||
|
||||
@@ -23,9 +23,10 @@ namespace Nz
|
||||
class NAZARA_UTILITY_API IndexMapper
|
||||
{
|
||||
public:
|
||||
IndexMapper(IndexBuffer* indexBuffer, BufferAccess access = BufferAccess_ReadWrite);
|
||||
IndexMapper(const IndexBuffer* indexBuffer, BufferAccess access = BufferAccess_ReadOnly);
|
||||
IndexMapper(const SubMesh* subMesh);
|
||||
IndexMapper(IndexBuffer* indexBuffer, BufferAccess access = BufferAccess_ReadWrite, std::size_t indexCount = 0);
|
||||
IndexMapper(SubMesh* subMesh, BufferAccess access = BufferAccess_ReadWrite);
|
||||
IndexMapper(const IndexBuffer* indexBuffer, BufferAccess access = BufferAccess_ReadOnly, std::size_t indexCount = 0);
|
||||
IndexMapper(const SubMesh* subMesh, BufferAccess access = BufferAccess_ReadOnly);
|
||||
~IndexMapper() = default;
|
||||
|
||||
UInt32 Get(unsigned int i) const;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceManager.hpp>
|
||||
#include <Nazara/Core/ResourceParameters.hpp>
|
||||
#include <Nazara/Core/ResourceSaver.hpp>
|
||||
#include <Nazara/Core/Stream.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
@@ -61,6 +62,7 @@ namespace Nz
|
||||
using MeshLoader = ResourceLoader<Mesh, MeshParams>;
|
||||
using MeshManager = ResourceManager<Mesh, MeshParams>;
|
||||
using MeshRef = ObjectRef<Mesh>;
|
||||
using MeshSaver = ResourceSaver<Mesh, MeshParams>;
|
||||
|
||||
struct MeshImpl;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Nz
|
||||
{
|
||||
public:
|
||||
TriangleIterator(PrimitiveMode primitiveMode, const IndexBuffer* indexBuffer);
|
||||
TriangleIterator(SubMesh* subMesh);
|
||||
TriangleIterator(const SubMesh* subMesh);
|
||||
~TriangleIterator() = default;
|
||||
|
||||
bool Advance();
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Nz
|
||||
public:
|
||||
VertexMapper(SubMesh* subMesh, BufferAccess access = BufferAccess_ReadWrite);
|
||||
VertexMapper(VertexBuffer* vertexBuffer, BufferAccess access = BufferAccess_ReadWrite);
|
||||
VertexMapper(const SubMesh* subMesh, BufferAccess access = BufferAccess_ReadOnly);
|
||||
VertexMapper(const VertexBuffer* vertexBuffer, BufferAccess access = BufferAccess_ReadOnly);
|
||||
~VertexMapper();
|
||||
|
||||
template<typename T> SparsePtr<T> GetComponentPtr(VertexComponent component);
|
||||
|
||||
Reference in New Issue
Block a user