Skip to content

Commit

Permalink
Backing Name to CamelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
Daethalus committed May 16, 2024
1 parent ad46222 commit c68dbd8
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 56 deletions.
26 changes: 13 additions & 13 deletions Editor/Source/Fyrion/Editor/Scene/SceneEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace Fyrion
u64 count{};

ResourceObject object = Repository::Read(rid);
if (object.Has(SceneObjectAsset::children))
if (object.Has(SceneObjectAsset::Children))
{
Array<RID> children = object.GetSubObjectSetAsArray(SceneObjectAsset::children);
Array<RID> children = object.GetSubObjectSetAsArray(SceneObjectAsset::Children);
count = children.Size();

for (RID child : children)
Expand Down Expand Up @@ -63,16 +63,16 @@ namespace Fyrion
ResourceObject root = Repository::Write(m_rootObject);

ResourceObject write = Repository::Write(object);
write[SceneObjectAsset::name] = "Object " + ToString(m_count++);
write[SceneObjectAsset::Name] = "Object " + ToString(m_count++);
write.Commit();

Repository::SetUUID(object, UUID::RandomUUID());

Array<RID> children = root[SceneObjectAsset::childrenSort].Value<Array<RID>>();
Array<RID> children = root[SceneObjectAsset::ChildrenSort].Value<Array<RID>>();
children.EmplaceBack(object);
root[SceneObjectAsset::childrenSort] = children;
root[SceneObjectAsset::ChildrenSort] = children;

root.AddToSubObjectSet(SceneObjectAsset::children, object);
root.AddToSubObjectSet(SceneObjectAsset::Children, object);
root.Commit();
}
else
Expand All @@ -89,15 +89,15 @@ namespace Fyrion
m_lastSelectedRid = object;

ResourceObject write = Repository::Write(object);
write[SceneObjectAsset::name] = "Object " + ToString(m_count++);
write[SceneObjectAsset::Name] = "Object " + ToString(m_count++);
write.Commit();

Repository::SetUUID(object, UUID::RandomUUID());

Array<RID> children = writeParent[SceneObjectAsset::childrenSort].Value<Array<RID>>();
Array<RID> children = writeParent[SceneObjectAsset::ChildrenSort].Value<Array<RID>>();
children.EmplaceBack(object);
writeParent[SceneObjectAsset::childrenSort] = children;
writeParent.AddToSubObjectSet(SceneObjectAsset::children, object);
writeParent[SceneObjectAsset::ChildrenSort] = children;
writeParent.AddToSubObjectSet(SceneObjectAsset::Children, object);
writeParent.Commit();
}
}
Expand All @@ -115,13 +115,13 @@ namespace Fyrion
if (RID parent = Repository::GetParent(it.first))
{
ResourceObject writeParent = Repository::Write(parent);
Array<RID> children = writeParent[SceneObjectAsset::childrenSort].Value<Array<RID>>();
Array<RID> children = writeParent[SceneObjectAsset::ChildrenSort].Value<Array<RID>>();
auto itArr = FindFirst(children.begin(), children.end(), it.first);
if (itArr)
{
children.Erase(itArr, itArr + 1);
}
writeParent[SceneObjectAsset::childrenSort] = children;
writeParent[SceneObjectAsset::ChildrenSort] = children;
writeParent.Commit();
}
Repository::DestroyResource(it.first);
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace Fyrion
typeHandler->Destroy(instance);

ResourceObject write = Repository::Write(object);
write.AddToSubObjectSet(SceneObjectAsset::components, component);
write.AddToSubObjectSet(SceneObjectAsset::Components, component);
write.Commit();

Editor::GetAssetTree().MarkDirty();
Expand Down
4 changes: 2 additions & 2 deletions Editor/Source/Fyrion/Editor/Window/PropertiesWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace Fyrion
nameFlags |= ImGuiInputTextFlags_ReadOnly;
}

StringView objectName = root ? m_sceneEditor.GetRootName() : read[SceneObjectAsset::name].Value<StringView>();
StringView objectName = root ? m_sceneEditor.GetRootName() : read[SceneObjectAsset::Name].Value<StringView>();
m_stringCache = objectName;
u32 hash = HashValue(rid);

Expand Down Expand Up @@ -133,7 +133,7 @@ namespace Fyrion

ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5 * style.ScaleFactor);

Array<RID> components = read.GetSubObjectSetAsArray(SceneObjectAsset::components);
Array<RID> components = read.GetSubObjectSetAsArray(SceneObjectAsset::Components);

bool openComponentSettings = false;

