Exemple #1
0
        public void LoadContent()
        {
            chipModel = Puzzle3D.Instance.Content.Load <Model>("Models/Chip");

            chipTransforms = new Matrix[chipModel.Bones.Count];
            chipModel.CopyAbsoluteBoneTransformsTo(chipTransforms);

            float sphereScale = Math.Max(chipTransforms[0].M11, chipTransforms[0].M22);
            float chipSize    = chipModel.Meshes[0].BoundingSphere.Radius * sphereScale * ChipSpacing;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    Vector3 chipPos = new Vector3((Width - 1) * -0.5f, (Height - 1) * -0.5f, 0.0f);

                    chipPos += new Vector3(x, y, 0.0f);
                    chipPos *= chipSize;

                    boardPositionMatrices[x, y] = Matrix.CreateTranslation(chipPos);
                }
            }

            if (currentPictureSet != null)
            {
                currentPictureSet.Load();
            }
            if (nextPictureSet != null)
            {
                nextPictureSet.Load();
            }

            lightingEffect.LoadContent();
        }
        public override void LoadContent()
        {
            photographModel = Puzzle3D.Instance.Content.Load <Model>(
                "Models/photograph");

            pictureSet.Load();

            // Recalculate aspect ratio
            Viewport viewport    = Puzzle3D.Instance.GraphicsDevice.Viewport;
            float    aspectRatio = (float)viewport.Width / viewport.Height;

            // Recalculate projection matrix
            projectionMatrix =
                Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
                                                    aspectRatio, 1.0f, ResetZValue * -1.5f);

            base.LoadContent();
        }