Skip to content

Commit e4799e2

Browse files
author
Ryan Bottriell
committed
commit previous offline porting work
1 parent 755645b commit e4799e2

27 files changed

+7015
-0
lines changed

constants.go

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Ported from three.js by @rydrman
3+
*/
4+
15
package three
26

37
const (

core/uniform.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Ported from three.js by @rydrman
3+
*/
4+
5+
package core
6+
7+
type Uniform struct {
8+
Value int
9+
}
10+
11+
func NewUniform(value int) *Uniform {
12+
13+
return &Uniform{
14+
Value: value,
15+
}
16+
17+
}
18+
19+
func (u *Uniform) Clone() *Uniform {
20+
21+
return NewUniform(u.Value)
22+
23+
}

examples/simple_cube.go

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package main
2+
3+
import (
4+
"time"
5+
6+
"github.com/rydrman/three.go/math3"
7+
"github.com/rydrman/three.go/renderers"
8+
"github.com/rydrman/three.go/scenes"
9+
)
10+
11+
func main() {
12+
13+
win, err := renderers.NewWindowRenderer(500, 500, "Cube Example")
14+
if nil != err {
15+
panic(err)
16+
}
17+
defer win.Destroy()
18+
19+
scene := scenes.NewScene()
20+
scene.BackgroundColor = math3.Colors("powderblue")
21+
22+
//geo := three.NewCubeGeometry(1, 1, 1)
23+
//mat := three.NewBasicMaterial(three.MaterialProps{
24+
// Color: three.Color().FromHex(0x001111),
25+
//})
26+
27+
//mesh := three.NewMesh(geo, mat)
28+
29+
//scene.Add(mesh)
30+
31+
//cam := three.NewPerspectiveCamera(1)
32+
33+
for !win.ShouldClose() {
34+
win.Render(scene, nil)
35+
time.Sleep(time.Millisecond * 10)
36+
}
37+
38+
}

0 commit comments

Comments
 (0)