Skip to content

Instantly share code, notes, and snippets.

Rory rorydriscoll

Block or report user

Report or block rorydriscoll

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rorydriscoll / FullScreenQuad.hlsl
Created Dec 19, 2011
A vertex shader that uses the vertex ID to generate a full-screen quad. Don't bind vertex buffer, index buffer or input layout. Just render three vertices!
View FullScreenQuad.hlsl
struct Output
float4 position_cs : SV_POSITION;
float2 texcoord : TEXCOORD;
Output main(uint id: SV_VertexID)
Output output;
rorydriscoll / SubsetSum
Created Dec 3, 2011
Subset sum problem
View SubsetSum
var max_sum = -Inf, best_begin = 0, best_end = 0, cur_begin = 0, cur_sum = 0
for (i = 0; i < values.length; ++i)
# Add the current value into our working sum
cur_sum += values[i]
# Update the max sum if we beat it
if cur_sum > max_sum:
max_sum = cur_sum
View Shader.glsl
// bind gloss {label:"Gloss", default:0.5, max:1, step:0.01}
// bind cdiff {label:"Diffuse Colour", r:0.6, g:0.0, b:0.0}
// bind cspec {label:"Specular Colour", r:0.3, g:0.3, b:0.3}
// bind lightstrength {label:"Light Strength", default:3, max:100, step:0.1}
// bind envtop {label:"Environment Top", r:0.0, g:0.2, b:0.4}
// bind envmiddle {label:"Environment Middle", r:0.2, g:0.2, b:0.2}
// bind envbottom {label:"Environment Bottom", r:0.01, g:0.1, b:0.01}
// bind refractiveindex {label:"Refracive Index", default:1.5, max:3, step:0.1}
// bind normalmap {label:"Normal Map", default:false}
// bind diffuse {label:"Diffuse", default:true}
You can’t perform that action at this time.