C3DEngine – A simple software renderer
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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步