add unmodified version of TinyRenderer, a 500 line software renderer with vertex and pixel shaders, texture mapping and Wavefront .obj support.

This commit is contained in:
erwin coumans
2016-04-26 20:47:10 -07:00
parent edba85bab3
commit 2cb39e358a
12 changed files with 1116 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#ifndef __OUR_GL_H__
#define __OUR_GL_H__
#include "tgaimage.h"
#include "geometry.h"
extern Matrix ModelView;
extern Matrix Projection;
void viewport(int x, int y, int w, int h);
void projection(float coeff=0.f); // coeff = -1/c
void lookat(Vec3f eye, Vec3f center, Vec3f up);
struct IShader {
virtual ~IShader();
virtual Vec4f vertex(int iface, int nthvert) = 0;
virtual bool fragment(Vec3f bar, TGAColor &color) = 0;
};
//void triangle(Vec4f *pts, IShader &shader, TGAImage &image, float *zbuffer);
void triangle(mat<4,3,float> &pts, IShader &shader, TGAImage &image, float *zbuffer);
#endif //__OUR_GL_H__