Ignore:
Timestamp:
Jul 9, 2020, 8:51:43 AM (4 years ago)
Author:
coas-nagasima
Message:

mrubyを2.1.1に更新

Location:
EcnlProtoTool/trunk/mruby-2.1.1
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-2.1.1/benchmark/bm_ao_render.rb

    r321 r439  
    6969    len = vlength
    7070    v = Vec.new(@x, @y, @z)
    71     if len > 1.0e-17 then
     71    if len > 1.0e-17
    7272      v.x = v.x / len
    7373      v.y = v.y / len
     
    9393    c = rs.vdot(rs) - (@radius * @radius)
    9494    d = b * b - c
    95     if d > 0.0 then
     95    if d > 0.0
    9696      t = - b - Math.sqrt(d)
    9797
    98       if t > 0.0 and t < isect.t then
     98      if t > 0.0 and t < isect.t
    9999        isect.t = t
    100100        isect.hit = true
     
    119119    v = ray.dir.vdot(@n)
    120120    v0 = v
    121     if v < 0.0 then
     121    if v < 0.0
    122122      v0 = -v
    123123    end
    124     if v0 < 1.0e-17 then
     124    if v0 < 1.0e-17
    125125      return
    126126    end
     
    128128    t = -(ray.org.vdot(@n) + d) / v
    129129
    130     if t > 0.0 and t < isect.t then
     130    if t > 0.0 and t < isect.t
    131131      isect.hit = true
    132132      isect.t = t
     
    171171def clamp(f)
    172172  i = f * 255.5
    173   if i > 255.0 then
     173  if i > 255.0
    174174    i = 255.0
    175175  end
    176   if i < 0.0 then
     176  if i < 0.0
    177177    i = 0.0
    178178  end
     
    184184  basis[1] = Vec.new(0.0, 0.0, 0.0)
    185185
    186   if n.x < 0.6 and n.x > -0.6 then
     186  if n.x < 0.6 and n.x > -0.6
    187187    basis[1].x = 1.0
    188   elsif n.y < 0.6 and n.y > -0.6 then
     188  elsif n.y < 0.6 and n.y > -0.6
    189189    basis[1].y = 1.0
    190   elsif n.z < 0.6 and n.z > -0.6 then
     190  elsif n.z < 0.6 and n.z > -0.6
    191191    basis[1].z = 1.0
    192192  else
     
    222222                isect.pl.y + eps * isect.n.y,
    223223                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
    226226        r = Rand::rand
    227227        phi = 2.0 * 3.14159265 * Rand::rand
     
    242242        @spheres[2].intersect(ray, occisect)
    243243        @plane.intersect(ray, occisect)
    244         if occisect.hit then
     244        if occisect.hit
    245245          occlusion = occlusion + 1.0
    246246        else
     
    284284            @spheres[2].intersect(ray, isect)
    285285            @plane.intersect(ray, isect)
    286             if isect.hit then
     286            if isect.hit
    287287              col = ambient_occlusion(isect)
    288288              rad.x = rad.x + col.x
Note: See TracChangeset for help on using the changeset viewer.