コード例 #1
0
ファイル: Renderer.cs プロジェクト: CBrauer/monotouch-samples
		public void RenderViewControllerUpdate (GameViewController gameViewController)
		{
			Matrix4 baseModel = CreateMatrixFromTranslation (0.0f, 0.0f, 5.0f) * CreateMatrixFromRotation (rotation, 0.0f, 1.0f, 0.0f);
			Matrix4 baseMv = viewMatrix * baseModel;
			Matrix4 modelViewMatrix = CreateMatrixFromTranslation (0.0f, 0.0f, 1.5f) * CreateMatrixFromRotation (rotation, 1.0f, 1.0f, 1.0f);
			modelViewMatrix = baseMv * modelViewMatrix;

			constantBuffer [0].normalMatrix = Matrix4.Invert (Matrix4.Transpose (modelViewMatrix));
			constantBuffer [0].modelviewProjectionMatrix = Matrix4.Transpose (projectionMatrix * modelViewMatrix);

			modelViewMatrix = CreateMatrixFromTranslation (0.0f, 0.0f, -1.5f);
			modelViewMatrix = modelViewMatrix * CreateMatrixFromRotation (rotation, 1.0f, 1.0f, 1.0f);
			modelViewMatrix = baseMv * modelViewMatrix;

			constantBuffer [1].normalMatrix = Matrix4.Invert (Matrix4.Transpose (modelViewMatrix));
			constantBuffer [1].modelviewProjectionMatrix = Matrix4.Transpose (projectionMatrix * modelViewMatrix);

			if (constantBuffer [1].ambientColor.Y >= 0.8) {
				multiplier = -1;
				constantBuffer [1].ambientColor.Y = 0.79f;
			} else if (constantBuffer [1].ambientColor.Y <= 0.2) {
				multiplier = 1;
				constantBuffer [1].ambientColor.Y = 0.21f;
			} else {
				constantBuffer [1].ambientColor.Y += multiplier * 0.01f;
			}

			rotation += (float)gameViewController.TimeSinceLastDraw;
		}
コード例 #2
0
ファイル: Renderer.cs プロジェクト: CBrauer/monotouch-samples
		public void RenderViewController (GameViewController gameViewController, bool value)
		{
			// timer is suspended/resumed
			// Can do any non-rendering related background work here when suspended
		}
コード例 #3
0
 public void RenderViewController(GameViewController gameViewController, bool value)
 {
     // timer is suspended/resumed
     // Can do any non-rendering related background work here when suspended
 }