mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
ObjLoading/ObjWriting: Initial skeleton for loading and writing obj files
This commit is contained in:
0
src/ObjCommon/Obj/GDT/GDT.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDT.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDT.h
Normal file
0
src/ObjCommon/Obj/GDT/GDT.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTEntry.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDTEntry.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDTEntry.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTEntry.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTProperty.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDTProperty.cpp
Normal file
0
src/ObjCommon/Obj/GDT/GDTProperty.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTProperty.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTPropertyType.h
Normal file
0
src/ObjCommon/Obj/GDT/GDTPropertyType.h
Normal file
11
src/ObjCommon/ObjContainer/IObjContainer.h
Normal file
11
src/ObjCommon/ObjContainer/IObjContainer.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class IObjContainer
|
||||
{
|
||||
public:
|
||||
virtual ~IObjContainer() = default;
|
||||
|
||||
virtual const std::string& GetName() = 0;
|
||||
};
|
60
src/ObjCommon/ObjContainer/IPak/IPakTypes.h
Normal file
60
src/ObjCommon/ObjContainer/IPak/IPakTypes.h
Normal 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];
|
||||
};
|
||||
};
|
16
src/ObjCommon/ObjContainer/ObjContainerReferenceable.cpp
Normal file
16
src/ObjCommon/ObjContainer/ObjContainerReferenceable.cpp
Normal 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();
|
||||
}
|
16
src/ObjCommon/ObjContainer/ObjContainerReferenceable.h
Normal file
16
src/ObjCommon/ObjContainer/ObjContainerReferenceable.h
Normal 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;
|
||||
};
|
Reference in New Issue
Block a user