Skip to content

Instantly share code, notes, and snippets.

RT_PROGRAM void closest_hit_radiance1() {
float3 world_geo_normal = normalize(rtTransformNormal( RT_OBJECT_TO_WORLD, geometric_normal));
float3 world_shade_normal = normalize(rtTransformNormal( RT_OBJECT_TO_WORLD, shading_normal));
float3 ffnormal = faceforward(world_shade_normal,
-ray.direction,
world_geo_normal);
float3 color = Ka * ambient_light_color;
float3 hit_point = ray.origin + t_hit * ray.direction;
for(int i = 0; i < lights.size(); ++i) {
BasicLight light = lights[i];
rtDeclareVariable( float4, sphere, , );
rtDeclareVariable( optix::Ray, ray, rtCurrentRay, );
rtDeclareVariable( float3, normal, attribute normal );
RT_PROGRAM void intersect_sphere( int prim_index ) {
float3 center = make_float3( sphere.x, sphere.y, sphere.z );
float radius = sphere.w;
float3 O = ray.origin - center;
float b = dot( O, ray.direction ); float c = dot( O, O ) - radius*radius; float disc = b*b - c;
if( disc > 0.0f ) {
@awreece
awreece / gist:4237349
Created December 7, 2012 23:07
Learning list
Ida pro
Metasploit
Mac internals
Autoconf
Go internals
Write compiler
Heap feng shuei
Jit spray
Windbg
Dynamic reversing
(* compile with ocamlfind ocamlopt dfs.ml -package ocamlgraph -linkpkg -package batteries *)
let filename_ = ref "temp.dot"
let start_ = ref "a"
let () =
Arg.parse
["-f", Arg.Set_string(filename_), "Filename";
"-s", Arg.Set_string(start_), "Starting vertex"]
(fun _ -> ())
"Usage: dfs <options>"
@awreece
awreece / gist:4239062
Created December 8, 2012 07:07
ocamlgraph dot patch
$ svn diff
Index: src/dot.ml
===================================================================
--- src/dot.ml (revision 453)
+++ src/dot.ml (working copy)
@@ -147,15 +147,15 @@
let al = Attr.addl !def_edge_attr al in
let el = L.edge [Attr.list al] in
let g,vn = node g id [] in
- List.fold_left
type loop_type = Self | Irreducible | Reducible | Nonheader
let analyze_loops g =
let uf = UF.init () in
let types = H.create 1337 in
let headers = H.create 1337 in
let preds = H.create 1337 in
let dfs_tree = DfsTree.create g in
let is_ancestor = DfsTree.isAncestor dfs_tree in
let compute_preds w = G.fold_pred (fun v (bp,nbp) -> if is_ancestor w v
File "sreedhar.ml", line 30, characters 62-63:
Error: This expression has type G.V.t but an expression was expected of type
DJG.V.t
make: *** [sreedhar.cmx] Error 2
File "temp.ml", line 4, characters 2-5:
Error: Syntax error
module DJV = struct
type t = { level: int; vertex: string }
let vertex v = v.vertex
let level v = v.level
end
let _ = print_string (DJV.vertex DJV.({ level=0; vertex="hello, world\n" }))