Changed order of includes, uint32_t as index for Geometry::GetIndex(), minor changes
This commit is contained in:
@@ -5,19 +5,19 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "IO/FileDescription.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "IO/FileDescription.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
class ZipWriter
|
||||
{
|
||||
std::vector<uint8_t> m_centralDirs;
|
||||
int m_numFiles = 0;
|
||||
FILE *m_file;
|
||||
FILE* m_file;
|
||||
|
||||
public:
|
||||
ZipWriter(const std::filesystem::path& filePath);
|
||||
|
||||
@@ -154,11 +154,11 @@ namespace OpenVulkano::Scene
|
||||
indices = nullptr;
|
||||
}
|
||||
|
||||
uint32_t Geometry::GetIndex(int index) const
|
||||
uint32_t Geometry::GetIndex(uint32_t index) const
|
||||
{
|
||||
uint32_t result = 0;
|
||||
|
||||
if (index >= indexCount)
|
||||
if (index >= indexCount) [[unlikely]]
|
||||
throw std::out_of_range("Index is out of range");
|
||||
|
||||
if (indexType == OpenVulkano::Scene::VertexIndexType::UINT16)
|
||||
@@ -171,10 +171,6 @@ namespace OpenVulkano::Scene
|
||||
uint32_t* indices = GetIndices32();
|
||||
result = indices[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Invalid geometry index type");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenVulkano
|
||||
|
||||
Vertex* GetVertices() const { return vertices; }
|
||||
void* GetIndices() const { return indices; }
|
||||
uint32_t GetIndex(int index) const;
|
||||
uint32_t GetIndex(uint32_t index) const;
|
||||
uint16_t* GetIndices16() const { return static_cast<uint16_t*>(indices); }
|
||||
uint32_t* GetIndices32() const { return static_cast<uint32_t*>(indices); }
|
||||
uint32_t GetIndexCount() const { return indexCount; }
|
||||
|
||||
@@ -11,18 +11,9 @@
|
||||
#include "Scene/ObjEncoder.hpp"
|
||||
#include "IO/Archive/ArchiveWriter.hpp"
|
||||
#include "IO/Archive/ZipWriter.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <fmt/core.h>
|
||||
#include <tinyusdz.hh>
|
||||
#include <pprinter.hh>
|
||||
#include <prim-pprint.hh>
|
||||
#include <value-pprint.hh>
|
||||
#include <tiny-format.hh>
|
||||
#include <tiny-variant.hh>
|
||||
#include <usda-reader.hh>
|
||||
#include <usda-writer.hh>
|
||||
#include <usdc-reader.hh>
|
||||
#include <usdc-writer.hh>
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
@@ -48,7 +39,7 @@ namespace OpenVulkano::Scene
|
||||
file.close();
|
||||
}
|
||||
|
||||
void MeshWriter::WriteObjAsZip(Geometry* geometry, const std::string& zipPath, const std::string& texturePath)
|
||||
void MeshWriter::WriteObjAsZip(Geometry* geometry, const std::string& texturePath, const std::string& zipPath)
|
||||
{
|
||||
OpenVulkano::ArchiveWriter zipWriter(zipPath.c_str());
|
||||
|
||||
@@ -68,7 +59,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
}
|
||||
|
||||
void MeshWriter::WriteAsUSDZ(Geometry* geometry, const std::string& usdzPath, const std::string& texturePath)
|
||||
void MeshWriter::WriteAsUSDZ(Geometry* geometry, const std::string& texturePath, const std::string& usdzPath)
|
||||
{
|
||||
OpenVulkano::ZipWriter zipWriter(usdzPath);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenVulkano::Scene
|
||||
public:
|
||||
static void WriteAsOBJ(Geometry* geometry, const std::string& filePath);
|
||||
static void WriteAsUSD(Geometry* geometry, const std::string& filePath);
|
||||
static void WriteObjAsZip(Geometry* geometry, const std::string& zipPath, const std::string& texturePath);
|
||||
static void WriteAsUSDZ(Geometry* geometry, const std::string& usdzPath, const std::string& texturePath);
|
||||
static void WriteObjAsZip(Geometry* geometry, const std::string& texturePath, const std::string& zipPath);
|
||||
static void WriteAsUSDZ(Geometry* geometry, const std::string& texturePath, const std::string& usdzPath);
|
||||
};
|
||||
}
|
||||
@@ -5,11 +5,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Scene/Geometry.hpp"
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fmt/core.h>
|
||||
#include "Scene/Geometry.hpp"
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Scene/Geometry.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
std::string GetUsdContents(OpenVulkano::Scene::Geometry* geometry, const std::string texturePath = "")
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#include "Base/Utils.hpp"
|
||||
#include "IO/Archive/ZipWriter.hpp"
|
||||
#include "IO/AppFolders.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
using namespace OpenVulkano;
|
||||
|
||||
TEST_CASE("Empty zip file", "[ZipWriter]")
|
||||
|
||||
Reference in New Issue
Block a user