Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
cec3b334
Commit
cec3b334
authored
Jul 21, 2013
by
Ryan Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset the so-render benchmark so that it is what it was before my attr performance testing.
parent
fd9cc993
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
+29
-13
benchmark/ao-render.rb
benchmark/ao-render.rb
+29
-13
No files found.
benchmark/ao-render.rb
View file @
cec3b334
...
...
@@ -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 @@ module 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 @@ end
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 @@ class Plane
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 @@ class Scene
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment