Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reset the so-render benchmark so that it is what it was before my att…

…r performance testing.
  • Loading branch information...
commit cec3b3340362c1ba2343ca559531b095ad90133b 1 parent fd9cc99
Ryan Scott authored
Showing with 29 additions and 13 deletions.
  1. +29 −13 benchmark/ao-render.rb
View
42 benchmark/ao-render.rb
@@ -6,8 +6,8 @@
# mruby version by Hideki Miura
#
-IMAGE_WIDTH = 64
-IMAGE_HEIGHT = 64
+IMAGE_WIDTH = 256
+IMAGE_HEIGHT = 256
NSUBSAMPLES = 2
NAO_SAMPLES = 8
@@ -30,14 +30,19 @@ def self.rand
end
class Vec
- attr_accessor :x, :y, :z
-
def initialize(x, y, z)
@x = x
@y = y
@z = z
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)
Vec.new(@x + b.x, @y + b.y, @z + b.z)
end
@@ -75,13 +80,14 @@ def vnormalize
class Sphere
- attr_reader :center, :radius
-
def initialize(center, radius)
@center = center
@radius = radius
end
+ def center; @center; end
+ def radius; @radius; end
+
def intersect(ray, isect)
rs = ray.org.vsub(@center)
b = rs.vdot(ray.dir)
@@ -134,23 +140,33 @@ def intersect(ray, isect)
end
class Ray
- attr_accessor :org, :dir
-
def initialize(org, dir)
@org = org
@dir = dir
end
+
+ def org; @org; end
+ def org=(v); @org = v; end
+ def dir; @dir; end
+ def dir=(v); @dir = v; end
end
class Isect
- attr_accessor :t, :hit, :pl, :n
-
def initialize
@t = 10000000.0
@hit = false
@pl = Vec.new(0.0, 0.0, 0.0)
@n = Vec.new(0.0, 0.0, 0.0)
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
def clamp(f)
@@ -282,9 +298,9 @@ def render(w, h, nsubsamples)
r = rad.x / (nsf * nsf)
g = rad.y / (nsf * nsf)
b = rad.z / (nsf * nsf)
- # printf("%c", clamp(r))
- # printf("%c", clamp(g))
- # printf("%c", clamp(b))
+ printf("%c", clamp(r))
+ printf("%c", clamp(g))
+ printf("%c", clamp(b))
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.