Exemple #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.IsMouseVisible = true;
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 1024;

            camera = new Camera(this, Vector3.Zero, new Vector3(0,0,-1), Vector3.Up);
            Components.Add(camera);
        }
Exemple #2
0
        public void Initialize(Game game)
        {
            _associatedGame = game;
            _graphicsDevice = game.GraphicsDevice;
            _content = new ContentManager(game.Content.ServiceProvider, "Content");
            _camera = new Camera(Vector3.Zero, new Vector3(0, 0, -1), Vector3.Up);
            game.Components.Add(_camera);

            _pointerX = 0;
            _pointerY = 0;
            _pointerPressed = false;
            _pointerReleased = false;
            _paseoCreated = false;
            _isPaseoVirtualCreated = false;
            listaHotSpace = new List<HotSpace>();
            currentHotSpace = 0;
        }
Exemple #3
0
        public virtual void Draw(Camera camera)
        {
            if (visible)
            {
                foreach (Sprite3D cuadrado in faces) {
                    cuadrado.Draw(camera);
                }

                foreach (GoTo cuadrado in listaGoTo)
                {
                    cuadrado.Draw(camera);
                }

                foreach (HotSpot cuadrdo in listaHotSpot)
                {
                    cuadrdo.Draw(camera);
                }
            }
        }
Exemple #4
0
        public Effect GetEffectToUse(Camera camera)
        {
            if (!IsTransitionAnimationInProgress)
            {
                basicEffect.World = GetWorld();
                basicEffect.View = camera.View;
                basicEffect.Projection = camera.Projection;
                basicEffect.Texture = _texture;
                basicEffect.TextureEnabled = true;

                return basicEffect;
            }
            else {
                TAEffect.Parameters["World"].SetValue(GetWorld());
                TAEffect.Parameters["View"].SetValue(camera.View);
                TAEffect.Parameters["Projection"].SetValue(camera.Projection);
                TAEffect.Parameters["TextureOrigin"].SetValue(_texture);
                TAEffect.Parameters["TextureDestiny"].SetValue(destinyTexture);
                TAEffect.Parameters["AlphaPercentaje"].SetValue(animationProgress);

                return TAEffect;
            }
        }
Exemple #5
0
 public virtual void Draw(Camera camera)
 {
     if (_visible)
     {
         foreach (EffectPass pass in GetEffectToUse(camera).CurrentTechnique.Passes)
         {
             pass.Apply();
             _graphicsDevice.BlendState = BlendState.AlphaBlend;
             _graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, _verts, 0, 2);
             _graphicsDevice.BlendState = BlendState.Opaque;
         }
         BoundingSphereRenderer.Render(GetBoundingSphere(), _graphicsDevice, camera.View, camera.Projection, Color.Red);
     }
 }
Exemple #6
0
        public static bool Intersects(Sprite3D s, Vector2 pointer, Viewport v, Camera cam)
        {
            Vector3 nearPoint = new Vector3(pointer, 0);
            Vector3 farPoint = new Vector3(pointer, 1);

            nearPoint = v.Unproject(nearPoint, cam.Projection, cam.View, Matrix.Identity);
            farPoint = v.Unproject(farPoint, cam.Projection, cam.View, Matrix.Identity);

            Vector3 direction = farPoint - nearPoint;
            direction.Normalize();

            Ray r = new Ray(nearPoint, direction);

            BoundingSphere bs = s.GetBoundingSphere();

            return (bs.Intersects(r) != null) ? true : false;
        }
Exemple #7
0
        /// <summary>
        /// Inicializa PanoEngine, esta llamada debe ser la primera antes de usar cualquier funcionalidad de la libreria.
        /// </summary>
        /// <param name="game">Game de XNA al que estará asociado el engine.</param>
        /// <param name="gD">GraphicsDevice del juego.</param>
        /// <param name="oldContent">Contenedor del juego del cual se hará una copia para usar los contenidos de la libreria</param>
        public void Initialize(Game game)
        {
            _associatedGame = game;
            _graphicsDevice = game.GraphicsDevice;
            _content = new ContentManager(game.Content.ServiceProvider, "Content");
            _camera = new Camera(Vector3.Zero, new Vector3(0, 0, -1), Vector3.Up);
            game.Components.Add(_camera);

            _pointerX = 0;
            _pointerY = 0;
            PEPointerPressed = false;
            PEPointerReleased = false;
            PEPaseoCreated = false;
        }