Ejemplo n.º 1
0
func AddSkyMesh(scene *ng.Scene, meshID int) {
	cubeMapID := ng.Core.Libs.Images.TexCube.AddNew()
	cubeMap := &ng.Core.Libs.Images.TexCube[cubeMapID]
	LibIDs.ImgCube["sky"] = cubeMapID
	cubeMap.InitFrom[0].RefUrl = "tex/sky/east.png"  // positive X
	cubeMap.InitFrom[1].RefUrl = "tex/sky/west.png"  // negative X
	cubeMap.InitFrom[2].RefUrl = "tex/sky/up.png"    // positive Y
	cubeMap.InitFrom[3].RefUrl = "tex/sky/down.png"  // negative Y
	cubeMap.InitFrom[4].RefUrl = "tex/sky/north.png" // positive Z
	cubeMap.InitFrom[5].RefUrl = "tex/sky/south.png" // negative Z
	fxID := ng.Core.Libs.Effects.AddNew()
	LibIDs.Fx["sky"] = fxID
	fx := &ng.Core.Libs.Effects[fxID]
	fx.EnableTexCube(0).Tex.ImageID = cubeMap.ID
	fx.EnableCoords(0)
	fx.DisableCoords(0)
	fx.UpdateRoutine()
	matID := ng.Core.Libs.Materials.AddNew()
	ng.Core.Libs.Materials[matID].DefaultEffectID = LibIDs.Fx["sky"]
	LibIDs.Mat["sky"] = matID

	scene.SetNodeMeshID(0, meshID)
	scene.Root().Render.MatID = matID
}