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
#ifdef _MSC_VER | |
#include <intrin.h> // _BitScanForward | |
#endif | |
#include <cassert> | |
#include <cstdint> | |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# This script follows the instructions for building Clang, from the LLVM | |
# documentation here: https://llvm.org/docs/GettingStarted.html#requirements | |
CLANG_RELEASE_LATEST=13.0.0 | |
CLANG_GIT_REPO=https://github.com/llvm/llvm-project.git | |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# This script follows the instructions for building GCC, from the GNU | |
# documentation here: https://gcc.gnu.org/install/index.html | |
# x86_64: x86_64-pc-linux-gnu | |
# ARM: arm-none-eabi-linux | |
# Aarch64: aarch64-linux-gnu | |
# Vocore2: mipsel-openwrt-linux-uclibc |
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
/* | |
* Simple worker thread/task queue test. | |
* | |
* g++ -std=c++11 -Wall Werror -Wextra -pedantic-errors work_thread.cpp -lpthread -o work_thread | |
*/ | |
#include <atomic> | |
#include <cassert> | |
#include <chrono> // std::seconds |
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
/* | |
* g++ --std=c++11 -O3 -DNUM_TEST_RUNS=50000 -pthread -Wall -Werror -Wextra -pedantic -pedantic-errors line_drawing.cpp -o line_drawing | |
*/ | |
#include <cstdint> // uint8_t | |
#include <fstream> // std::ofstream | |
#include <iostream> // std::cout, std::cerr | |
#include <limits> // std::numeric_limits<> | |
#include <memory> // std::unique_ptr |
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
/* | |
* Test for parsing command-line arguments from a single string | |
* | |
* gcc -std=c11 -Wall -Werror -Wextra -pedantic -pedantic-errors parse_args.c -o parse_args | |
*/ | |
#include <stdio.h> // printf(), fprintf() | |
#include <string.h> // strlen() | |
#include <stdbool.h> // bool, true, false | |
#include <ctype.h> // isspace() |
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
;; Added by Package.el. This must come before configurations of | |
;; installed packages. Don't delete this line. If you don't want it, | |
;; just comment it out by adding a semicolon to the start of the line. | |
;; You may delete these explanatory comments. | |
(package-initialize) | |
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. |
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
/** | |
* Simple program to find the next multiple of a number (AMD, NVIDIA, & Intel share 16-byte alignments for cache lines). | |
* | |
* gcc -std=c11 -Wall -Wextra -Werror -pedantic-errors align_nums.c -o align_nums | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> |
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
/** | |
* Testing a parser to grab the outputs of a fragment shader | |
* | |
* g++ -std=c++11 -Wall -Werror -Wextra -pedantic -pedantic-errors glsl_regex.cpp -o glsl_regex | |
*/ | |
#include <iostream> | |
#include <string> | |
#include <vector> |
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
bool is_point_in_fov(const ls::draw::Camera& cam, math::vec3 point, const float fovReduction = 1.f) { | |
// Get the local camera's absolute position and direction in world-space | |
const math::vec3&& eyePos = cam.get_abs_position(); | |
const math::vec3&& eyeDir = math::normalize(cam.get_eye_direction()); | |
// translate the input point using a model-view matrix (no projection | |
// matrix should be used). | |
const math::mat4&& mvMat = modelMatrix * cam.get_view_matrix(); | |
const math::vec4&& temp = math::vec4{-point[0], -point[1],-point[2], 0.f} * mvMat; |
NewerOlder