Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Carregar o efeito a utilizar para desenhar a geometria
            foreach (Geometry geometria in geometrias)
            {
                geometria.LoadContent(GraphicsDevice, Content);
            }

            efeito = new BasicEffect(GraphicsDevice);
            textura = Content.Load<Texture2D>("box_texture");

            efeitoPlano = new BasicEffect(GraphicsDevice);
            texturaPlano = Content.Load<Texture2D>("logo_ipca");

            efeitoPiramide = new BasicEffect(GraphicsDevice);

            //Textura
            efeito.TextureEnabled = true;
            efeito.Texture = textura;

            //Iluminação
            //efeito.EnableDefaultLighting();
            efeito.LightingEnabled = true;
            efeito.AmbientLightColor = new Vector3(0.1f, 0.1f, 0.1f);
            efeito.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
            efeito.DirectionalLight0.Direction = Vector3.Forward;
            efeito.DirectionalLight0.Enabled = true;
            efeito.PreferPerPixelLighting = true;
            //efeito.EmissiveColor = Color.White.ToVector3() * 0.1f;
            efeito.SpecularColor = Color.Black.ToVector3();

            //Fog
            efeito.FogEnabled = true;
            efeito.FogColor = Color.Black.ToVector3();
            efeito.FogStart = Camera.nearPlane;
            efeito.FogEnd = Camera.farPlaneShort - 10;

            //----------

            //Textura
            efeitoPlano.TextureEnabled = true;
            efeitoPlano.Texture = texturaPlano;

            //Iluminação
            //efeito.EnableDefaultLighting();
            efeitoPlano.LightingEnabled = true;
            efeitoPlano.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
            efeitoPlano.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
            efeitoPlano.DirectionalLight0.Direction = Vector3.Forward;
            efeitoPlano.DirectionalLight0.Enabled = true;
            efeitoPlano.PreferPerPixelLighting = true;

            //Fog
            efeitoPlano.FogEnabled = true;
            efeitoPlano.FogColor = Vector3.Zero;
            efeitoPlano.FogStart = Camera.nearPlane;
            efeitoPlano.FogEnd = Camera.farPlaneLong;

            efeitoPlano.World = Matrix.Identity;

            //--------
            efeitoPiramide.TextureEnabled = false;
            efeitoPiramide.LightingEnabled = false;
            efeitoPiramide.VertexColorEnabled = true;

            listaPlanos3D.Add(new Create3DPlane(new Vector3(0, 0, -Camera.worldSize / 2), Camera.worldSize / 2, Vector3.Backward));

            triangleStrip = new TringleStripPlane(new Vector3(0, 0, -50), 5, Vector3.Backward);

            piramide = new Piramide(360);
        }
Пример #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //Inicializar a camara
            Camera.Initialize(GraphicsDevice);

            //Seed random
            random = new Random();

            //3DAxis
            Create3DAxis.Initialize(GraphicsDevice);

            listaPlanos3D = new List<Create3DPlane>();

            triangleStrip = new TringleStripPlane(Vector3.Zero, 5, Vector3.Left);

            variableVertexes = new VariableVertexes(Vector3.Zero, 1, 5);

            pyramidIndices = new PyramidIndices();

            pyramidBuffers = new PyramidBuffers(GraphicsDevice, random, 8);

            geometrias = new List<Geometry>();

            for (int i = 0; i < 10000; i++)
            {
                //Inicializar a geometria
                geometria = new Geometry(GraphicsDevice, random);
                geometrias.Add(geometria);
            }

            base.Initialize();
        }