Commit cec3b334 authored by Ryan Scott's avatar Ryan Scott

Reset the so-render benchmark so that it is what it was before my attr performance testing.

parent fd9cc993
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
# mruby version by Hideki Miura # mruby version by Hideki Miura
# #
IMAGE_WIDTH = 64 IMAGE_WIDTH = 256
IMAGE_HEIGHT = 64 IMAGE_HEIGHT = 256
NSUBSAMPLES = 2 NSUBSAMPLES = 2
NAO_SAMPLES = 8 NAO_SAMPLES = 8
...@@ -30,14 +30,19 @@ module Rand ...@@ -30,14 +30,19 @@ module Rand
end end
class Vec class Vec
attr_accessor :x, :y, :z
def initialize(x, y, z) def initialize(x, y, z)
@x = x @x = x
@y = y @y = y
@z = z @z = z
end end
def x=(v); @x = v; end
def y=(v); @y = v; end
def z=(v); @z = v; end
def x; @x; end
def y; @y; end
def z; @z; end
def vadd(b) def vadd(b)
Vec.new(@x + b.x, @y + b.y, @z + b.z) Vec.new(@x + b.x, @y + b.y, @z + b.z)
end end
...@@ -75,13 +80,14 @@ end ...@@ -75,13 +80,14 @@ end
class Sphere class Sphere
attr_reader :center, :radius
def initialize(center, radius) def initialize(center, radius)
@center = center @center = center
@radius = radius @radius = radius
end end
def center; @center; end
def radius; @radius; end
def intersect(ray, isect) def intersect(ray, isect)
rs = ray.org.vsub(@center) rs = ray.org.vsub(@center)
b = rs.vdot(ray.dir) b = rs.vdot(ray.dir)
...@@ -134,23 +140,33 @@ class Plane ...@@ -134,23 +140,33 @@ class Plane
end end
class Ray class Ray
attr_accessor :org, :dir
def initialize(org, dir) def initialize(org, dir)
@org = org @org = org
@dir = dir @dir = dir
end end
def org; @org; end
def org=(v); @org = v; end
def dir; @dir; end
def dir=(v); @dir = v; end
end end
class Isect class Isect
attr_accessor :t, :hit, :pl, :n
def initialize def initialize
@t = 10000000.0 @t = 10000000.0
@hit = false @hit = false
@pl = Vec.new(0.0, 0.0, 0.0) @pl = Vec.new(0.0, 0.0, 0.0)
@n = Vec.new(0.0, 0.0, 0.0) @n = Vec.new(0.0, 0.0, 0.0)
end end
def t; @t; end
def t=(v); @t = v; end
def hit; @hit; end
def hit=(v); @hit = v; end
def pl; @pl; end
def pl=(v); @pl = v; end
def n; @n; end
def n=(v); @n = v; end
end end
def clamp(f) def clamp(f)
...@@ -282,9 +298,9 @@ class Scene ...@@ -282,9 +298,9 @@ class Scene
r = rad.x / (nsf * nsf) r = rad.x / (nsf * nsf)
g = rad.y / (nsf * nsf) g = rad.y / (nsf * nsf)
b = rad.z / (nsf * nsf) b = rad.z / (nsf * nsf)
# printf("%c", clamp(r)) printf("%c", clamp(r))
# printf("%c", clamp(g)) printf("%c", clamp(g))
# printf("%c", clamp(b)) printf("%c", clamp(b))
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment