示例#1
0
文件: main.go 项目: go3d/go-ngine
func onAppThread() {
	apputil.HandleCamCtlKeys()
	if tmpScene = apputil.SceneCam.Scene(); tmpScene != nil {
		if tmpNode = tmpScene.Node(boxID); tmpNode != nil {
			tmpNode.Transform.Pos.Y = (2.125 + (0.5 * math.Sin(ng.Loop.Tick.Now*8)))
			tmpNode.Transform.Rot.Y += 0.005
			tmpNode.Transform.SetScale(1.5 + (0.5 * math.Sin(ng.Loop.Tick.Now*2)))
			tmpScene.ApplyNodeTransforms(tmpNode.ID)
		}
	}
}
示例#2
0
文件: main.go 项目: go3d/go-ngine
func onAppThread() {
	if apputil.Paused {
		return
	}

	apputil.HandleCamCtlKeys()
	apputil.RearView.OnApp()
	nowSin, nowCos := math.Sincos(ng.Loop.Tick.Now)

	//	node geometry anims
	if tmpScene = gui2d.Cam.Scene(); tmpScene != nil {
		tmpScene.Node(gui2d.DogNodeID).Transform.Rot.Add3(0, -0.005, 0.001)
		tmpScene.Node(gui2d.CatNodeID).Transform.Rot.X += 0.003
		tmpScene.ApplyNodeTransforms(0)
	}

	if tmpScene = apputil.SceneCam.Scene(); tmpScene != nil {
		if tmpNode = tmpScene.Node(pyrID); tmpNode != nil {
			tmpNode.Transform.Rot.Add3(-0.0005, -0.0005, 0)
			tmpNode.Transform.Pos.Set(-13.75, 2*nowSin, 2)
		}
		if tmpNode = tmpScene.Node(boxID); tmpNode != nil {
			tmpNode.Transform.Rot.Add3(0.0004, 0, 0.0006)
			tmpNode.Transform.Pos.Set(-8.125, 2*nowCos, -2)
		}

		var f float64
		for i := 0; i < len(crateIDs); i++ {
			if tmpNode = tmpScene.Node(crateIDs[i]); tmpNode != nil {
				f = float64(i)
				f = (f + 1) * (f + 1)
				tmpNode.Transform.Rot.Add3(f*0.00001, f*0.0001, f*0.001)
			}
		}

		if tmpNode = tmpScene.Node(pyrIDs[0]); tmpNode != nil {
			tmpNode.Transform.Pos.X = nowSin * 100
		}
		if tmpNode = tmpScene.Node(pyrIDs[1]); tmpNode != nil {
			tmpNode.Transform.Pos.Z = nowCos * 1000
		}
		tmpScene.ApplyNodeTransforms(0)
	}
}
示例#3
0
文件: main.go 项目: go3d/go-ngine
func onAppThread() {
	if !apputil.Paused {
		apputil.HandleCamCtlKeys()

		//	animate mesh nodes
		if tmpScene = apputil.SceneCam.Scene(); tmpScene != nil {
			if tmpNode = tmpScene.Node(pyrNodeID); tmpNode != nil {
				tmpNode.Transform.Rot.Add3(-0.0005, -0.0005, 0)
				tmpNode.Transform.Pos.Set(-1.5, 1.5+(2*math.Sin(ng.Loop.Tick.Now*3)), 7)
				tmpScene.ApplyNodeTransforms(tmpNode.ID)
			}
			if tmpNode = tmpScene.Node(boxNodeID); tmpNode != nil {
				tmpNode.Transform.Rot.Add3(0, 0.0004, 0.0006)
				tmpNode.Transform.Pos.Set(1.5, 1.5+(2*math.Cos(ng.Loop.Tick.Now*0.3333)), 7)
				tmpScene.ApplyNodeTransforms(tmpNode.ID)
			}
		}
	}
}
示例#4
0
文件: main.go 项目: go3d/go-ngine
func onAppThread() {
	apputil.HandleCamCtlKeys()
}