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