This file contains hidden or 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
method hit*(ry: rotate_y, r: ray, t_min, t_max: float, rec: var hit_record): bool= | |
# I thought this was copying the vec3 data, but it wasn't. It was copying the pointer... | |
var | |
origin = r.origin() | |
direction = r.direction() | |
# origin and direction are modified after this which caused the issue... |
This file contains hidden or 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
#include "stb_image.h" | |
// Get the image data | |
int width, height, channels; | |
unsigned char *data = stbi_load("kevin_bacon.jpeg", &width, &height, &channels, STBI_default); | |
// Do what you want... | |
// Cleanup | |
stbi_image_free(data); |
This file contains hidden or 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 stopwatch | |
from sequtils import map | |
var sw = Stopwatch() | |
# We're operating on a large image... | |
for y in countup(0, imgHeight - 1): | |
for x in countup(0, imgWidth -1 ): | |
sw.start() | |
# ... lengthy pixel operation |
This file contains hidden or 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
# File: nim_opengl_shader_example.nim | |
# Author: Benjamin N. Summerton <define-private-public> | |
# Description: An example of how to use OpenGL shaders in Nim. Draws a simple | |
# rotating hexagon with 6 colors. Also uses indexed drawing. | |
# | |
# Uses this GLFW binding: https://github.com/rafaelvasco/nimrod-glfw, though if | |
# want to use SDL2, changing out the windowing should be simple. | |
# | |
# This was built on Linux using OpenGL ES 3. If you want to use a different | |
# OpenGL version then you will have to alter the shader source. |
This file contains hidden or 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
# Filename: Makefile | |
# Author: Benjamin N. Summerton <define-private-public> | |
# License: Unlicense (https://unlicense.org/) | |
# Change the value you're preferred c compiler (e.g. `clang` or `gcc`) | |
CC=clang | |
all: server client | |
server: server.c |
This file contains hidden or 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
// Filename: PingExample.cs | |
// Author: Benjamin N. Summerton <define-private-public> | |
// License: Unlicense (http://unlicense.org/) | |
using System; | |
using System.Threading; | |
using System.Net.NetworkInformation; | |
namespace PingExample | |
{ |
This file contains hidden or 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
// Filename: Arena.cs | |
// Author: Benjamin N. Summerton <define-private-public> | |
// License: Unlicense (https://unlicense.org/) | |
using System; | |
using System.Threading; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Diagnostics; | |
using System.Collections.Concurrent; |
This file contains hidden or 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
// Filename: Block.cs | |
// Author: Benjamin N. Summerton <define-private-public> | |
// License: Unlicense (http://unlicense.org/) | |
using System; | |
using System.Text; | |
using System.Linq; | |
namespace UdpFileTransfer | |
{ |
This file contains hidden or 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
// Filename: CompressionExample.cs | |
// Author: Benjamin N. Summerton <define-private-public> | |
// License: Unlicense (http://unlicense.org/) | |
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.IO.Compression; | |
namespace Compression |
This file contains hidden or 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
// Filename: GuessMyNumberGame.cs | |
// Author: Benjamin N. Summerton <define-private-public> | |
// License: Unlicense (http://unlicense.org/) | |
using System; | |
using System.Net.Sockets; | |
using System.Threading; | |
namespace TcpGames | |
{ |