raytracing: update example
This commit is contained in:
parent
fb0b237e0c
commit
2eef2be39e
@ -4,8 +4,8 @@
|
|||||||
#include "smpc.h"
|
#include "smpc.h"
|
||||||
#include "sh2.h"
|
#include "sh2.h"
|
||||||
|
|
||||||
#include "vec3.hpp"
|
#include "../math/vec3.hpp"
|
||||||
#include "fp.hpp"
|
#include "../math/fp.hpp"
|
||||||
#include "raytracing.hpp"
|
#include "raytracing.hpp"
|
||||||
|
|
||||||
constexpr inline
|
constexpr inline
|
||||||
|
@ -245,8 +245,6 @@ static vec3 trace_ray
|
|||||||
|
|
||||||
void render(int half, void (&put_pixel) (int32_t x, int32_t y, const vec3& c))
|
void render(int half, void (&put_pixel) (int32_t x, int32_t y, const vec3& c))
|
||||||
{
|
{
|
||||||
using namespace canvas;
|
|
||||||
|
|
||||||
vec3 origin = vec3(0, 0, 0);
|
vec3 origin = vec3(0, 0, 0);
|
||||||
|
|
||||||
int x_low = half ? 0 : -(320/2);
|
int x_low = half ? 0 : -(320/2);
|
||||||
@ -254,7 +252,7 @@ void render(int half, void (&put_pixel) (int32_t x, int32_t y, const vec3& c))
|
|||||||
|
|
||||||
//for (int x = -(width/2); x < (width/2); x++) {
|
//for (int x = -(width/2); x < (width/2); x++) {
|
||||||
for (int x = x_low; x < x_high; x++) {
|
for (int x = x_low; x < x_high; x++) {
|
||||||
for (int y = -(height/2 + 1); y < (height/2 + 1); y++) {
|
for (int y = -(canvas::height/2 + 1); y < (canvas::height/2 + 1); y++) {
|
||||||
vec3 direction = canvas_to_viewport(x, y);
|
vec3 direction = canvas_to_viewport(x, y);
|
||||||
vec3 color = trace_ray(origin, direction,
|
vec3 color = trace_ray(origin, direction,
|
||||||
fp16_16(1),
|
fp16_16(1),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "fp.hpp"
|
#include "../math/fp.hpp"
|
||||||
#include "raytracing.hpp"
|
#include "raytracing.hpp"
|
||||||
|
|
||||||
using vec3 = vec<3, fp16_16>;
|
using vec3 = vec<3, fp16_16>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user