示例#1
0
		protected override void Start()
		{
			debugHud = new MonoDebugHud(this) { FpsOnly = true };
			debugHud.Show();

			scene = new Scene();
			scene.CreateComponent<Octree>();
			var zone = scene.CreateComponent<Zone>();
			zone.AmbientColor = new Color(0.5f, 0.5f, 0.5f);

			cameraNode = scene.CreateChild();
			var camera = cameraNode.CreateComponent<Camera>();

			var viewport = new Viewport(scene, camera, null);
			// viewport.SetClearColor(Color.White);
			Renderer.SetViewport(0, viewport);

			lightNode = scene.CreateChild();
			lightNode.Position = new Vector3(0, 3, 0);
			var light = lightNode.CreateComponent<Light>();
			light.LightType = LightType.Directional;
			light.Brightness = 0.6f;
			light.Range = 200;

			environmentNode = scene.CreateChild();
			environmentNode.SetScale(0.1f);

			humanNode = environmentNode.CreateChild();
			humanNode.Position = new Vector3(0, -1f, 0);
			humanNode.SetScale(1f);
			var model = humanNode.CreateComponent<StaticModel>();
			model.Model = ResourceCache.GetModel("Jack.mdl");

			material = Material.FromColor(new Color(72/255f, 99/255f, 142/255f));

			yaw = -65;
			pitch = 55;
			cameraNode.Position = new Vector3(0.6f, 1.3f, -0.4f);
			cameraNode.Rotation = new Quaternion(pitch, yaw, 0);

			lightNode.SetDirection(new Vector3(-1, -1f, 0));
			InitTouchInput();
			var pointer = scene.CreateComponent<CubePointer>();
			pointer.PositionChanged += Pointer_PositionChanged;
		}