Changeset 439 for EcnlProtoTool/trunk/mruby-2.1.1/benchmark
- Timestamp:
- Jul 9, 2020, 8:51:43 AM (4 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-2.1.1
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-2.1.1/benchmark/bm_ao_render.rb
r321 r439 69 69 len = vlength 70 70 v = Vec.new(@x, @y, @z) 71 if len > 1.0e-17 then71 if len > 1.0e-17 72 72 v.x = v.x / len 73 73 v.y = v.y / len … … 93 93 c = rs.vdot(rs) - (@radius * @radius) 94 94 d = b * b - c 95 if d > 0.0 then95 if d > 0.0 96 96 t = - b - Math.sqrt(d) 97 97 98 if t > 0.0 and t < isect.t then98 if t > 0.0 and t < isect.t 99 99 isect.t = t 100 100 isect.hit = true … … 119 119 v = ray.dir.vdot(@n) 120 120 v0 = v 121 if v < 0.0 then121 if v < 0.0 122 122 v0 = -v 123 123 end 124 if v0 < 1.0e-17 then124 if v0 < 1.0e-17 125 125 return 126 126 end … … 128 128 t = -(ray.org.vdot(@n) + d) / v 129 129 130 if t > 0.0 and t < isect.t then130 if t > 0.0 and t < isect.t 131 131 isect.hit = true 132 132 isect.t = t … … 171 171 def clamp(f) 172 172 i = f * 255.5 173 if i > 255.0 then173 if i > 255.0 174 174 i = 255.0 175 175 end 176 if i < 0.0 then176 if i < 0.0 177 177 i = 0.0 178 178 end … … 184 184 basis[1] = Vec.new(0.0, 0.0, 0.0) 185 185 186 if n.x < 0.6 and n.x > -0.6 then186 if n.x < 0.6 and n.x > -0.6 187 187 basis[1].x = 1.0 188 elsif n.y < 0.6 and n.y > -0.6 then188 elsif n.y < 0.6 and n.y > -0.6 189 189 basis[1].y = 1.0 190 elsif n.z < 0.6 and n.z > -0.6 then190 elsif n.z < 0.6 and n.z > -0.6 191 191 basis[1].z = 1.0 192 192 else … … 222 222 isect.pl.y + eps * isect.n.y, 223 223 isect.pl.z + eps * isect.n.z) 224 nphi.times do |j|225 ntheta.times do |i|224 nphi.times do 225 ntheta.times do 226 226 r = Rand::rand 227 227 phi = 2.0 * 3.14159265 * Rand::rand … … 242 242 @spheres[2].intersect(ray, occisect) 243 243 @plane.intersect(ray, occisect) 244 if occisect.hit then244 if occisect.hit 245 245 occlusion = occlusion + 1.0 246 246 else … … 284 284 @spheres[2].intersect(ray, isect) 285 285 @plane.intersect(ray, isect) 286 if isect.hit then286 if isect.hit 287 287 col = ambient_occlusion(isect) 288 288 rad.x = rad.x + col.x -
EcnlProtoTool/trunk/mruby-2.1.1/benchmark/bm_app_lc_fizzbuzz.rb
r321 r439 49 49 end 50 50 51 answer_str = answer.to_a 52 # puts answer_str 51 # puts answer -
EcnlProtoTool/trunk/mruby-2.1.1/benchmark/bm_so_lists.rb
r321 r439 18 18 # remove each individual item from right side of li3 and 19 19 # append to right side of li2 (reversing list) 20 while (not li3.empty?)20 until li3.empty? 21 21 li2.push(li3.pop) 22 22 end … … 25 25 li1.reverse! 26 26 # check that first item is now SIZE 27 if li1[0] != SIZE then27 if li1[0] != SIZE 28 28 p "not SIZE" 29 29 0 30 30 else 31 31 # compare li1 and li2 for equality 32 if li1 != li2 then32 if li1 != li2 33 33 return(0) 34 34 else
Note:
See TracChangeset
for help on using the changeset viewer.