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
#include <iostream> | |
#include <cstdlib> | |
#include <cfloat> | |
#include <cmath> | |
#include "simpletest.h" | |
#include "allocator.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
static Foo * foo = nullptr; | |
static Mutex fooLock; | |
Foo * GetFoo() | |
{ | |
if(!foo) | |
{ | |
fooLock.Lock(); |
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
class Fault: public TerrainFn { | |
protected: | |
const float4 center; | |
const float4 plane; | |
const float4 displacement; | |
const float amplitude; | |
public: | |
Fault(fn_handle _input, float4 c, float4 p, float amp): | |
TerrainFn{std::move(_input)}, |
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
auto tfn = fn_handle{new TerrainFn}; | |
thickness = 10.0f; | |
layerIdx = 1; | |
tfn = fn_handle{new PlaneLayer(std::move(tfn), layerIdx++, elev, 100.0f)}; | |
tfn = fn_handle{new Turbulate(std::move(tfn), turbScl, turbAmp)}; | |
elev += thickness; | |
layerIdx = igneous; |
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
struct VolumeVal { | |
uint16_t type; | |
float field; | |
}; | |
using fieldfn_t = std::function<float(const vec3 &)>; | |
using volfn_t = std::function<VolumeVal(const vec3 &)>; | |
// Result is a function giving one of three possible results: | |
// the result of fnb (preexisting layers) |
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
uint8_t duckWheel1 = { | |
0x1F, // ##### | |
0x1F, // ##### | |
0x15, // #_#_# | |
0x0E, // _###_ | |
0x1B, // ##_## | |
0x15, // #_#_# | |
0x1B, // ##_## | |
0x0E // _###_ | |
}; |
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
class Thing | |
def do_something(params) | |
puts "#{params[:a]}, #{params[:b]}, #{params[:c]}" | |
end # do_something() | |
end # class Thing | |
myThing = Thing.new | |
myThing.do_something(a: 3.14159, b: 2.71828, c: 1.618033) |
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 ruby | |
# ./totext.rb FILENAME | |
require "rexml/document" | |
puts "Converting #{ARGV[0]}" | |
fin = File.new(ARGV[0]) | |
doc = REXML::Document.new(fin) |
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
template<typename cb_t> | |
void add_handler(const cb_t & cb) { | |
auto existing = globalEventHandlers[event]; | |
globalEventHandlers[event] = (existing)? []() -> bool { | |
if(cb()) | |
return true; | |
return existing(); | |
} : cb; | |
} |
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
#include <iostream> | |
#include <cstdlib> | |
#include <FL/Fl.H> | |
#include <FL/Fl_Window.H> | |
#include <FL/Fl_Box.H> | |
#include <FL/Fl_Button.H> | |
#include <FL/Fl_Text_Display.H> | |
#include <FL/Fl_Multiline_Input.H> |