Simple Normals Rendering
This commit is contained in:
parent
b2fa4c4266
commit
eb133745f9
9 changed files with 2296 additions and 156 deletions
|
|
@ -6,17 +6,21 @@
|
|||
#include "Color.hpp"
|
||||
#include "Module.hpp"
|
||||
#include "Topology.hpp"
|
||||
#include "Vec.hpp"
|
||||
|
||||
namespace tp {
|
||||
|
||||
extern ModuleManifest gModuleRayTracer;
|
||||
|
||||
class Scene {
|
||||
public:
|
||||
typedef Topology Object;
|
||||
|
||||
public:
|
||||
Scene() = default;
|
||||
|
||||
public:
|
||||
Buffer<Topology> mObjects;
|
||||
Buffer<Object> mObjects;
|
||||
Camera mCamera;
|
||||
};
|
||||
|
||||
|
|
@ -24,8 +28,28 @@ namespace tp {
|
|||
public:
|
||||
typedef Buffer2D<RGBA> RenderBuffer;
|
||||
|
||||
struct RenderSettings {
|
||||
alni samplesiPerPixel = 1;
|
||||
alni rayBounces = 1;
|
||||
};
|
||||
|
||||
public:
|
||||
RayTracer() = default;
|
||||
void render(const Scene& scene, RenderBuffer& buff);
|
||||
|
||||
private:
|
||||
struct RayCastData {
|
||||
const Scene::Object* obj = nullptr;
|
||||
TrigCache* trig = nullptr;
|
||||
Vec3F hitPos = {0, 0, 0};
|
||||
bool hit = false;
|
||||
};
|
||||
|
||||
void castRay(const Ray& ray, RayCastData& out, alnf far);
|
||||
|
||||
private:
|
||||
RenderSettings mSettings;
|
||||
const Scene* mScene = nullptr;
|
||||
RenderBuffer* mBuff = nullptr;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue