Пример #1
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;
            }
        }
Пример #2
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);
                }
            }
        }
Пример #3
0
 public virtual void Draw(Camera camera)
 {
     if (_visible)
     {
         foreach (EffectPass pass in GetEffectToUse(camera).CurrentTechnique.Passes)
         {
             pass.Apply();
             Resources.Instance.GraphicsDevice.BlendState = BlendState.AlphaBlend;
             Resources.Instance.GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, _verts, 0, 2);
             Resources.Instance.GraphicsDevice.BlendState = BlendState.Opaque;
         }
         //BoundingSphereRenderer.Render(GetBoundingSphere(), Resources.Instance.GraphicsDevice, camera.View, camera.Projection, Color.Red);
     }
 }
Пример #4
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;
        }