Ejemplo n.º 1
0
        protected virtual void CheckDirtyParams()
        {
            // Update renderers
            GameObjectPainter.CheckDirtyParams(Renderer, World);


            // Only setup these things when their dependency has changed (property setters enable these)

            if (DirtyParams.HasFlag(DirtyParam.Size))
            {
                if (!GameObjects.Use3D)
                {
                    ProjMatrix = Matrix.CreateOrthographic(SizeV.X, SizeV.Y, -1, 100);
                }
                else
                {
                    ProjMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 1, 0.1f, 500);
                }

                // Flip the image to have its origin in the top-left corner
                if (FlipYAxis)
                {
                    ProjMatrix *= Matrix.CreateScale(1, -1, 1);
                }
            }


            DirtyParams = DirtyParam.None;
        }