ObjLoading/ObjWriting: Initial skeleton for loading and writing obj files

This commit is contained in:
Jan
2019-12-29 16:40:03 +01:00
parent a0d4e87b8e
commit af55c202cf
39 changed files with 689 additions and 2 deletions

View File

View File

View File

View File

View File

View File

View File

View File

@ -0,0 +1,11 @@
#pragma once
#include <string>
class IObjContainer
{
public:
virtual ~IObjContainer() = default;
virtual const std::string& GetName() = 0;
};

View File

@ -0,0 +1,60 @@
#pragma once
#include <cstdint>
typedef uint32_t IPakHash;
struct IPakHeader
{
uint32_t magic;
uint32_t version;
uint32_t size;
uint32_t sectionCount;
};
struct IPakSection
{
uint32_t type;
uint32_t offset;
uint32_t size;
uint32_t itemCount;
};
union IPakIndexEntryKey
{
struct
{
IPakHash nameHash;
IPakHash dataHash;
};
uint64_t combinedKey;
};
struct IPakIndexEntry
{
IPakIndexEntryKey key;
uint32_t offset;
uint32_t size;
};
struct IPakDataChunkHeader
{
union
{
uint32_t countAndOffset;
struct
{
uint32_t offset : 24;
uint32_t count : 8;
};
};
union
{
uint32_t commands[31];
struct
{
uint32_t size : 24;
uint32_t compressed : 8;
}_commands[31];
};
};

View File

@ -0,0 +1,16 @@
#include "ObjContainerReferenceable.h"
void ObjContainerReferenceable::AddReference(Zone* referencer)
{
m_references.insert(referencer);
}
bool ObjContainerReferenceable::RemoveReference(Zone* zone)
{
return m_references.erase(zone) > 0;
}
bool ObjContainerReferenceable::IsReferenced() const
{
return !m_references.empty();
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "IObjContainer.h"
#include "Zone/Zone.h"
#include <set>
class ObjContainerReferenceable : public IObjContainer
{
std::set<Zone*> m_references;
public:
void AddReference(Zone* referencer);
bool RemoveReference(Zone* zone);
bool IsReferenced() const;
};