walesey / go-engine

open-gl rendering and scenegraph library
Other
34 stars 6 forks source link

running lighting example #9

Open joeblew99 opened 7 years ago

joeblew99 commented 7 years ago

the light example it dependent on your server.

func fetchAssets(gameEngine engine.Engine, complete func()) {
    os.Mkdir("TestAssets", 0777)
    patcher := client.NewClient("TestAssets", "http://walesey.net")
    done := make(chan bool)
    go func() {
        patcher.SyncFiles("TestFiles")
        done <- true
    }()

...
walesey commented 7 years ago

It just downlods the large texture files so i dont need to check them in to source control. You can safely remove this if you have your own assets.

joeblew99 commented 7 years ago

Am trying to get up to speed for how to do that :)

I have a "TestAssets" directory. I think it might have been generated ? Then trying to work out how to get the example to mount it as it were to get a full end to end example going. Getting that far would really help..

walesey commented 7 years ago

Correct, the TestAssets directory is generated. When you run this particular example the code attempts to download the required game assets into TestAssets. These are the files you should be receiving http://walesey.net/files

If you could give more detail that would help: 1) What files do you see in the TestAssets directory? 2) What behaviour are you seeing on the screen? 3) What console error do you get, if any?

joeblew99 commented 7 years ago

Ok thanks for that it helps.

I got it semi working more now.... Here is what i do:

  1. make it
  2. run the editor for kicks. Its not usable yet it seems. But its not crashing.
  3. Have a go at running the example/lighting. I am now getting some assets.
x-MacBook-Pro:go-engine apple$ make
go build -o sBuilder ./shaderBuilder
mkdir -p shaders/build
./sBuilder shaders/basic.glsl vert > shaders/build/basic.vert
./sBuilder shaders/basic.glsl frag > shaders/build/basic.frag
./sBuilder shaders/pbr.glsl vert > shaders/build/pbr.vert
./sBuilder shaders/pbr.glsl frag > shaders/build/pbr.frag
./sBuilder shaders/diffuseSpecular.glsl vert > shaders/build/diffuseSpecular.vert
./sBuilder shaders/diffuseSpecular.glsl frag > shaders/build/diffuseSpecular.frag
./sBuilder shaders/pbrComposite.glsl vert > shaders/build/pbrComposite.vert
./sBuilder shaders/pbrComposite.glsl frag > shaders/build/pbrComposite.frag
mkdir -p shaders/build/postEffects
./sBuilder shaders/postEffects/cell.glsl vert > shaders/build/postEffects/cell.vert
./sBuilder shaders/postEffects/cell.glsl frag > shaders/build/postEffects/cell.frag
./sBuilder shaders/postEffects/glow.glsl vert > shaders/build/postEffects/glow.vert
./sBuilder shaders/postEffects/glow.glsl frag > shaders/build/postEffects/glow.frag
x-MacBook-Pro:go-engine apple$ go run main.go 
Using assetDir:  .

cd example/lighting
x-MacBook-Pro:lighting apple$ go run main.go
Error opening geometry file: open TestAssets/wellScene/floor.obj: no such file or directory
Error opening geometry file: open TestAssets/wellScene/frame1.obj: no such file or directory
Error opening geometry file: open TestAssets/wellScene/frame2.obj: no such file or directory
Error opening geometry file: open TestAssets/wellScene/well.obj: no such file or directory
Error opening geometry file: open TestAssets/wellScene/torches.obj: no such file or directory

The behaviour is that i see the skymap (golden) and some fires burning in the background.

Heres the file listing... x-MacBook-Pro:go-engine apple$ cd TestAssets/ x-MacBook-Pro:TestAssets apple$ tree . ├── Fire.png ├── Spark.png ├── cloudSky.jpg └── wellScene ├── bricks │   ├── harshbricks-ao2.png │   ├── harshbricks-metalness.png │   └── harshbricks-normal.png └── frame1.mtl

2 directories, 7 files

walesey commented 7 years ago

Some files are missing, Might be an issue with the file sync: ~/go/src/github.com/walesey/go-engine/TestAssets $ tree . ├── Fire.png ├── Spark.png ├── cloudSky.jpg └── wellScene ├── bricks │   ├── harshbricks-albedo.png │   ├── harshbricks-ao2.png │   ├── harshbricks-glow.png │   ├── harshbricks-metalness.png │   ├── harshbricks-normal.png │   └── harshbricks-roughness.png ├── floor.mtl ├── floor.obj ├── frame1.mtl ├── frame1.obj ├── frame2.mtl ├── frame2.obj ├── ground │   ├── pineneedles-albedo.png │   ├── pineneedles-ao.png │   ├── pineneedles-glow.png │   ├── pineneedles-metalness.png │   ├── pineneedles-normal4.png │   └── pineneedles-roughness.png ├── metal │   ├── greasy-metal-pan1-albedo.png │   ├── greasy-metal-pan1-ao.png │   ├── greasy-metal-pan1-glow.png │   ├── greasy-metal-pan1-metal.png │   ├── greasy-metal-pan1-normal.png │   └── greasy-metal-pan1-roughness.png ├── torches.mtl ├── torches.obj ├── well.mtl ├── well.obj └── wood ├── plywood-albedo2b.png ├── plywood-ao.png ├── plywood-glow.png ├── plywood-metalness.png ├── plywood-normal1.png └── plywood-rough.png

walesey commented 7 years ago

Try running this command manually to download the Test files:

~/go/src/github.com/walesey/go-engine $ go get github.com/walesey/go-fileserver
~/go/src/github.com/walesey/go-engine $ go-fileserver -host walesey.net -path TestFiles -out TestAssets
joeblew99 commented 7 years ago

thanks. it worked. Boy its slow though...