asd
This commit is contained in:
@@ -14,6 +14,10 @@ bool Plane::Intersect(Ray& ray, float& t) {
|
||||
return false;
|
||||
}
|
||||
|
||||
glm::vec3 Plane::SurfaceTangent(glm::vec3 normal) {
|
||||
return {};
|
||||
}
|
||||
|
||||
glm::vec3 Plane::SurfaceNormal(glm::vec3 hitPoint) {
|
||||
return -normal;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public:
|
||||
|
||||
bool Intersect(Ray& ray, float& t) override;
|
||||
glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override;
|
||||
glm::vec3 SurfaceTangent(glm::vec3 normal) override;
|
||||
glm::vec2 TexCoords(glm::vec3 hitPoint) override;
|
||||
void Translate(glm::vec3 trans) override;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,10 @@ glm::vec3 Sphere::SurfaceNormal(glm::vec3 hitPoint) {
|
||||
return glm::normalize(hitPoint - center);
|
||||
}
|
||||
|
||||
glm::vec3 Sphere::SurfaceTangent(glm::vec3 normal) {
|
||||
return {};
|
||||
}
|
||||
|
||||
glm::vec2 Sphere::TexCoords(glm::vec3 hitPoint) {
|
||||
glm::vec3 hit = hitPoint - center;
|
||||
return { (1.0f + atan2(hit.z, hit.x) / PI) * 0.5f,
|
||||
|
||||
@@ -10,6 +10,7 @@ public:
|
||||
|
||||
bool Intersect(Ray& ray, float& t) override;
|
||||
glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override;
|
||||
glm::vec3 SurfaceTangent(glm::vec3 normal) override;
|
||||
glm::vec2 TexCoords(glm::vec3 hitPoint) override;
|
||||
void Translate(glm::vec3 trans) override;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,10 @@ bool Triangle::Intersect(Ray& ray, float& t) {
|
||||
return false;
|
||||
}
|
||||
|
||||
glm::vec3 Triangle::SurfaceTangent(glm::vec3 normal) {
|
||||
return {};
|
||||
}
|
||||
|
||||
glm::vec3 Triangle::SurfaceNormal(glm::vec3 hitPoint) {
|
||||
return ((normals[0] + normals[1] + normals[2]) / 3.0f);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ public:
|
||||
|
||||
bool Intersect(Ray& ray, float& t) override;
|
||||
glm::vec3 SurfaceNormal(glm::vec3 hitPoint) override;
|
||||
glm::vec3 SurfaceTangent(glm::vec3 normal) override;
|
||||
glm::vec2 TexCoords(glm::vec3 hitPoint) override;
|
||||
void Translate(glm::vec3 trans) override;
|
||||
|
||||
glm::vec3 Midpoint();
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include "../src/inferno.hpp"
|
||||
|
||||
static const int width = 600;
|
||||
static const int height = 600;
|
||||
static const int width = 1000;
|
||||
static const int height = 1000;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
InfernoEngine inferno;
|
||||
@@ -23,15 +23,16 @@ int main(int argc, char** argv) {
|
||||
scene->objects.push_back(&sphere1);
|
||||
|
||||
Sphere sphere({ 0.0f, 0.0f, -5.0f }, 1.0f, new Material({ 0.817f, 0.374, 0.574 }));
|
||||
sphere.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/dirt-normal.jpg");
|
||||
sphere.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/dirt-normal.jpg");
|
||||
// sphere.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/dirt-normal.jpg");
|
||||
scene->objects.push_back(&sphere);
|
||||
|
||||
Sphere light({ 35.0f, 56.0f, 25.0f }, 35.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 5.0f));
|
||||
scene->objects.push_back(&light);
|
||||
|
||||
Plane plane({ 0.0f,-1.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, new Material({ 0.9f, 0.9f, 0.9f }, 0.2f));
|
||||
// plane.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/normals.png");
|
||||
plane.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/normals.png");
|
||||
plane.material->NormalTexture = new Texture("E:/Projects/Inferno/resources/textures/normals.png");
|
||||
// plane.material->NormalTexture = new Texture("/home/ben/programming/inferno/resources/textures/normals.png");
|
||||
scene->objects.push_back(&plane);
|
||||
|
||||
//scene->objects.push_back(new Sphere({ 35.0f, 26.0f, 25.0f }, 15.0f, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 5.0f)));
|
||||
|
||||
Reference in New Issue
Block a user