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
RNG::analytical_in_unit_disk(): ; 49 instructions | |
push rbp | |
mov rbp, rsp | |
sub rsp, 64 | |
mov QWORD PTR [rbp-56], rdi | |
movsd xmm0, QWORD PTR .LC1[rip] | |
mov rax, QWORD PTR [rbp-56] | |
movapd xmm1, xmm0 | |
mov rdx, QWORD PTR .LC2[rip] | |
movq xmm0, rdx |
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
option(WITH_NOEXCEPT "Use the `noexcept` annotation for various functions (faster?)" OFF) | |
# ... | |
if (WITH_NOEXCEPT) | |
message(STATUS "Using `noexcept` annotations (faster?)") | |
target_compile_definitions(PSRayTracing_StaticLibrary PUBLIC USE_NOEXCEPT) | |
else() | |
message(STATUS "Turned off use of `noexcept` (slower?)") | |
endif() |
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
option(WITH_FINAL "Use the `final` specifier on derived classes (faster?)" OFF) | |
# ... | |
if (WITH_FINAL) | |
message(STATUS "Using `final` spicifer (faster?)") | |
target_compile_definitions(PSRayTracing_StaticLibrary PUBLIC USE_FINAL) | |
else() | |
message(STATUS "Turned off use of `final` (slower?)") | |
endif() |
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
# `Linguist` is required | |
find_package(Qt6 COMPONENTS Linguist REQUIRED) | |
# ... | |
# Have your app specified | |
qt_add_executable(myapp ... | |
# ... |
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
# Check if we're building for iOS (and put it into a more friendly variable) | |
set(IOS FALSE) | |
if (${CMAKE_SYSTEM_NAME} STREQUAL iOS) | |
set(IOS TRUE) | |
endif() | |
# If we're building for Android or iOS, turn on the UI | |
set(IS_MOBILE FALSE) | |
if (ANDROID OR IOS) | |
set(IS_MOBILE TRUE) |
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
@@ -157,8 +166,15 @@ int main(int argc, char *argv[]) { | |
} | |
// Print some info | |
- const rreal renderTime = rreal(chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count()) / 1000.0f; | |
- cout << "Render took " << renderTime << " seconds" << endl; | |
+ if (run_in_testing_mode) { | |
+ // For machines, we show nanoseconds (as integers) | |
+ const auto render_time_us = chrono::duration_cast<std::chrono::nanoseconds>(endTime - startTime).count(); | |
+ cout << render_time_us << " ns" << endl; |
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/python3 | |
import sys | |
import random | |
import math | |
import matplotlib.pyplot as plt | |
class Vec3: | |
__slots__ = ( |
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
# If on OS, we need to fix some issues with the dylibs | |
# namely the rpath stuff & dylib IDs, it's a bit of a pain | |
if is_osx: | |
cmds = [] | |
# First fix Ids | |
dylibs = ['ogg', 'vorbis', 'vorbisenc', 'vorbisfile', 'sndfile'] | |
for lib in dylibs: | |
lib_filename = 'lib%s.dylib' % (lib) | |
cmd = 'install_name_tool -id "@rpath/{0}" lib/{0}'.format(lib_filename) |
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
import random, rdstdin, strutils | |
randomize() | |
let iRange = 1..100 | |
echo "Guess my target number that is between ", iRange.a, " and ", iRange.b, " (inclusive)." | |
let target = random(iRange) | |
var answer, i = 0 | |
while answer != target: |
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
import osproc | |
# Where your Nim compiler is located | |
const nimEXE = "/home/ben/bin/Nim/bin/nim" | |
# Compile and wait for it to be done | |
let | |
compile = startProcess(nimEXE, "", ["c", "--app:lib", "game"]) | |
compileStatus = waitForExit(compile) | |
close(compile) |
NewerOlder