Update C sources

This commit is contained in:
Milan Nikolic 2019-11-25 03:34:31 +01:00
parent 02424e2e10
commit bd6bf15356
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
53 changed files with 62247 additions and 9914 deletions

View file

@ -1,6 +1,8 @@
package main
import (
"fmt"
"github.com/gen2brain/raylib-go/raylib"
)
@ -21,11 +23,14 @@ func main() {
cubicmap := rl.LoadTextureFromImage(image) // Convert image to texture to display (VRAM)
mesh := rl.GenMeshCubicmap(*image, rl.NewVector3(1.0, 1.0, 1.0))
fmt.Printf("%+v\n", mesh)
model := rl.LoadModelFromMesh(mesh)
// NOTE: By default each cube is mapped to one part of texture atlas
texture := rl.LoadTexture("cubicmap_atlas.png") // Load map texture
model.Material.Maps[rl.MapDiffuse].Texture = texture // Set map diffuse texture
texture := rl.LoadTexture("cubicmap_atlas.png") // Load map texture
model.Materials = make([]rl.Material, 1)
model.Materials[0].Maps[rl.MapDiffuse].Texture = texture // Set map diffuse texture
mapPosition := rl.NewVector3(-16.0, 0.0, -8.0) // Set model position

View file

@ -1,6 +1,8 @@
package main
import (
//"fmt"
"github.com/gen2brain/raylib-go/raylib"
)
@ -20,10 +22,12 @@ func main() {
texture := rl.LoadTextureFromImage(image) // Convert image to texture (VRAM)
mesh := rl.GenMeshHeightmap(*image, rl.NewVector3(16, 8, 16)) // Generate heightmap mesh (RAM and VRAM)
model := rl.LoadModelFromMesh(mesh) // Load model from generated mesh
model.Material.Maps[rl.MapDiffuse].Texture = texture // Set map diffuse texture
mapPosition := rl.NewVector3(-8.0, 0.0, -8.0) // Set model position
//fmt.Printf("%+v\n", mesh)
model := rl.LoadModelFromMesh(mesh) // Load model from generated mesh
//fmt.Printf("%+v\n", model)
model.Materials = make([]rl.Material, 1)
model.Materials[0].Maps[rl.MapDiffuse].Texture = texture // Set map diffuse texture
mapPosition := rl.NewVector3(-8.0, 0.0, -8.0) // Set model position
rl.UnloadImage(image) // Unload heightmap image from RAM, already uploaded to VRAM

View file

@ -19,7 +19,8 @@ func main() {
dwarf := rl.LoadModel("dwarf.obj") // Load OBJ model
texture := rl.LoadTexture("dwarf_diffuse.png") // Load model texture
dwarf.Material.Maps[rl.MapDiffuse].Texture = texture // Set dwarf model diffuse texture
dwarf.Materials = make([]rl.Material, 1)
dwarf.Materials[0].Maps[rl.MapDiffuse].Texture = texture // Set dwarf model diffuse texture
position := rl.NewVector3(0.0, 0.0, 0.0) // Set model position