Esempio n. 1
0
        public void LoadContent()
        {
            chipModel = Pickture.Instance.Content.Load <Model>("Models/Chip");

            // Cache the chip transforms
            chipTransforms = new Matrix[chipModel.Bones.Count];
            chipModel.CopyAbsoluteBoneTransformsTo(chipTransforms);

            // Now that we have the chip model, we can get its size
            // The size comes from mesh[0]'s bounding sphere radius which must be
            // transformed by the mesh's bone. Here, we simply scale by the X or Y
            // scale, whichever is larger. We don't care about the Z scale because
            // the chips are only placed in the XY plane.
            float sphereScale =
                Math.Max(chipTransforms[0].M11, chipTransforms[0].M22);
            float chipSize = chipModel.Meshes[0].BoundingSphere.Radius *
                             sphereScale * ChipSpacing;

            // For each board location
            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    // We use the chip size to determine the transformation matrix
                    // for a chip at that location

                    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();
        }
Esempio n. 2
0
        public override void LoadContent()
        {
            photographModel = Pickture.Instance.Content.Load <Model>(
                "Models/photograph");

            pictureSet.Load();

            // Recalculate aspect ratio
            Viewport viewport    = Pickture.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();
        }