Expand Down
4 changes: 2 additions & 2 deletions Editor/Source/Fyrion/Editor/Window/SceneTreeWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Fyrion
void SceneTreeWindow::DrawSceneObject(RID object)
{
ResourceObject read = Repository::Read(object);
Span<RID> children = read[SceneObjectAsset::childrenSort].Value<Span<RID>>();
Span<RID> children = read[SceneObjectAsset::ChildrenSort].Value<Span<RID>>();


ImGui::TableNextRow();
Expand All @@ -28,7 +28,7 @@ namespace Fyrion
m_nameCache.Clear();
m_nameCache += root ? ICON_FA_CUBES : ICON_FA_CUBE;
m_nameCache += " ";
m_nameCache += root ? m_sceneEditor.GetRootName() : read[SceneObjectAsset::name].Value<StringView>();
m_nameCache += root ? m_sceneEditor.GetRootName() : read[SceneObjectAsset::Name].Value<StringView>();

bool isSelected = m_sceneEditor.IsSelected(object);
auto treeFlags = isSelected ? ImGuiTreeNodeFlags_Selected | ImGuiTreeNodeFlags_SpanAllColumns : ImGuiTreeNodeFlags_SpanAllColumns;
Expand Down
16 changes: 8 additions & 8 deletions Engine/Source/Fyrion/Assets/AssetTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ namespace Fyrion
{
struct UIFont
{
constexpr static u32 fontBytes = 0;
constexpr static u32 FontBytes = 0;
};

struct TextureAsset
struct ImageAsset
{
constexpr static u32 extent = 0;
constexpr static u32 channels = 1;
constexpr static u32 data = 2;
constexpr static u32 Extent = 0;
constexpr static u32 Channels = 1;
constexpr static u32 Data = 2;
};

struct ShaderAsset
{
constexpr static u32 bytes = 0;
constexpr static u32 info = 1;
constexpr static u32 stages = 2;
constexpr static u32 Bytes = 0;
constexpr static u32 Info = 1;
constexpr static u32 Stages = 2;
};


Expand Down
4 changes: 2 additions & 2 deletions Engine/Source/Fyrion/Assets/FontAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Fyrion
Array<u8> bytes = FileSystem::ReadFileAsByteArray(path);
RID rid = Repository::CreateResource<UIFont>();
ResourceObject fontObject = Repository::Write(rid);
fontObject.SetValue(UIFont::fontBytes, bytes);
fontObject[UIFont::FontBytes] = bytes;
fontObject.Commit();

return rid;
Expand All @@ -21,7 +21,7 @@ namespace Fyrion
void RegisterFontAsset()
{
ResourceTypeBuilder<UIFont>::Builder()
.Value<UIFont::fontBytes, Array<u8>>("fontBytes")
.Value<UIFont::FontBytes, Array<u8>>("fontBytes")
.Build();
ResourceAssets::AddAssetImporter(".ttf,.otf", ImportFontAsset);
}
Expand Down
18 changes: 9 additions & 9 deletions Engine/Source/Fyrion/Assets/ShaderAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ namespace Fyrion
RID shader = Repository::CreateResource<ShaderAsset>();

ResourceObject write = Repository::Write(shader);
write[ShaderAsset::bytes] = bytes;
write[ShaderAsset::info] = ShaderManager::ExtractShaderInfo(bytes, stages, renderApi);
write[ShaderAsset::stages] = stages;
write[ShaderAsset::Bytes] = bytes;
write[ShaderAsset::Info] = ShaderManager::ExtractShaderInfo(bytes, stages, renderApi);
write[ShaderAsset::Stages] = stages;

write.Commit();

Expand Down Expand Up @@ -92,9 +92,9 @@ namespace Fyrion
});

ResourceObject write = Repository::Write(shader);
write[ShaderAsset::bytes] = bytes;
write[ShaderAsset::info] = ShaderManager::ExtractShaderInfo(bytes, stages, renderApi);
write[ShaderAsset::stages] = stages;
write[ShaderAsset::Bytes] = bytes;
write[ShaderAsset::Info] = ShaderManager::ExtractShaderInfo(bytes, stages, renderApi);
write[ShaderAsset::Stages] = stages;
write.Commit();

