Update example

This commit is contained in:
Milan Nikolic 2021-05-25 21:50:26 +02:00
parent 6cfece1e81
commit 03998f3963
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
5 changed files with 12926 additions and 54975 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -16,11 +16,11 @@ func main() {
camera.Up = rl.NewVector3(0.0, 1.0, 0.0)
camera.Fovy = 45.0
dwarf := rl.LoadModel("dwarf.obj") // Load OBJ model
texture := rl.LoadTexture("dwarf_diffuse.png") // Load model texture
obj := rl.LoadModel("castle.obj") // Load OBJ model
texture := rl.LoadTexture("castle_diffuse.png") // Load model texture
dwarf.Materials = make([]rl.Material, 1)
dwarf.Materials[0].Maps[rl.MapDiffuse].Texture = texture // Set dwarf model diffuse texture
obj.Materials = make([]rl.Material, 1)
obj.Materials[0].Maps[rl.MapDiffuse].Texture = texture // Set castle model diffuse texture
position := rl.NewVector3(0.0, 0.0, 0.0) // Set model position
@ -33,21 +33,19 @@ func main() {
rl.BeginMode3D(camera)
rl.DrawModel(dwarf, position, 2.0, rl.White) // Draw 3d model with texture
rl.DrawModel(obj, position, 2.0, rl.White) // Draw 3d model with texture
rl.DrawGrid(10, 1.0) // Draw a grid
rl.DrawGizmo(position) // Draw gizmo
rl.EndMode3D()
rl.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, rl.Gray)
rl.DrawText("(c) Castle 3D model by Alberto Cano", screenWidth-200, screenHeight-20, 10, rl.Gray)
rl.EndDrawing()
}
rl.UnloadTexture(texture) // Unload texture
rl.UnloadModel(dwarf) // Unload model
rl.UnloadModel(obj) // Unload model
rl.CloseWindow()
}