Skip to content

Commit

Permalink
Vertex Matrix Multiplication Optimization
Browse files Browse the repository at this point in the history
Framerate has increased by around 40!
  • Loading branch information
SamuelScerri authored Mar 14, 2024
1 parent a77e6e5 commit eb647c5
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Ensure that your PC has a proper cooling solution, since all of the CPU cores wi
- Backface Culling
- Matrix Multiplication
- Wavefront OBJ Support
- Shaders! (Vertex & Fragment)

# Any Experimental Features?
The future iteration of Ghetty will feature a Super Resolution Model that will be integrated into the renderer. The model in this case will be handled by the GPU,
Expand Down
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ var Time float32
func BasicVertex(vertex, uv, normal, color *Vertex, matrices ...*Matrix) {
//(*vertex)[X] += float32(math.Sin(float64(Time*.0125+(*vertex)[Y]))) * .25

//(*uv)[X] *= 2
//(*uv)[Y] *= 2

//(*uv)[X] += Time

(*color)[R] = 1
(*color)[G] = 1
(*color)[B] = 1
Expand All @@ -43,6 +38,10 @@ func BasicVertex(vertex, uv, normal, color *Vertex, matrices ...*Matrix) {
for index := range matrices {
vertex.Transform(matrices[index])
}

//(*vertex)[X] = float32(math.Round(float64((*vertex)[X]) * 32)) / 32;
//(*vertex)[Y] = float32(math.Round(float64((*vertex)[Y]) * 32)) / 32;
//(*vertex)[Z] = float32(math.Round(float64((*vertex)[Z]) * 32)) / 32;
}

func BasicFragment(r, g, b *float32, uv *Vertex, textures ...*Texture) {
Expand Down
Loading

0 comments on commit eb647c5

Please sign in to comment.