return shader;
Expand All @@ -106,9 +106,9 @@ namespace Fyrion
void RegisterShaderAsset()
{
ResourceTypeBuilder<ShaderAsset>::Builder()
.Value<ShaderAsset::bytes, Array<u8>>("bytes")
.Value<ShaderAsset::info, ShaderInfo>("info")
.Value<ShaderAsset::stages, Array<ShaderStageInfo>>("stages")
.Value<ShaderAsset::Bytes, Array<u8>>("Bytes")
.Value<ShaderAsset::Info, ShaderInfo>("Info")
.Value<ShaderAsset::Stages, Array<ShaderStageInfo>>("Stages")
.Build();

ResourceAssets::AddAssetImporter(".raster", ImportRasterShader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Fyrion
VulkanBindingSet::VulkanBindingSet(VulkanDevice& vulkanDevice, const RID& shader, BindingSetType bindingSetType) : vulkanDevice(vulkanDevice), shader(shader), bindingSetType(bindingSetType)
{
ResourceObject shaderAsset = Repository::Read(shader);
const ShaderInfo& shaderInfo = shaderAsset[ShaderAsset::info].As<ShaderInfo>();
const ShaderInfo& shaderInfo = shaderAsset[ShaderAsset::Info].As<ShaderInfo>();

for(const DescriptorLayout& descriptorLayout: shaderInfo.descriptors)
{
Expand Down
6 changes: 3 additions & 3 deletions Engine/Source/Fyrion/Graphics/Device/Vulkan/VulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,9 @@ namespace Fyrion
{
ResourceObject shader = Repository::Read(graphicsPipelineCreation.shader);

Span<u8> bytes = shader[ShaderAsset::bytes].As<Span<u8>>();
Span<ShaderStageInfo> stages = shader[ShaderAsset::stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::info].As<ShaderInfo>();
Span<u8> bytes = shader[ShaderAsset::Bytes].As<Span<u8>>();
Span<ShaderStageInfo> stages = shader[ShaderAsset::Stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::Info].As<ShaderInfo>();

VulkanPipelineState* vulkanPipelineState = allocator.Alloc<VulkanPipelineState>();
vulkanPipelineState->graphicsPipelineCreation = graphicsPipelineCreation;
Expand Down
4 changes: 2 additions & 2 deletions Engine/Source/Fyrion/ImGui/ImGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ namespace ImGui
ResourceObject dejaVuSans = Repository::Read(Repository::GetByPath("Fyrion://Fonts/DejaVuSans.ttf"));
if (dejaVuSans)
{
const Array<u8>& dejaVuSansBytes = dejaVuSans.GetValue<Array<u8>>(UIFont::fontBytes);
const Array<u8>& dejaVuSansBytes = dejaVuSans.GetValue<Array<u8>>(UIFont::FontBytes);

auto font = ImFontConfig();
font.SizePixels = fontSize * scaleFactor;
Expand Down Expand Up @@ -918,7 +918,7 @@ namespace ImGui
config.FontDataOwnedByAtlas = false;
memcpy(config.Name, "FontAwesome", 11);

const Array<u8>& faSolidBytes = faSolid.GetValue<Array<u8>>(UIFont::fontBytes);
const Array<u8>& faSolidBytes = faSolid.GetValue<Array<u8>>(UIFont::FontBytes);
io.Fonts->AddFontFromMemoryTTF((void*) faSolidBytes.Data(), faSolidBytes.Size(), config.SizePixels, &config, icon_ranges);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Engine/Source/Fyrion/Scene/SceneAssets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Fyrion
{
struct SceneObjectAsset
{
constexpr static u32 name = 0;
constexpr static u32 components = 1;
constexpr static u32 children = 2;
constexpr static u32 childrenSort = 3;
constexpr static u32 Name = 0;
constexpr static u32 Components = 1;
constexpr static u32 Children = 2;
constexpr static u32 ChildrenSort = 3;
};
}
8 changes: 4 additions & 4 deletions Engine/Source/Fyrion/Scene/SceneTypeRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace Fyrion
Registry::Type<RenderComponent, Component>();

ResourceTypeBuilder<SceneObjectAsset>::Builder("Fyrion::Scene")
.Value<SceneObjectAsset::name, String>("name")
.SubObjectSet<SceneObjectAsset::components>("components")
.SubObjectSet<SceneObjectAsset::children>("children")
.Value<SceneObjectAsset::childrenSort, Array<RID>>("childrenSort")
.Value<SceneObjectAsset::Name, String>("Name")
.SubObjectSet<SceneObjectAsset::Components>("Components")
.SubObjectSet<SceneObjectAsset::Children>("Children")
.Value<SceneObjectAsset::ChildrenSort, Array<RID>>("ChildrenSort")
.Build();
}
}
12 changes: 6 additions & 6 deletions Engine/Test/Fyrion/Graphics/ShaderManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ namespace
ResourceObject shader = Repository::Read(rid);
CHECK(shader);

Span<u8> bytes = shader[ShaderAsset::bytes].As<Span<u8>>();
Span<u8> bytes = shader[ShaderAsset::Bytes].As<Span<u8>>();
CHECK(!bytes.Empty());

Span<ShaderStageInfo> stages = shader[ShaderAsset::stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::info].As<ShaderInfo>();
Span<ShaderStageInfo> stages = shader[ShaderAsset::Stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::Info].As<ShaderInfo>();

CHECK(stages.Size() == 2);

Expand All @@ -134,11 +134,11 @@ namespace
ResourceObject shader = Repository::Read(rid);
REQUIRE(shader);

Span<u8> bytes = shader[ShaderAsset::bytes].As<Span<u8>>();
Span<u8> bytes = shader[ShaderAsset::Bytes].As<Span<u8>>();
CHECK(!bytes.Empty());

Span<ShaderStageInfo> stages = shader[ShaderAsset::stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::info].As<ShaderInfo>();
Span<ShaderStageInfo> stages = shader[ShaderAsset::Stages].As<Span<ShaderStageInfo>>();
ShaderInfo shaderInfo = shader[ShaderAsset::Info].As<ShaderInfo>();

REQUIRE(stages.Size() == 1);
CHECK(stages[0].stage == ShaderStage::Compute);
Expand Down

0 comments on commit c68dbd8

Please sign in to comment.