// Start is called once at the start of the demo.
Start is called once at the start of the demo.
// Start is called once at the start of the demo .
func (t *Texplane) Start(a *app.App) {
	axes := helper.NewAxes(1)
	a.Scene().Add(axes)
	dir1 := light.NewDirectional(&math32.Color{1, 0, 0}, 1.0)
	dir1.SetPosition(1, 0, 0)
	a.Scene().Add(dir1)
	dir2 := light.NewDirectional(&math32.Color{1, 0, 0}, 1.0)
	dir2.SetPosition(0, 1, 0)
	a.Scene().Add(dir2)
	dir3 := light.NewDirectional(&math32.Color{1, 1, 1}, 1.0)
	dir3.SetPosition(0, 0, 1)
	a.Scene().Add(dir3)
	texfile := a.DirData() + "/images/uvgrid.jpg"
	tex1, err := texture.NewTexture2DFromImage(texfile)
	if err != nil {
		a.Log().Fatal("Error:%s loading texture:%s", err, texfile)
	}
	plane1_geom := geometry.NewPlane(2, 2)
	plane1_mat := material.NewStandard(&math32.Color{1, 1, 1})
	plane1_mat.SetSide(material.SideDouble)
	plane1_mat.AddTexture(tex1)
	t.plane1 = graphic.NewMesh(plane1_geom, plane1_mat)
	t.plane1.SetPosition(0, 1.1, 0)
	a.Scene().Add(t.plane1)
	texfile = a.DirData() + "/images/tiger1.jpg"
	tex2, err := texture.NewTexture2DFromImage(texfile)
	if err != nil {
		a.Log().Fatal("Error:%s loading texture:%s", err, texfile)
	}
	plane2_geom := geometry.NewPlane(2, 2)
	plane2_mat := material.NewStandard(&math32.Color{1, 1, 1})
	plane2_mat.SetSide(material.SideDouble)
	plane2_mat.AddTexture(tex2)
	t.plane2 = graphic.NewMesh(plane2_geom, plane2_mat)
	t.plane2.SetPosition(0, -1.1, 0)
	a.Scene().Add(t.plane2)
}
func ( t * Texplane ) Start ( a * app . App ) { axes := helper . NewAxes ( 1 ) a . Scene ( ) . Add ( axes ) dir1 := light . NewDirectional ( & math32 . Color { 1 , 0 , 0 } , 1.0 ) dir1 . SetPosition ( 1 , 0 , 0 ) a . Scene ( ) . Add ( dir1 ) dir2 := light . NewDirectional ( & math32 . Color { 1 , 0 , 0 } , 1.0 ) dir2 . SetPosition ( 0 , 1 , 0 ) a . Scene ( ) . Add ( dir2 ) dir3 := light . NewDirectional ( & math32 . Color { 1 , 1 , 1 } , 1.0 ) dir3 . SetPosition ( 0 , 0 , 1 ) a . Scene ( ) . Add ( dir3 ) texfile := a . DirData ( ) + " " tex1 , err := texture . NewTexture2DFromImage ( texfile ) if err != nil { a . Log ( ) . Fatal ( " " , err , texfile ) } plane1_geom := geometry . NewPlane ( 2 , 2 ) plane1_mat := material . NewStandard ( & math32 . Color { 1 , 1 , 1 } ) plane1_mat . SetSide ( material . SideDouble ) plane1_mat . AddTexture ( tex1 ) t . plane1 = graphic . NewMesh ( plane1_geom , plane1_mat ) t . plane1 . SetPosition ( 0 , 1.1 , 0 ) a . Scene ( ) . Add ( t . plane1 ) texfile = a . DirData ( ) + " " tex2 , err := texture . NewTexture2DFromImage ( texfile ) if err != nil { a . Log ( ) . Fatal ( " " , err , texfile ) } plane2_geom := geometry . NewPlane ( 2 , 2 ) plane2_mat := material . NewStandard ( & math32 . Color { 1 , 1 , 1 } ) plane2_mat . SetSide ( material . SideDouble ) plane2_mat . AddTexture ( tex2 ) t . plane2 = graphic . NewMesh ( plane2_geom , plane2_mat ) t . plane2 . SetPosition ( 0 , - 1.1 , 0 ) a . Scene ( ) . Add ( t . plane2 ) }
Start is called once at the start of the demo.
Start is called once at the start of the demo .
// Create axes helper // Adds red directional right light // Adds green directional top light // Adds white directional front light // Loads texture from image // Creates plane 1 // Loads texture from image // Creates plane2