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
// Usage: | |
// string s = (fstring("Testing...%d, %f, %d\n")% 1 % 2.0 % 42).str(); | |
// cout << fstring("Testing...%d, %f, %d\n")% 1 % 2.0 % 42; | |
// cout << fstring("%s%d, %f, %d\n")% "Testing..." % 1 % 2.0 % 42; | |
// cout << fstring("%s%c%c%c%d, %f, %d\n")% "Testing" % '.' % '.' % '.' % 1 % 2.0 % 42; | |
// cout << fstring("%s%d, %f, %d\n")% string("Testing...") % 1 % 2.0 % 42; | |
#ifndef CPPFORMAT_H | |
#define CPPFORMAT_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
# https://stackoverflow.com/questions/39332406/install-libc-on-ubuntu | |
# Adapted for Clang 5.0 | |
sudo apt-get update | |
sudo apt-get install -y clang-5.0 clang-5.0-doc \ | |
libclang-common-5.0-dev libclang-5.0-dev libclang1-5.0 libclang1-5.0-dbg \ | |
libllvm5.0 libllvm5.0-dbg lldb-5.0 llvm-5.0 llvm-5.0-dev llvm-5.0-runtime \ | |
clang-format-5.0 python-clang-5.0 liblldb-5.0-dev lld-5.0 libfuzzer-5.0-dev \ | |
subversion cmake |
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 "boost/format.hpp" | |
#include <string> | |
#include <utility> | |
inline auto fmt_r(boost::format & format) -> boost::format & {return format;} | |
template<typename T, typename... Args> | |
auto fmt_r(boost::format & format, T && val, Args &&... args) -> boost::format & { | |
return fmt_r(format % std::forward<T>(val), std::forward<Args>(args)...); | |
} |
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 <cstdlib> | |
#include <iostream> | |
#include <iterator> | |
#include "boost/format.hpp" | |
using boost::format; | |
namespace iter { |
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 T> | |
auto BBox::SlopeTest(const t_ClassifiedRay<T> & ray) const -> bool | |
{ | |
auto && tl = (minExt - ray.origin)*ray.rdir; | |
auto && th = (maxExt - ray.origin)*ray.rdir; | |
auto && tmin = std::min(tl.x, th.x); | |
auto && tmax = std::max(tl.x, th.x); | |
tmin = std::max(tmin, std::min(std::min(tl.y, th.y), tmax)); | |
tmax = std::min(tmax, std::max(std::max(tl.y, th.y), tmin)); |
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
// ***************************************************************************** | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2013 Christopher James Huff | |
// https://github.com/cjameshuff/ | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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; |
NewerOlder