Compare commits

...

2 Commits

Author SHA1 Message Date
Brett 58b0a831a9 uwu 2024-11-12 20:47:29 -05:00
Brett 85beae3630 whyy 2024-11-11 19:22:44 -05:00
5 changed files with 243 additions and 19 deletions

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="CMakePresetLoader">{
&quot;useNewFormat&quot;: true
}</component>
<component name="CMakeReloadState">
<option name="reloaded" value="true" />
</component>
<component name="CMakeRunConfigurationManager">
<generated>
<config projectName="COSC-4P80-Assignment-3" targetName="BLT_WITH_GRAPHICS" />
<config projectName="COSC-4P80-Assignment-3" targetName="freetype" />
<config projectName="COSC-4P80-Assignment-3" targetName="BLT" />
<config projectName="COSC-4P80-Assignment-3" targetName="COSC-4P80-Assignment-3" />
</generated>
</component>
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
<configuration PROFILE_NAME="Release" ENABLED="true" CONFIG_NAME="Release" />
<configuration PROFILE_NAME="RelWithDebInfo" ENABLED="true" CONFIG_NAME="RelWithDebInfo" />
<configuration PROFILE_NAME="RelWithDebInfo Addrsan" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DENABLE_ADDRSAN=ON -DENABLE_UBSAN=ON" />
<configuration PROFILE_NAME="RelWithDebInfo ubsan" ENABLED="true" CONFIG_NAME="RelWithDebInfo" GENERATION_OPTIONS="-DENABLE_UBSAN=ON" />
<configuration PROFILE_NAME="Debug Addrsan" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DENABLE_ADDRSAN=ON" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="df4fb81f-8c9e-43af-9712-6ff8baeb587a" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/cloc.sh" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/cloc.sh" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/include/blt/gfx/renderer/font_renderer.h" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/include/blt/gfx/renderer/font_renderer.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/gen-llil.pl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/gen-llil.pl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/gen_files" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/gen_files" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/run_llil4map" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/examples/llil_utils/run_llil4map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/phmap_lldb.py" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap/phmap_lldb.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/blt-with-graphics/src/blt/gfx/renderer/font_renderer.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/lib/blt-with-graphics/src/blt/gfx/renderer/font_renderer.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
<option name="indexerUseModules" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:RelWithDebInfo" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/lib/blt-with-graphics" />
</component>
<component name="ProjectApplicationVersion">
<option name="ide" value="CLion" />
<option name="majorVersion" value="2024" />
<option name="minorVersion" value="1.3" />
<option name="productBranch" value="Classic" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 7
}</component>
<component name="ProjectId" id="2oG5NNX4GedKhxLJDuzQ5OR5kr5" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;CMake Application.COSC-4P80-Assignment-3.executor&quot;: &quot;Run&quot;,
&quot;NIXITCH_NIXPKGS_CONFIG&quot;: &quot;/etc/nix/nixpkgs-config.nix&quot;,
&quot;NIXITCH_NIX_CONF_DIR&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_OTHER_STORES&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_PATH&quot;: &quot;/home/brett/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels&quot;,
&quot;NIXITCH_NIX_PROFILES&quot;: &quot;/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/brett /home/brett/.local/state/nix/profile /nix/profile /home/brett/.nix-profile&quot;,
&quot;NIXITCH_NIX_REMOTE&quot;: &quot;&quot;,
&quot;NIXITCH_NIX_USER_PROFILE_DIR&quot;: &quot;/nix/var/nix/profiles/per-user/brett&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;RunOnceActivity.readMode.enableVisualFormatting&quot;: &quot;true&quot;,
&quot;cf.advertisement.text.has.clang-format&quot;: &quot;true&quot;,
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/brett/Documents/Brock/CS 4P80/COSC-4P80-Assignment-3&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lib/blt-with-graphics/include/blt/gfx/font" />
</key>
</component>
<component name="RunManager" selected="CMake Application.COSC-4P80-Assignment-3">
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
</method>
</configuration>
<configuration name="BLT" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="COSC-4P80-Assignment-3" TARGET_NAME="BLT" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="BLT_WITH_GRAPHICS" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="COSC-4P80-Assignment-3" TARGET_NAME="BLT_WITH_GRAPHICS" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="COSC-4P80-Assignment-3" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="COSC-4P80-Assignment-3" TARGET_NAME="COSC-4P80-Assignment-3" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="COSC-4P80-Assignment-3" RUN_TARGET_NAME="COSC-4P80-Assignment-3">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="freetype" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="COSC-4P80-Assignment-3" TARGET_NAME="freetype" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="CMake Application.BLT" />
<item itemvalue="CMake Application.BLT_WITH_GRAPHICS" />
<item itemvalue="CMake Application.COSC-4P80-Assignment-3" />
<item itemvalue="CMake Application.freetype" />
</list>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="df4fb81f-8c9e-43af-9712-6ff8baeb587a" name="Changes" comment="" />
<created>1730483030448</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1730483030448</updated>
<workItem from="1730483031471" duration="57000" />
<workItem from="1730483139508" duration="22719000" />
<workItem from="1730760265254" duration="6300000" />
<workItem from="1730932443628" duration="1866000" />
<workItem from="1731098529771" duration="11456000" />
<workItem from="1731298352794" duration="46000" />
<workItem from="1731298462144" duration="20154000" />
<workItem from="1731370094158" duration="776000" />
<workItem from="1731430940789" duration="18938000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VCPKGProject">
<isAutomaticCheckingOnLaunch value="false" />
<isAutomaticFoundErrors value="true" />
<isAutomaticReloadCMake value="true" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(COSC-4P80-Assignment-3 VERSION 0.0.11) project(COSC-4P80-Assignment-3 VERSION 0.0.13)
include(FetchContent) include(FetchContent)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)

