protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);
            {
                ///Uncoment to add your model
                SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario");
                ///Physic info (position, rotation and scale are set here)
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ///Forward Shader (look at this shader construction for more info)
                ForwardXNABasicShader shader = new ForwardXNABasicShader();
                ///Deferred material
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                ///The object itself
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                ///Add to the world
                this.World.AddObject(obj);
            }

            {
                SnowParticleSystem snow = new SnowParticleSystem();
                DPFSParticleSystem ps = new DPFSParticleSystem("snow", snow);
                this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

                ///cant set emiter position before adding the particle
                ///IF YOU DO SO, IT WILL NOT WORK
                snow.Emitter.PositionData.Position = new Vector3(500, 0, 0);
            }


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-50), MathHelper.ToRadians(-10), new Vector3(-150, 150, 150), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);
        }
Пример #2
0
		/// <summary>
		/// Load your graphics content
		/// </summary>
		protected override void LoadContent()
		{
			mcSpriteBatch = new SpriteBatch(GraphicsDevice);

			// Load fonts and models for test application
			mcFont = Content.Load<SpriteFont>("Fonts/font");
			mcFloorModel = Content.Load<Model>("grid");
			mcSphereModel = Content.Load<Model>("SphereHighPoly");

			// Setup our render target to draw to when we want draws to persist across multiple frames
			_renderTarget = new RenderTarget2D(mcGraphics.GraphicsDevice, mcGraphics.PreferredBackBufferWidth, mcGraphics.PreferredBackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);

			// Specify vertices indicating positive axis directions
			int iLineLength = 50;
			msaAxisDirectionVertices = new VertexPositionColor[6];
			msaAxisDirectionVertices[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
			msaAxisDirectionVertices[1] = new VertexPositionColor(new Vector3(iLineLength, 1, 0), Color.Red);
			msaAxisDirectionVertices[2] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Green);
			msaAxisDirectionVertices[3] = new VertexPositionColor(new Vector3(0, iLineLength, 0), Color.Green);
			msaAxisDirectionVertices[4] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
			msaAxisDirectionVertices[5] = new VertexPositionColor(new Vector3(0, 1, iLineLength), Color.Blue);
			
			mcAxisEffect = new BasicEffect(GraphicsDevice);
			mcAxisEffect.VertexColorEnabled = true;
			mcAxisEffect.LightingEnabled = false;
			mcAxisEffect.TextureEnabled = false;
			mcAxisEffect.FogEnabled = false;
			mcAxisVertexDeclaration = VertexPositionColor.VertexDeclaration;

			// Instantiate all of the Particle Systems
			mcDPSFSplashScreenParticleSystem = new DPSFSplashScreenParticleSystem(this);
			mcRandomParticleSystem = new RandomParticleSystem(this);
			mcFireParticleSystem = new FireParticleSystem(this);
			mcFireSpriteParticleSystem = new FireSpriteParticleSystem(this);
			mcSmokeParticleSystem = new SmokeParticleSystem(this);
			mcSnowParticleSystem = new SnowParticleSystem(this);
			mcSquarePatternParticleSystem = new SquarePatternParticleSystem(this);
			mcFountainParticleSystem = new FountainParticleSystem(this);
			mcRandom2DParticleSystem = new Random2DParticleSystem(this);
			mcGasFallParticleSystem = new GasFallParticleSystem(this);
			mcDotParticleSystem = new DotParticleSystem(this);
			mcFireworksParticleSystem = new FireworksParticleSystem(this);
			mcFigure8ParticleSystem = new Figure8ParticleSystem(this);
			mcStarParticleSystem = new StarParticleSystem(this);
			mcBallParticleSystem = new BallParticleSystem(this);
			mcRotatingQuadParticleSystem = new RotatingQuadsParticleSystem(this);
			mcBoxParticleSystem = new BoxParticleSystem(this);
			mcImageParticleSystem = new ImageParticleSystem(this);
			mcAnimatedQuadParticleSystem = new AnimatedQuadParticleSystem(this);
			mcSpriteParticleSystem = new SpriteParticleSystem(this);
			mcAnimatedSpriteParticleSystem = new AnimatedSpriteParticleSystem(this);
			mcQuadSprayParticleSystem = new QuadSprayParticleSystem(this);
			mcMagnetParticleSystem = new MagnetsParticleSystem(this);
			mcSparklerParticleSystem = new SparklerParticleSystem(this);
			mcGridQuadParticleSystem = new GridQuadParticleSystem(this);
			mcSphereParticleSystem = new SphereParticleSystem(this);
			mcMultipleImagesParticleSystem = new MultipleParticleImagesParticleSystem(this);
			mcMultipleImagesSpriteParticleSystem = new MultipleParticleImagesSpriteParticleSystem(this);
			mcExplosionFireSmokeParticleSystem = new ExplosionFireSmokeParticleSystem(this);
			mcExplosionFlashParticleSystem = new ExplosionFlashParticleSystem(this);
			mcExplosionFlyingSparksParticleSystem = new ExplosionFlyingSparksParticleSystem(this);
			mcExplosionSmokeTrailsParticleSystem = new ExplosionSmokeTrailsParticleSystem(this);
			mcExplosionRoundSparksParticleSystem = new ExplosionRoundSparksParticleSystem(this);
			mcExplosionDebrisParticleSystem = new ExplosionDebrisParticleSystem(this);
			mcExplosionShockwaveParticleSystem = new ExplosionShockwaveParticleSystem(this);
			mcExplosionParticleSystem = new ExplosionParticleSystem(this);
			mcTrailParticleSystem = new TrailParticleSystem(this);
			mcSpriteParticleSystemTemplate = new SpriteParticleSystemTemplate(this);
			mcSprite3DBillboardParticleSystemTemplate = new Sprite3DBillboardParticleSystemTemplate(this);
			mcQuadParticleSystemTemplate = new QuadParticleSystemTemplate(this);
			mcTexturedQuadParticleSystemTemplate = new TexturedQuadParticleSystemTemplate(this);
			mcDefaultSpriteParticleSystemTemplate = new DefaultSpriteParticleSystemTemplate(this);
			mcDefaultSprite3DBillboardParticleSystemTemplate = new DefaultSprite3DBillboardParticleSystemTemplate(this);
			mcDefaultQuadParticleSystemTemplate = new DefaultQuadParticleSystemTemplate(this);
			mcDefaultTexturedQuadParticleSystemTemplate = new DefaultTexturedQuadParticleSystemTemplate(this);

			mcDPSFSplashScreenParticleSystem.DrawOrder = 10;
			mcRandomParticleSystem.DrawOrder = 100;
			mcFireParticleSystem.DrawOrder = 200;
			mcFireSpriteParticleSystem.DrawOrder = 250;
			mcSmokeParticleSystem.DrawOrder = 300;
			mcSnowParticleSystem.DrawOrder = 400;
			mcSquarePatternParticleSystem.DrawOrder = 500;
			mcFountainParticleSystem.DrawOrder = 600;
			mcRandom2DParticleSystem.DrawOrder = 700;
			mcGasFallParticleSystem.DrawOrder = 800;
			mcDotParticleSystem.DrawOrder = 900;
			mcFireworksParticleSystem.DrawOrder = 1000;
			mcFigure8ParticleSystem.DrawOrder = 1100;
			mcStarParticleSystem.DrawOrder = 1200;
			mcBallParticleSystem.DrawOrder = 1300;
			mcRotatingQuadParticleSystem.DrawOrder = 1400;
			mcBoxParticleSystem.DrawOrder = 1500;
			mcImageParticleSystem.DrawOrder = 1600;
			mcAnimatedQuadParticleSystem.DrawOrder = 1700;
			mcSpriteParticleSystem.DrawOrder = 1800;
			mcAnimatedSpriteParticleSystem.DrawOrder = 1900;
			mcQuadSprayParticleSystem.DrawOrder = 1925;
			mcMagnetParticleSystem.DrawOrder = 1950;
			mcSparklerParticleSystem.DrawOrder = 1960;
			mcGridQuadParticleSystem.DrawOrder = 1980;
			mcSphereParticleSystem.DrawOrder = 1990;
			mcMultipleImagesParticleSystem.DrawOrder = 2000;
			mcMultipleImagesSpriteParticleSystem.DrawOrder = 2005;
			mcExplosionFireSmokeParticleSystem.DrawOrder = 2010;
			mcExplosionFlashParticleSystem.DrawOrder = 2020;
			mcExplosionFlyingSparksParticleSystem.DrawOrder = 2030;
			mcExplosionSmokeTrailsParticleSystem.DrawOrder = 2040;
			mcExplosionRoundSparksParticleSystem.DrawOrder = 2050;
			mcExplosionDebrisParticleSystem.DrawOrder = 2060;
			mcExplosionShockwaveParticleSystem.DrawOrder = 2070;
			mcExplosionParticleSystem.DrawOrder = 2080;
			mcTrailParticleSystem.DrawOrder = 2090;
			mcSpriteParticleSystemTemplate.DrawOrder = 2200;
			mcSprite3DBillboardParticleSystemTemplate.DrawOrder = 2300;
			mcQuadParticleSystemTemplate.DrawOrder = 2350;
			mcTexturedQuadParticleSystemTemplate.DrawOrder = 2400;
			mcDefaultSpriteParticleSystemTemplate.DrawOrder = 2600;
			mcDefaultSprite3DBillboardParticleSystemTemplate.DrawOrder = 2700;
			mcDefaultQuadParticleSystemTemplate.DrawOrder = 2750;
			mcDefaultTexturedQuadParticleSystemTemplate.DrawOrder = 2800;

			// Add all Particle Systems to the Particle System Manager
			mcParticleSystemManager.AddParticleSystem(mcDPSFSplashScreenParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRandomParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSmokeParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSnowParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSquarePatternParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFountainParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRandom2DParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcGasFallParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcDotParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireworksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFigure8ParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcStarParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcBallParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRotatingQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcBoxParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcImageParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcAnimatedQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcAnimatedSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcQuadSprayParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMagnetParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSparklerParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcGridQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSphereParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMultipleImagesParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMultipleImagesSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFireSmokeParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFlashParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFlyingSparksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionSmokeTrailsParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionRoundSparksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionDebrisParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionShockwaveParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcTrailParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSpriteParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcSprite3DBillboardParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcTexturedQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultSpriteParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultSprite3DBillboardParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultTexturedQuadParticleSystemTemplate);

			// Set how often the Particle Systems should be Updated
			mcParticleSystemManager.UpdatesPerSecond = miPARTICLE_SYSTEM_UPDATES_PER_SECOND;

			// Hide text and other things while displaying the Splash Screen
			mbShowText = false; mbShowFloor = false;

			// Setup the Splash Screen to display before anything else
			mcDPSFSplashScreenParticleSystem.AutoInitialize(this.GraphicsDevice, this.Content, null);
			mcDPSFSplashScreenParticleSystem.SplashScreenComplete += new EventHandler(mcDPSFSplashScreenParticleSystem_SplashScreenComplete);
			mcCurrentParticleSystem = mcDPSFSplashScreenParticleSystem;
		}
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                SnowParticleSystem snow = new SnowParticleSystem();
                DPFSParticleSystem ps = new DPFSParticleSystem("snow", snow);
                this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

                ///cant set emiter position before adding the particle
                ///IF YOU DO SO, IT WILL NOT WORK
                snow.Emitter.PositionData.Position = new Vector3(500, 0, 0);
            }            

            ObjectThrowSmokeParticle ot = new ObjectThrowSmokeParticle(this);
            this.AddScreenUpdateable(ot);


            ///OUR Classic Model
            {
                ///Create the xml file model extractor
                ///Loads a XML file that was export by our 3DS MAX plugin
                ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
                this.AttachCleanUpAble(ext);
                ///Extract all the XML info (Model,Cameras, ...)
                ModelLoaderData data = ext.Load(factory, GraphicInfo, "ilha");
                ///Create the WOrld Loader
                ///Convert the ModelLoaderData in World Entities
                WorldLoader wl = new WorldLoader(); ///all default                
                wl.LoadWorld(factory, GraphicInfo, World, data);
            }

            #region NormalLight
            DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White);
            DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White);
            DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White);
            float li = 0.5f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            #endregion


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-50), MathHelper.ToRadians(-10), new Vector3(-200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());

        }