swrast
所属分类:3D图形编程
开发工具:C
文件大小:0KB
下载次数:0
上传日期:2020-09-10 12:56:40
上 传 者:
sh-1993
说明: #一个用C编写的小型、仅供娱乐的软件光栅化器
(# A tiny, just-for-fun software rasterizer written in C)
文件列表:
Makefile (175, 2020-09-10)
main/ (0, 2020-09-10)
main/Makefile (1395, 2020-09-10)
main/include/ (0, 2020-09-10)
main/include/color.h (1052, 2020-09-10)
main/include/config.h (421, 2020-09-10)
main/include/context.h (6976, 2020-09-10)
main/include/framebuffer.h (1973, 2020-09-10)
main/include/inputassembler.h (2480, 2020-09-10)
main/include/predef.h (590, 2020-09-10)
main/include/rasterizer.h (1633, 2020-09-10)
main/include/shader.h (2154, 2020-09-10)
main/include/swrast.h (265, 2020-09-10)
main/include/texture.h (1180, 2020-09-10)
main/include/vector.h (1985, 2020-09-10)
main/src/ (0, 2020-09-10)
main/src/context.c (4849, 2020-09-10)
main/src/framebuffer.c (949, 2020-09-10)
main/src/inputassembler.c (6740, 2020-09-10)
main/src/rasterizer.c (9211, 2020-09-10)
main/src/shader.c (4002, 2020-09-10)
main/src/texture.c (890, 2020-09-10)
test/ (0, 2020-09-10)
test/3ds.c (5548, 2020-09-10)
test/3ds.h (318, 2020-09-10)
test/Makefile (1410, 2020-09-10)
test/benchmark.c (3998, 2020-09-10)
test/subpixel.c (891, 2020-09-10)
test/teapot.3ds (63273, 2020-09-10)
test/test.c (4661, 2020-09-10)
test/window.c (2626, 2020-09-10)
test/window.h (506, 2020-09-10)
# `#` Software rasterizer
Changes
* moved the X11 dependend `window.h` and `window.c` to `test`
* added an envelope header `swrast.h` file
* renamed `libraster.a` to `libswrast.a`
* added a small error message, if `a.out` can't find the `teapot.3ds` file
Here is the original README:
```
About
*****
To whom it may concern: this directory contains a just-for-fun software
rasterizer written in C89, started on a boring holiday week when I was sick.
The entire source code is released into the public domain.
The rasterizer currently supports the following features:
- Subpixel correct triangle rasterization
- Configurable back face culling (cull by vertex winding)
- Vertex buffers and index buffers
- Programmable shader pipeline (shaders defined as C functions)
- Default shaders implement fixed function OpenGL(R) style
transform & lighting with model view & projection matrix and
up to 8 independend light sources
- Perspective correct interpolation of vertex attributes
- Multpile texture layers with nearest neighbour sampling
- Depth buffering (OpenGL(R) style comparison function)
- Alpha blending
- Multiple framebuffer objects (can be used for e.g. render to texture)
- viewport mapping
- OpenGL(R) style depth masking/mapping/clipping
- Write to color channels can be flagged individually
- Immediate mode rendering
Rendering Pipeline
******************
_________________ Vertices are decoded from vertex and index
| Input Assembler | buffers. The input assembler stage assembles
|_________________| vertices to triangles and walks them through the
| | rest of the pipeline.
_| |_
______\___/______ Vertices are transformed with modelview and
| Vertex Shader | projection matrix. Depending on the shader used,
|_________________| vertex lighting values are computed in viewspace.
| | Other arbitrary values can be generated that are
_| |_ later interpolated across the triangle area.
______\___/______
| Rasterization | Pixels are generated from tripples of vertices.
|_________________| Vertex attributes are interpolated over the
_| |_ triangle area.
______\___/______
| Depth test | The interolated depth value is compared to the
|_________________| depth buffer value. Pixels are dropped if the
_| |_ specified comparison opartation returns false.
______\___/______
| Fragment Shader | The interpolated vertex attributes (e.g. texture
|_________________| coordinates) are used to compute a final fragment
_| |_ color.
______\___/______
| Framebuffer | The final color is (optionally) alpha blended onto
| blending | framebuffer. Individual color channels can be
|_________________| masked out.
Source code overview
********************
The directory "main" contains the main rasterizer library, currently
consisting of the following files:
include/config.h - Preprocessor defined limits of the
rasterization pipeline
include/predef.h - Forward declarations of structures
include/vector.h - Helper functions for working with
four component vectors
include/color.h - Helper functions for working with packed
four component color values
include/context.h - Context structure. Encapsulates all global
src/context.c state of the pipeline.
include/inputassembler.h - Implementation of the input assembler stage
src/inputassembler.c
include/shader.h - Implementation shader stages
src/shader.c
include/rasterizer.h - Implementation of the rasterizer stage and
src/rasterizer.c pixel merging (depth test, texturing
and blending)
include/texture.h - Implementation of texture objects
src/texture.c
include/framebuffer.h - Implementation of framebuffer objects
src/framebuffer.c
include/window.h - A simple window implementation. Handles a
src/window.c window and blits a framebuffer
The directory "test" contains testing and demo programs, currently consisting
of the following files:
3ds.h - A quick & dirty 3ds loader for testing
3ds.c
test.c - A small test program
Compiling
*********
Simply type "make" into the commandline on the top level directory. The
rasterizer is compiled into a library in the directory "main" and the sample
programs are compiled to binaries in the "test" directory.
Type "make clean" to cleanup the directory tree.
License
*******
All source code in this directory is released into the public domain.
I, David Oberhollenzer, will not assert any copyright claims on the
documents in this directory.
```
近期下载者:
相关文件:
收藏者: