Skip to content
项目

gnikoloff/software-renderer

在 GitHub 查看

关于

Software rasterizer in C

设计与媒体

这些数字如何统计

可以做什么

  • Software rasterization
  • Pure C17 implementation
  • Right hand Y-up coordinate system
  • Uses SDL for access to graphics hardware, mouse, keyboard, etc.

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Software rasterizer dojo

3D renderer written as an exercise to learn C and how graphics APIs such as OpenGL are implemented under the hood.

Shadow mapping demo preview

Features

  1. Software rasterization
  2. Pure C17 implementation
  3. Right hand Y-up coordinate system
  4. Uses SDL for access to graphics hardware, mouse, keyboard, etc.
  5. Supports native and web via emscripten
  6. Perspective correct interpolation
  7. Support for vertex and fragment shaders
  8. Depth buffer
  9. Face culling
  10. Viewport clipping
  11. Loading and parsing Wavefront .OBJ files and PNG images
  12. Cube map sampling

References and readings

  1. 3D Computer Graphics Programming
  2. Modern C
  3. niepp/spbr
  4. Lode's Computer Graphics Tutorial

Building for native

Clone the project and run in the terminal:

make build DEMO_NAME=DESIRED_DEMO_NAME
make run DEMO_NAME=DESIRED_DEMO_NAME

Where DESIRED_DEMO_NAME is the demo you want to build and run.

Here is a full list of the demo names:

GEOMETRY_EXAMPLE
SHADOWMAP_EXAMPLE
PHYSICS2D_EXAMPLE
DEPTHBUFFER_EXAMPLE
ENVIRONMENTMAPPING_EXAMPLE
PLASMA_EXAMPLE
TUNNEL_EXAMPLE

Building for web

Clone the project and run in the terminal:

make build-emscripten DEMO_NAME=DESIRED_DEMO_NAME

To run the web server to view it in a browser run:

npm i
npm start

This will start a local web server you can open in your browser of choice.

3D Geometry demo preview
Geometries
Depth buffer demo preview
Visualised depth buffer
Environment mapping demo preview
Environment mapping
Plasma demo preview
Plasma
Tunnel demo preview
Tunnel
2D Physics demo preview
2D Physics

License

Copyright (c) 2024 Georgi Nikolov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
associated documentation files (the "Software"), to deal in the Software without restriction, 
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

探索相关项目

加载中…