#trying to do implicit ray-triangle
3 messages · Page 1 of 1 (latest)
function loadTriangle(w, height)
local screen_width, screen_height = love.graphics.getDimensions()
-- how many stars we want local max_stars =
points = {} -- table which will hold our stars
local x = w
local y = height
for x = 1, w do
for y = 1, height do
local r = math.abs(x / w - 1)
local g = math.abs(y / height - 1)
ray.dir =
norm(
lower_left_corner + r * h + g * v - ray.origin)
-- print(ray.dir)
color = ray_color_triangle(ray)
table.insert(points, {x, y, color[1], color[2], color[3], 1})
end
end
end
local screen_width, screen_height = love.graphics.getDimensions()
function love.load()
loadSphere()
loadTriangle(screen_width, screen_height)
end
function love.draw()
love.graphics.points(points)
end