Skip to content

Instantly share code, notes, and snippets.

struct Node
{
Node* child;
};
void gatherDescendants(std::vector<Node*>& target, Node* root)
{
if (root->child)
{
target.push_back(root->child);
abstract pass DefaultDecalPass
{
scene_blend alpha_blend
depth_bias 4 0.5
depth_write off
}
material DefaultSkinnedDecal: DefaultSkinned
{
technique ffp
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable: 4073)
#pragma init_seg(lib)
struct SslInitializer
{
SslInitializer()
{
QSslSocket::supportsSsl();
}
zeux@zeux-laptop ~/BlogCode/2014/2/TestDisk $ sudo ./test_disk 4096 128 .
Creating file: './largeFile' size: 4294967296 bytes
file created, let's do some testing!
Testing block size: 65536 bytes, will read 2048 blocks.
cache is cleared
Wall elapsed: 2.11037
Avg time per block: 1.03045 ms
Ignore: 18446744073657203244
Testing block size: 131072 bytes, will read 1024 blocks.
cache is cleared
@zeux
zeux / gist:8888772
Created February 8, 2014 19:22
set_value overload madness
#include <stdio.h>
void set_value(int rhs)
{
printf("int\n");
}
void set_value(unsigned int rhs)
{
printf("uint\n");
@zeux
zeux / Makefile
Created February 9, 2014 21:29
Create folders for output files using things you can learn from 'man make'
# Before
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@
-include $(OBJECTS:.o=.d)
# After
.SECONDEXPANSION:
@zeux
zeux / gist:9119256
Created February 20, 2014 17:40
SSAO loop
for (int i_3 = 0; i_3 < 8; i_3++) {
vec2 offsetDepth_14;
vec2 tmpvar_15;
tmpvar_15 = (rotation_8 * OFFSETS1_7[i_3]);
offsetDepth_14.x = texture2D (xlu_depthBuffer, (uv_1 + (tmpvar_15 * radiusTex_5))).x;
offsetDepth_14.y = texture2D (xlu_depthBuffer, (uv_1 - (tmpvar_15 * radiusTex_5))).x;
float tmpvar_16;
tmpvar_16 = (float((i_3 + 1)) / 10.0);
vec2 tmpvar_17;
tmpvar_17 = (((offsetDepth_14 - vec2(baseDepth_9)) / (0.006 *
@zeux
zeux / default.material
Created February 24, 2014 17:07
Oh horror
vertex_program DefaultVPParams null
{
default_params
{
param_named_auto CameraPosition camera_position
param_named_auto ViewProjection viewproj_matrix
param_named_auto Lamp0Dir light_direction 0
param_named_auto Lamp1Dir light_direction 1
param_named_auto Lamp0Color light_diffuse_colour 0
@zeux
zeux / gapi.hpp
Created February 24, 2014 17:13
class Renderbuffer: public Resource
{
public:
Texture::Format getFormat() const { return format; }
unsigned int getWidth() const { return width; }
unsigned int getHeight() const { return height; }
};
class Framebuffer: public Resource
@zeux
zeux / rbxglew.cpp
Created March 7, 2014 18:49
Yay for modern GL! Wait, what?
#pragma comment(lib, "opengl32.lib")
#include "glew.c"
template <typename T, typename U> static void patchUnsafe(T& t, U& u)
{
if (!t && u)
t = reinterpret_cast<T>(u);
}