@ -1 +1 @@
Subproject commit de454940bcf53d2de091bc4b8e3e86c1a03cf85b Subproject commit ed6f36020e9388de546fca3a7ea791b195f24664

27
renderdoc_settings.cap Normal file
View File

@ -0,0 +1,27 @@
{
"rdocCaptureSettings": 1,
"settings": {
"autoStart": false,
"commandLine": "",
"environment": [
],
"executable": "/home/brett/Documents/Brock/CS 4P80/COSC-4P80-Assignment-3/cmake-build-relwithdebinfo/COSC-4P80-Assignment-3",
"inject": false,
"numQueuedFrames": 0,
"options": {
"allowFullscreen": true,
"allowVSync": true,
"apiValidation": false,
"captureAllCmdLists": false,
"captureCallstacks": false,
"captureCallstacksOnlyDraws": false,
"debugOutputMute": true,
"delayForDebugger": 0,
"hookIntoChildren": false,
"refAllResources": false,
"verifyBufferAccess": false
},
"queuedFrameCap": 0,
"workingDir": ""
}
}

View File

@ -4,13 +4,14 @@
#include <blt/gfx/window.h> #include <blt/gfx/window.h>
#include "blt/gfx/renderer/resource_manager.h" #include "blt/gfx/renderer/resource_manager.h"
#include "blt/gfx/renderer/batch_2d_renderer.h" #include "blt/gfx/renderer/batch_2d_renderer.h"
#include "blt/gfx/renderer/font_renderer.h"
#include "blt/gfx/renderer/camera.h" #include "blt/gfx/renderer/camera.h"
#include "blt/std/binary_tree.h"
#include "blt/std/random.h" #include "blt/std/random.h"
#include "blt/profiling/profiler_v2.h"
#include "blt/gfx/font/font_awesome_defines.h"
#include <assign3/file.h> #include <assign3/file.h>
#include <assign3/som.h> #include <assign3/som.h>
#include <imgui.h> #include <imgui.h>
#include <execution>
using namespace assign3; using namespace assign3;
@ -21,6 +22,7 @@ blt::gfx::matrix_state_manager global_matrices;
blt::gfx::resource_manager resources; blt::gfx::resource_manager resources;
blt::gfx::batch_renderer_2d renderer_2d(resources, global_matrices); blt::gfx::batch_renderer_2d renderer_2d(resources, global_matrices);
blt::gfx::first_person_camera_2d camera; blt::gfx::first_person_camera_2d camera;
blt::gfx::font_renderer_t font_renderer;
blt::size_t som_width = 5; blt::size_t som_width = 5;
blt::size_t som_height = 5; blt::size_t som_height = 5;
@ -70,25 +72,46 @@ void init(const blt::gfx::window_data&)
using namespace blt::gfx; using namespace blt::gfx;
BLT_INFO("Hello World!"); BLT_INFO("Hello World!");
blt::range_tree_t<blt::u64, std::string> tree{}; const unsigned char rickRollLyrics[] = {
tree.insert(10, "hello there"); 87, 101, 39, 114, 101, 32, 110, 111, 32, 115, 116, 114, 97, 110, 103, 101, 114, 115, 32, 116, 111, 32, 108, 111, 118, 101, 44, 10,
tree.insert(20, "larger"); 89, 111, 117, 32, 107, 110, 111, 119, 32, 116, 104, 101, 32, 114, 117, 108, 101, 115, 32, 97, 110, 100, 32, 115, 111, 32, 100, 111, 32,
tree.insert(5, "smaller"); 73, 46, 10,
tree.insert(7, "middle1"); 65, 32, 102, 117, 108, 108, 32, 99, 111, 109, 109, 105, 116, 109, 101, 110, 116, 39, 115, 32, 119, 104, 97, 116, 32, 73, 39, 109, 32, 116,
tree.insert(15, "middle2"); 104, 105, 110, 107, 105, 110, 103, 32, 111, 102, 44, 10,
tree.insert(25, "really large"); 89, 111, 117, 32, 119, 111, 117, 108, 100, 110, 39, 116, 32, 103, 101, 116, 32, 116, 104, 105, 115, 32, 102, 114, 111, 109, 32, 97, 110,
tree.insert(3, "really small"); 121, 32, 111, 116, 104, 101, 114, 32, 103, 117, 121, 46, 10,
73, 32, 106, 117, 115, 116, 32, 119, 97, 110, 110, 97, 32, 116, 101, 108, 108, 32, 121, 111, 117, 32, 104, 111, 119, 32, 73, 39, 109, 32,
102, 101, 101, 108, 105, 110, 103, 44, 10,
71, 111, 116, 116, 97, 32, 109, 97, 107, 101, 32, 121, 111, 117, 32, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 46, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 103, 105, 118, 101, 32, 121, 111, 117, 32, 117, 112, 44, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 108, 101, 116, 32, 121, 111, 117, 32, 100, 111, 119, 110, 44, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 114, 117, 110, 32, 97, 114, 111, 117, 110, 100, 32, 97, 110, 100, 32, 100, 101,
115, 101, 114, 116, 32, 121, 111, 117, 46, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 109, 97, 107, 101, 32, 121, 111, 117, 32, 99, 114, 121, 44, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 115, 97, 121, 32, 103, 111, 111, 100, 98, 121, 101, 44, 10,
78, 101, 118, 101, 114, 32, 103, 111, 110, 110, 97, 32, 116, 101, 108, 108, 32, 97, 32, 108, 105, 101, 32, 97, 110, 100, 32, 104, 117,
114, 116, 32, 121, 111, 117, 46, 10, '\0'
};
blt::random::random_t rand{std::random_device{}()}; std::string rick{reinterpret_cast<const char*>(rickRollLyrics)};
auto lines = blt::string::split_sv(rick, '\n');
for (blt::size_t i = 0; i < 100; i++)
tree.insert(rand.get_u64(0, 1000), std::to_string(i));
tree.print(std::cout, true);
global_matrices.create_internals(); global_matrices.create_internals();
resources.load_resources(); resources.load_resources();
renderer_2d.create(); renderer_2d.create();
font_renderer.create_default(2048);
// font::font_face_t default_font_face{reinterpret_cast<const blt::u8*>(fontAwesomeSolid_compressed_data), fontAwesomeSolid_compressed_size, true};
// font::font_file_t default_font{default_font_face, 0, 128};
// font_renderer.add_font(default_font);
BLT_START_INTERVAL("Text", "TextGen");
font_renderer.create_text("Parker is a faggot", 96)->setPosition(200, 200).setScale(0.1, 0.1);
for (const auto& [index, line] : blt::enumerate(lines))
{
font_renderer.create_text(line, 250)->setPosition(200, 300 + index * 96 * 0.1).setScale(0.1, 0.1);
}
// font_renderer.create_text("Parker is a faggot", 96)->setPosition(200, 300);
BLT_END_INTERVAL("Text", "TextGen");
for (const auto& data : files) for (const auto& data : files)
map_files_names.emplace_back(std::to_string(data.data_points.begin()->bins.size())); map_files_names.emplace_back(std::to_string(data.data_points.begin()->bins.size()));
@ -220,7 +243,7 @@ void update(const blt::gfx::window_data& window_data)
auto n = 2 * (v - min_act) / (max_act - min_act) - 1; auto n = 2 * (v - min_act) / (max_act - min_act) - 1;
v = n; v = n;
} }
BLT_TRACE("Min %f Max %f", min_act, max_act); // BLT_TRACE("Min %f Max %f", min_act, max_act);
for (auto [i, v] : blt::enumerate(som->get_array().get_map())) for (auto [i, v] : blt::enumerate(som->get_array().get_map()))
{ {
@ -238,6 +261,9 @@ void update(const blt::gfx::window_data& window_data)
} }
renderer_2d.render(window_data.width, window_data.height); renderer_2d.render(window_data.width, window_data.height);
BLT_START_INTERVAL("Text", "TextRender");
font_renderer.render();
BLT_END_INTERVAL("Text", "TextRender");
} }
void destroy(const blt::gfx::window_data&) void destroy(const blt::gfx::window_data&)
@ -245,7 +271,9 @@ void destroy(const blt::gfx::window_data&)
global_matrices.cleanup(); global_matrices.cleanup();
resources.cleanup(); resources.cleanup();
renderer_2d.cleanup(); renderer_2d.cleanup();
font_renderer.cleanup();
blt::gfx::cleanup(); blt::gfx::cleanup();
BLT_PRINT_PROFILE("Text");
BLT_INFO("Goodbye World!"); BLT_INFO("Goodbye World!");
} }