Smooth triangles! And support for them in the OBJ File parser.

Also add an interesting tea party scene!
This commit is contained in:
Godzil
2020-03-06 15:07:26 +00:00
parent 73012b6dd1
commit e57b5715e8
38 changed files with 705 additions and 75 deletions

View File

@@ -26,9 +26,13 @@ private:
Point* *vertexList;
uint32_t vertexCount;
uint32_t allocatedVertexNormalCount;
Vector* *vertexNormalList;
uint32_t vertexNormalCount;
private:
Intersect localIntersect(Ray r);
Tuple localNormalAt(Tuple point);
Tuple localNormalAt(Tuple point, Intersection *hit = nullptr);
public:
/* Some stats */
@@ -37,6 +41,7 @@ public:
protected:
void addGroup(Group *group);
void addVertex(Point *vertex);
void addVertexNormal(Vector *vertexNormal);
void parseLine(char *line, uint32_t currentLine);
int execLine(int argc, char *argv[], uint32_t currentLine);
@@ -50,6 +55,7 @@ public:
/* OBJ file expect the first vertice to be 1 and not 0 */
Point vertices(uint32_t i) { return *this->vertexList[i - 1]; };
Vector verticesNormal(uint32_t i) { return *this->vertexNormalList[i - 1]; };
Group *groups(uint32_t i) { return this->faceGroupList[i]; };
Intersect intersect(Ray r);
BoundingBox getLocalBounds();