Diablo default

This commit is contained in:
Carlos Sanchez 2024-08-02 16:15:10 -04:00
parent e384989cfc
commit 37ec57a83f

View File

@ -7,6 +7,7 @@ import (
"log"
"math"
"os"
"path/filepath"
"renderer1/hrend"
"runtime/pprof" // For performance profiling (unnecessary)
"time"
@ -17,18 +18,18 @@ import (
)
const (
Width = 640
Height = 480
NearClip = 0.1
FarClip = 100
FOV = 90.0
ZOffset = 1.5
Movement = 1.0
Rotation = 0.25
LookLock = math.Pi / 32
Fps = 60
ObjectFile = "../head.obj"
TextureFile = "../head.jpg"
Width = 640
Height = 480
NearClip = 0.01
FarClip = 100
FOV = 90.0
ZOffset = 1.5
Movement = 1.0
Rotation = 0.25
LookLock = math.Pi / 32
Fps = 60
//ObjectFile = "../head.obj"
//TextureFile = "../head.jpg"
)
func must(err error) {
@ -38,15 +39,17 @@ func must(err error) {
}
func loadDefault() (*hrend.ObjModel, hrend.Framebuffer) {
log.Printf("Loading obj %s, texture %s", ObjectFile, TextureFile)
ofile := filepath.Join("../", *model+".obj")
tfile := filepath.Join("../", *model+".jpg")
log.Printf("Loading obj %s, texture %s", ofile, tfile)
of, err := os.Open(ObjectFile)
of, err := os.Open(ofile)
must(err)
defer of.Close()
o, err := hrend.ParseObj(of)
must(err)
jf, err := os.Open(TextureFile)
jf, err := os.Open(tfile)
must(err)
defer jf.Close()
timg, _, err := image.Decode(jf)
@ -58,6 +61,7 @@ func loadDefault() (*hrend.ObjModel, hrend.Framebuffer) {
// However flag works... idk
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var model = flag.String("model", "diablo", "Which model to use (single name)")
// var dozbuf = flag.Bool("zbuffer", false, "Write zbuffer instead of image")
// var p6file = flag.String("p6file", "", "Output binary ppm to given file instead")