A simple software renderer
install SDL2 & CMake.
brew install cmake
brew install sdl2
cd Mini3D
mkdir build
cd build
cmake ..
make
use google-test to ensure correntness
vector(x, y, z, w)
color(r, g, b)
matrix(F32[4][4])
device&platform initalize (use sdl2)
void Buffer2Screen(Color **buffer)
showRenderBuffer
on screenvoid SetLoopEvent(LoopEvent &&le)
program main loopvoid SetKeyDownEvent(KeyDownEvent &&kde)
program keyboward handle event
- Now a vertex includes the
color
&position(vector)
and will includeUV(vector2)
later on.
Mesh is used for read model file and save model data(indexArray & vertexArray)
static Mesh genTriangle()
generate a random trianglestatic Mesh genByFile(fileName)
load data from model file(currently only supported *.obj file)void draw(render, matrix)
draw the mesh on screen
viewAngle
The angle between left and right panelfarPlane, nearPlane
near, far, left, right panel surrounded the visible areaposition
camera world space positionlookat(vector)
camera look directionratio
viewport height / width
render_buffer
render buffer used for storage a frame color data. the same size as the screen width * heightdeep_buffer
deep buffer used for storage a frame deep data, is also called z-buffer.camera
a camera instancedevice
a device instancevoid DrawTriangle(vt1, vt2, vt3, m)
draw a triangle. 3D position projection to 2D panel use camera projection matrix
cull
discard the triangle outside the view frustumrasterization
computer fragment depend on screen positioninterpolation
cut
texture
material
light
- Introducing
imgui
to improve usability