C3DEngine – A simple software renderer

using_diffuse-300x237 clip1-300x237
vertex_color-300x238 z-300x238

I write this demo just to go though some key concepts of computer graphics.
The following features are implemented in this demo:
1) transform mesh from local space to world space, then to the camera space;
2) Do projection to convert 3d triangles to 2d triangles.
3) Do clip in the clip window space, and split into two triangles if need;
4) Shader 2D triangle with diffuse texture or vertex color;
5) A float array used fo depth buffer;
6) Back surface culling in world space or camera space;
6) Texture Address mode(Clamp, Wrap & Mirror) and sampling(Point and Linear).

 

Operation

Key Z, show content of the depth buffer;
Key C, show content of the color buffer;
Key D, shader with diffuse texture;
Key V, shader with vertex color;
Key W, forward
Key S, backward
Key P, texture with nearest points sampling;
Key L, texture with linear sampling;

 

You could download the source code from here. SDL1.2 library used here to display the frame buffer content & depth buffer.

posted @ 2012-08-24 08:25  opencoder  阅读(369)  评论(0编辑  收藏  举报