Skip to content

Instantly share code, notes, and snippets.

@dwilliamson
dwilliamson / clReflectSerialise.cpp
Created June 5, 2014 20:48
Object Graph "Package" Serialisation with clReflect
#pragma once
#include <Core/Core.h>
namespace clutl
{
struct Object;
@rianhunter
rianhunter / random-read.sh
Created January 18, 2016 18:16
Cron job to read randomly from disk
#!/bin/sh
for a in /dev/sd*1
do
SECTORS=$(/sbin/blockdev --getsize $a)
SECTOR=$(python -c "import random; print random.randint(0, $SECTORS - 1);")
dd if=$a of=/dev/null iflag=direct skip=${SECTOR} bs=512 count=1 2>/dev/null &
done
wait
@nothings
nothings / foo.c
Last active April 14, 2016 18:51
stbwingraph_MenuBegin(NULL); // top-level menu needs no name
stbwingraph_MenuBegin("&File");
stbwingraph_MenuItem(0 , "&New" , MENU_new);
stbwingraph_MenuItem('O', "&Open" , MENU_open);
stbwingraph_MenuItem('S', "&Save" , MENU_save);
stbwingraph_MenuItem(0 , "Save &As...", MENU_save_as);
stbwingraph_MenuItem(0,0,0);
stbwingraph_MenuItem(0 , "&Export", MENU_export);
stbwingraph_MenuItem(0,0,0);
stbwingraph_MenuItemExit("E&xit", MENU_exit);
@FelixK15
FelixK15 / shader_processing_thoughts.txt
Created August 15, 2016 20:31
Shader processing (non API specific)
Shader file (e.g. vertex shader):
----
float4 TransformVertex(in float4 pos : POSITION,
in float2 uvIn : TEXCOORD0,
in float4x4 worldMatrix : WORLDMATRIX,
in float4x4 projMatrix : PROJECTIONMATRIX,
in float4x4 viewMatrix : VIEWMATRIX,
out float2 uvOut : TEXCOORD0)
{
anonymous
anonymous / rrbits.h
Created September 8, 2015 21:30
// Copyright 2008-2015 RAD Game Tools
#ifndef RADRR_BITSH
#define RADRR_BITSH
#include "radtypes.h"
RADDEFSTART
//===================================================================================
@rygorous
rygorous / iggy_focus.cpp
Created October 14, 2013 19:46
Iggy focus handling
enum FocusDir
{
DIR_W,
DIR_E,
DIR_N,
DIR_S
};
static FocusDir get_quadrant(float dx, float dy)
{
diff --git a/imgui.cpp b/imgui.cpp
index 3dd3d3f..0a0e467 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -2037,6 +2037,7 @@ static bool NavScoreItem(ImRect cand)
// FIXME-NAVIGATION: Introducing various biases toward typical imgui uses cases, but we don't have any rigorous proof of their effect now.
float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x);
float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Clamp down on Y to keep using box-distance for vertically touching items
+
if (dby && dbx)

After solving the compaction puzzle for parallel processing of values in a partitioned stream, the path to a screenspace CSG quadtree kernel is now open.

Instead of separate tiles, products and factors, we now keep a single array of factors, of which each factor also has a product index and a tile coordinate. We operate on a 256x256 tile so our tile coordinates fit into 16 bit, and allow only a maximum of 65536 products for this tile, with 2^31 addressable brushes. A factor then requires only 8 bytes: 2 bytes for its product index, 2 bytes for its tile coordinate and 4 bytes for its signed brush id.

We seed the array with all factors that matter for this 256x256 tile, sorted by tile coordinate and product index so that factors which belong to the same product are packed together, and all products which belong to the same tile are packed together as well.

We also init a brush id image with tile size 1x1.

In the beginning, there is typically

ESDF_Keyboard_Setting_On: ESDF Keyboard ON
ESDF_Keyboard_Setting_Off: ESDF Keyboard OFF
Achievement_Underdragon_No_Zapping: No Zapping!
Menu_Numeric_XP_On: Numeric XP ON
Menu_Numeric_XP_Off: Numeric XP OFF
Dungeon_Rescue: Dungeon Rescue
Achievement_Rescued_Granma_Fat: Overweight Rescue
Achievement_Finished_Underworld_Zombie: Zombie Ending
Achievement_Finished_Underworld_Robot: Robot Ending
LEVEL_DESC_SPEEDRUN: Cemetery #0 of #1
#include <imgui.h>
#include "imgui_impl_glfw.h"
#include <stdio.h>
#include <GLFW/glfw3.h>
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error %d: %s\n", error, description);
}