tweaks - need to add new renderes

This commit is contained in:
Ben
2019-09-21 21:53:14 +01:00
parent 9b62fbd711
commit 634beba7a2
5 changed files with 55 additions and 51 deletions

View File

@@ -0,0 +1,37 @@
#ifndef INFERNO_DEFINITIONS_MATERIALS_MATERIAL_H_
#define INFERNO_DEFINITIONS_MATERIALS_MATERIAL_H_
#include "../../common.hpp"
#include "../../maths.hpp"
class Texture;
class Material {
public:
Material();
Material(glm::vec3 col, float specularity = 0.0f, float emmitance = 0.0f);
Material(glm::vec3 colour, float emittance, float Specularity, float index, float gloss, bool transparent, bool emissive);
glm::vec3 Bounce(glm::vec3 in, glm::vec3 normal);
glm::vec3 Colour;
Texture* Tex = nullptr;
Texture* NormalTexture = nullptr;
Texture* GlossTexture = nullptr;
float Emittance;
float Specularity; // 1.0f = perfect reflective
float Index; // refractive index
float Gloss; // reflection cone angle in radians
// float Tint; // specular and refractive tinting
// float Reflectivity; // metallic reflection
bool Transparent;
bool Emissive;
};
class GlossyMaterial : public Material {
public:
GlossyMaterial(glm::vec3 colour, float shine, float gloss)
: Material(colour, 0.0f, shine, 1.0f, gloss, false, false) { };
};
#endif

View File

@@ -4,61 +4,30 @@
newmtl backWall
Ns 9.803922
Ka 0.705000 0.705000 0.705000
Kd 0.900000 0.900000 0.900000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
#illum 2
Kd 0.725 0.71 0.68
newmtl ceiling
Ns 9.803922
Ka 0.705000 0.705000 0.705000
Kd 0.900000 0.900000 0.900000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
#illum 2
Kd 0.725 0.71 0.68
newmtl floor
Ns 9.803922
Ka 0.705000 0.705000 0.705000
Kd 0.900000 0.900000 0.900000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
#illum 2
Kd 0.725 0.71 0.68
newmtl leftWall
Ns 9.803922
Ka 0.248333 0.248333 0.248333
Kd 1.000000 0.000000 0.000000
#Kd 0.750000 0.250000 0.250000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
#illum 2
Kd 0.63 0.065 0.05
newmtl light
Ns 9.803922
Ka 0.780000 0.780000 0.780000
Kd 0.900000 0.900000 0.900000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 30
Kd 85.0 60.0 20.0
illum 1
newmtl rightWall
Ns 9.803922
Ka 0.227000 0.227000 0.227000
Kd 0.000000 1.000000 0.000000
#Kd 0.250000 0.250000 0.750000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
#illum 2
Kd 0.14 0.45 0.091

View File

@@ -21,7 +21,7 @@ public:
float Emittance;
float Specularity; // 1.0f = perfect reflective
float Index; // refractive index
float Gloss; // reflection cone angle in radians
float Gloss; // specular lobe angle in radians
// float Tint; // specular and refractive tinting
// float Reflectivity; // metallic reflection
bool Transparent;

View File

@@ -40,19 +40,14 @@ void ProgressiveRenderer::Input() {
const Uint8* state = SDL_GetKeyboardState(NULL);
//glm::vec3 pos = m_scene->objects[0]->center;
//if (state[SDL_SCANCODE_W]) m_scene->objects[0]->center.y += 0.01f;
//if (state[SDL_SCANCODE_S]) m_scene->objects[0]->center.y -= 0.01f;
//if (state[SDL_SCANCODE_D]) m_scene->objects[0]->center.x += 0.01f;
//if (state[SDL_SCANCODE_A]) m_scene->objects[0]->center.x -= 0.01f;
//if (state[SDL_SCANCODE_R]) m_scene->objects[0]->center.z += 0.01f;
//if (state[SDL_SCANCODE_F]) m_scene->objects[0]->center.z -= 0.01f;
//glm::vec3 newpos = m_scene->objects[0]->center;
//if (state[SDL_SCANCODE_W]) m_scene->objects[0]->center.y += 0.001f;
//if (state[SDL_SCANCODE_S]) m_scene->objects[0]->center.y -= 0.001f;
//if (state[SDL_SCANCODE_D]) m_scene->objects[0]->center.x += 0.001f;
//if (state[SDL_SCANCODE_A]) m_scene->objects[0]->center.x -= 0.001f;
//if (state[SDL_SCANCODE_R]) m_scene->objects[0]->center.z += 0.001f;
//if (state[SDL_SCANCODE_F]) m_scene->objects[0]->center.z -= 0.001f;
//if (newpos.x != pos.x || newpos.y != pos.y || newpos.z != pos.z) {
// m_threadPool->ThreadFrameBuffer->ClearFramebuffer();
// m_engine->SPP = 0; m_engine->SPPDepth = 0;
//}
//std::cout << m_scene->objects[0]->center.x << " " << m_scene->objects[0]->center.y << " " << m_scene->objects[0]->center.z << std::endl;
if (!m_interface->ImGui) return;

View File

@@ -18,6 +18,9 @@ int main(int argc, char** argv) {
Sky* sky = new SolidSky({ 0.0f, 0.0f, 0.0f }, 0.0f);
scene->sky = sky;
Sphere* sphere = new Sphere({ -0.302, -0.385999, -3.74202 }, 0.03f, new Material({ 0.345f, 0.133f, 0.050f }, 300.0f, 0.0f, 0.0f, 0.0f, false, true));
scene->objects.push_back(sphere);
Plane* plane = new Plane({ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, new Material({ 1.0f, 1.0f, 1.0f }, 0.0f, 0.0f, 0.0f, 0.0f, false, false));
scene->objects.push_back(plane);