-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
EPICGameGuy
committed
Dec 4, 2023
1 parent
a3f67a7
commit 9a3b361
Showing
19 changed files
with
377 additions
and
186 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# This script downloads everything and compiles it on ubuntu | ||
|
||
sudo apt install build-essential binutils-dev git cmake genisoimage libassimp-dev | ||
#!/usr/bin/bash | ||
|
||
# sudo apt install build-essential binutils-dev git cmake genisoimage libassimp-dev | ||
|
||
make deploy_iso -j16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,4 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
#include <unordered_set> | ||
|
||
#include "egg/filesystem.hpp" | ||
#include "egg/hashmap.hpp" | ||
#include "egg/offset_pointer.hpp" | ||
|
||
namespace Asset | ||
{ | ||
// Reference to an on-disk asset. This is just a hash of it's ISO 9660 8.3 | ||
// filepath (see Filesystem::convert_to_iso_path) | ||
struct Reference | ||
{ | ||
uint32_t hash; | ||
|
||
constexpr Reference() | ||
: hash(0) | ||
{ | ||
} | ||
|
||
constexpr Reference(uint32_t in_hash) | ||
: hash(in_hash) | ||
{ | ||
} | ||
|
||
constexpr Reference(const Filesystem::Path& path) | ||
: hash(0) | ||
{ | ||
hash = path.hash(); | ||
} | ||
|
||
constexpr Reference(const char* path, bool convert_to_iso_path = true) | ||
: hash(0) | ||
{ | ||
hash = Filesystem::Path(path, convert_to_iso_path).hash(); | ||
} | ||
|
||
constexpr bool operator==(const Reference& other) const | ||
{ | ||
return hash == other.hash; | ||
} | ||
}; | ||
|
||
constexpr size_t asset_hashmap_size = 128; | ||
using AssetHashMapT = HashMap<asset_hashmap_size, Reference, Filesystem::Path>; | ||
|
||
// Note: this will crash if the path does not exist | ||
const Filesystem::Path& lookup_path(Reference reference); | ||
|
||
// Returns true if it succesfully added the path | ||
bool add_path(Reference reference, const Filesystem::Path& path); | ||
|
||
// Returns true if it succesfully added the path | ||
// This version hashes the path before adding it | ||
bool add_path(const Filesystem::Path& path); | ||
|
||
bool add_path(Reference reference, const char* path, bool convert_path); | ||
|
||
// Copies the passed in asset table bytes to the global asset table | ||
// Checks to make sure length matches the length of the global asset table | ||
void load_asset_table(std::byte* bytes, size_t length); | ||
|
||
// Writes out the global asset table | ||
void serialize_asset_table(std::vector<std::byte>& out_bytes); | ||
|
||
AssetHashMapT& get_asset_table(); | ||
} // namespace Asset | ||
|
||
template <> | ||
struct std::hash<Asset::Reference> | ||
{ | ||
std::size_t operator()(const Asset::Reference& k) const | ||
{ | ||
return k.hash; | ||
} | ||
}; | ||
|
||
// Overload this to add reference collection to your own types | ||
static void collect_references(std::unordered_set<Asset::Reference>& references, const ::OffsetArray<Asset::Reference>& arr) | ||
{ | ||
for (Asset::Reference ref : arr) | ||
{ | ||
references.insert(ref); | ||
} | ||
} | ||
// Asset namespace was moved to filesystem | ||
#include "egg/filesystem.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
#pragma once | ||
|
||
#include "renderer/renderable.hpp" | ||
#include "utils/debuggable.hpp" | ||
#include "components/transform_component.hpp" | ||
#include "components/collision_component.hpp" | ||
#include "egg/filesystem.hpp" | ||
|
||
class MeshObject: public Renderable | ||
class MeshObject: public Renderable, public Debuggable | ||
{ | ||
public: | ||
MeshObject(); | ||
MeshObject(const Filesystem::Path& mesh_path); | ||
MeshObject(Asset::Reference mesh_reference); | ||
virtual void on_gs_init() override; | ||
virtual void render(const GS::GSState& gs_state) override; | ||
TransformComponent transform; | ||
class Mesh* mesh; | ||
|
||
virtual const char* get_name() const override; | ||
virtual const char* get_type_name() const { return typeid(MeshObject).name(); } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.