update for new pixie
This commit is contained in:
parent
414bdc8190
commit
0655a07cf4
|
@ -2,7 +2,7 @@
|
||||||
## MIT License
|
## MIT License
|
||||||
## Copyright (c) 2021 Edin Omeragic
|
## Copyright (c) 2021 Edin Omeragic
|
||||||
|
|
||||||
import benchy, chroma, math, pixie, times, vmath
|
import benchy, chroma, math, pixie, vmath
|
||||||
|
|
||||||
{.push inline, noinit, checks: off.}
|
{.push inline, noinit, checks: off.}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ proc renderScene(scene: Scene, sceneImage: Image) =
|
||||||
var pos = y * w
|
var pos = y * w
|
||||||
for x in 0 ..< w:
|
for x in 0 ..< w:
|
||||||
ray.dir = getPoint(x, y, scene.camera, h, w)
|
ray.dir = getPoint(x, y, scene.camera, h, w)
|
||||||
sceneImage.setRgbaUnsafe(x, y, scene.traceRay(ray, 0))
|
sceneImage.unsafe[x, y] = scene.traceRay(ray, 0).asRgbx()
|
||||||
pos = pos + 1
|
pos = pos + 1
|
||||||
|
|
||||||
proc render(): Image =
|
proc render(): Image =
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
## MIT License
|
## MIT License
|
||||||
## Copyright (c) 2021 Edin Omeragic
|
## Copyright (c) 2021 Edin Omeragic
|
||||||
|
|
||||||
import benchy, chroma, math, times, glm
|
import benchy, chroma, math, glm
|
||||||
from pixie import Image, newImage, writeFile, setRgbaUnsafe
|
from pixie import Image, newImage, writeFile, dataIndex
|
||||||
|
|
||||||
type Vec3 = glm.Vec3[float32]
|
type Vec3 = glm.Vec3[float32]
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ proc renderScene(scene: Scene, sceneImage: Image) =
|
||||||
var pos = y * w
|
var pos = y * w
|
||||||
for x in 0 ..< w:
|
for x in 0 ..< w:
|
||||||
ray.dir = getPoint(x, y, scene.camera, h, w)
|
ray.dir = getPoint(x, y, scene.camera, h, w)
|
||||||
sceneImage.setRgbaUnsafe(x, y, scene.traceRay(ray, 0))
|
sceneImage.data[sceneImage.dataIndex(x, y)] = scene.traceRay(ray, 0).asRgbx()
|
||||||
pos = pos + 1
|
pos = pos + 1
|
||||||
|
|
||||||
proc render(): Image =
|
proc render(): Image =
|
||||||
|
|
Loading…
Reference in a new issue