protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                {
                    ///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);
                }
            }

            {
                SimpleModel sm2 = new SimpleModel(factory, "Model\\ball");
                sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red, false), TextureType.DIFFUSE);
                DeferredNormalShader nd  = new DeferredNormalShader();
                IMaterial            m   = new DeferredMaterial(nd);
                SphereObject         pi2 = new SphereObject(new Vector3(100, 50, 0), 1, 10, 10, MaterialDescription.DefaultBepuMaterial());
                IObject o = new IObject(m, sm2, pi2);
                this.World.AddObject(o);

                sound2 = new ObjectFollower3DSound(factory, "Songs/pianosong", o);
                this.World.AddSoundEmitter(sound2, true);
            }

            lt = new LightThrowBepu(this.World, factory);

            #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(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
Пример #2
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractXmlModelLoader ext  = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData       data = ext.Load(factory, GraphicInfo, "leonScene");
            WorldLoader           wl   = new WorldLoader();

            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight  += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            //IModelo model = new SimpleModel(factory, "Model/leonScene");
            //IPhysicObject po = new TriangleMeshObject(model, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
            //GhostObject po = new GhostObject();
            //IShader shader = new ForwardXNABasicShader();
            //ForwardMaterial dm = new ForwardMaterial(shader);
            //this.World.AddObject(new IObject(dm, model, po));

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);

            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
        }
Пример #3
0
        void Awake()
        {
            worldInfo = FindObjectOfType <WorldInfo>();

            if (worldInfo == null)
            {
                if (!IsWorldExists(DebugWorldName))
                {
                    CreateWorld(DebugWorldName, new ChunkPos(100, 100));
                    LoadWorld(DebugWorldName);
                }
                else
                {
                    LoadWorld(DebugWorldName);
                }
                enabled = false;
                return;
            }

            worldLoader.LoadWorld(worldInfo.worldPath);
            var worldGeneratorType = Type.GetType(worldInfo.worldGeneratorType);

            worldGenerator = (WorldGenerator) new GameObject().AddComponent(worldGeneratorType);
            EnlargePool(chunkPool);
        }
Пример #4
0
        static void Main(string[] args)
        {
            var objContext  = new SingleUsageObjectContextAdapter(new DbContextFactory <HotelAdminContext>());
            var hotelRep    = new HotelRepository(objContext);
            var factTypeRep = new FactTypeRepository(objContext);
            var historyRep  = new DummyHistoryItemRepository();

            FactTypeService factTypeService = new FactTypeService(objContext, factTypeRep);
            HotelService    hotelService    = new HotelService(objContext, hotelRep, historyRep);

            if (args != null && args.Length > 0 && args[0] == "world")
            {
                int numberOfHotels = 100;
                if (args.Length > 1)
                {
                    if (!int.TryParse(args[1], out numberOfHotels))
                    {
                        numberOfHotels = 100; // Default to 100
                    }
                }
                WorldLoader.LoadWorld(hotelService, factTypeService, numberOfHotels);
                return;
            }

            Console.WriteLine("Usage: HotelAdmin.Loader.exe {{world}} [maxItems] ");
        }
Пример #5
0
    public void Button_LoadTestMap(string id)
    {
        CASCHandler = CASC.GetComponent <CascHandler>().cascHandler;
        //World.ClearAllTerrain();
        uint    WdtFileDataId = 0;
        Vector2 currentSelectedPlayerSpawn = Vector2.zero;

        switch (id)
        {
        case "BC":
        {
            WdtFileDataId = 828395;
            currentSelectedPlayerSpawn = new Vector2(32, 27);
        }
        break;

        case "Wrath":
        {
            WdtFileDataId = 822688;
            currentSelectedPlayerSpawn = new Vector2(18, 24);
        }
        break;

        case "Cata":
        {
            WdtFileDataId = 782779;
            currentSelectedPlayerSpawn = new Vector2(33, 35);
        }
        break;

        case "MoP":
        {
            WdtFileDataId = 805681;
            currentSelectedPlayerSpawn = new Vector2(32, 31);
        }
        break;

        default:
            Debug.Log("Unknown Map");
            break;
        }

        WDT.WDTEntries.Clear();
        if (WDT.ParseWDT(WdtFileDataId))
        {
            //World.LoadSingleADT(WdtFileDataId, currentSelectedPlayerSpawn);
            //world2.LoadWorld(WdtFileDataId, currentSelectedPlayerSpawn);
            world.LoadWorld(WdtFileDataId, currentSelectedPlayerSpawn);
        }
        else
        {
            Debug.Log("Error");
        }
    }
Пример #6
0
        private void CreateNewWorld()
        {
            World world;

            var worldLoader = new WorldLoader();
            world = worldLoader.LoadWorld("Data.xlsx");

            var worldCreator = new WorldCreator();
            int worldId = worldCreator.CreateWorld(world);

            Console.WriteLine("Initializing season...");
            worldSimulator.SwitchDefaultWorld(worldId);
        }
Пример #7
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractXmlModelLoader ext  = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData       data = ext.Load(factory, GraphicInfo, "sponza");
            WorldLoader           wl   = new WorldLoader();

            wl.LoadWorld(factory, GraphicInfo, World, data);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);

            #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.1f;
            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);

            //ld1 = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
            //ld1.CastShadown = true;
            //float li = 0.9f;
            //ld1.LightIntensity = li;
            //this.World.AddLight(ld1);

            #endregion

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            //cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            /////Interpolator to change lightDirection
            //inter.Start(new Vector3(0, -1, 0), new Vector3(1, -1, 1), 3, true);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
            this.RenderTechnic.AddPostEffect(new BloomPostEffect());
            //HdrPostEffect HdrPostEffect = new HdrPostEffect();
            //HdrPostEffect.bloomMultiplier = 0.3f;
            //this.RenderTechnic.AddPostEffect(HdrPostEffect);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "techdemo");
            WorldLoader wl = new WorldLoader();
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);
            {
                l = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
                l.CastShadown = true;
                float lii = 0.6f;
                l.LightIntensity = lii;
                this.World.AddLight(l);
            }

            #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);
            //DirectionalLightPE ld6 = new DirectionalLightPE(Vector3.Up, Color.White);
            //float li = 0.5f;
            //ld1.LightIntensity = li;
            //ld2.LightIntensity = li;
            //ld3.LightIntensity = li;
            //ld4.LightIntensity = li;
            //ld5.LightIntensity = li;
            //ld6.LightIntensity = li;
            //this.World.AddLight(ld1);
            //this.World.AddLight(ld2);
            //this.World.AddLight(ld3);
            //this.World.AddLight(ld4);
            //this.World.AddLight(ld5);
            //this.World.AddLight(ld6);

            #endregion

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.FarPlane = 1000;
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

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

        }
Пример #9
0
        public void Run()
        {
            Console.SetWindowSize(120, 60);
            Console.SetBufferSize(120, 600);

            var loader = new WorldLoader();
            world = loader.LoadWorld("Data.xlsx");

            var singleMatchTests = new SingleMatchTests(world);
            singleMatchTests.Perform();
            Console.ReadLine();

            var multipleMatchesTests = new MultipleMatchesTests(world);
            multipleMatchesTests.Perform(1000);
            Console.ReadLine();
        }
Пример #10
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");

            this.AttachCleanUpAble(ext);
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "shadow");
            WorldLoader     wl   = new WorldLoader();

            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight  += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            #region NormalLight
            {
                ld1             = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
                ld1.CastShadown = false;
                float li = 0.9f;
                ld1.LightIntensity = li;
                this.World.AddLight(ld1);
            }

            {
                ld1             = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.Red);
                ld1.CastShadown = true;
                float li = 2.0f;
                ld1.LightIntensity = li;
                this.World.AddLight(ld1);
            }


            #endregion

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

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

            ///Interpolator to change lightDirection
            inter.Start(new Vector3(0, -1, 0), new Vector3(1, -1, 1), 3, true);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }
Пример #11
0
        public void LoadWorld(string saveName)
        {
            if (World != null)
            {
                return;
            }

            ParticleRenderer = new ParticleRenderer();
            SkyboxRenderer   = new SkyboxRenderer();

            World loadedWorld = WorldLoader.LoadWorld(saveName);

            if (loadedWorld == null)
            {
                Console.WriteLine("DEBUG: generating World");

                BlockPos playerPos = new BlockPos(MathUtil.NextFloat(-100, 100), 10, MathUtil.NextFloat(-100, 100));

                World = new World("MyWorld", "Tomlow's Fuckaround",
                                  SettingsManager.GetValue("worldseed").GetHashCode());

                Player = new EntityPlayerSP(World, playerPos.ToVec());

                World.AddEntity(Player);

                Player.SetItemStackInInventory(0, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockCraftingTable>())));
                Player.SetItemStackInInventory(1, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockFurnace>())));
                Player.SetItemStackInInventory(2, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockCobbleStone>())));
                Player.SetItemStackInInventory(3, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockPlanks>())));
                Player.SetItemStackInInventory(4, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockGlass>())));
                Player.SetItemStackInInventory(5, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockCraftingTable>())));
                Player.SetItemStackInInventory(6, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockSlab>())));
                Player.SetItemStackInInventory(7, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockLadder>())));
                Player.SetItemStackInInventory(8, new ItemStack(new ItemBlock(BlockRegistry.GetBlock <BlockTallGrass>())));
            }
            else
            {
                World = loadedWorld;
            }

            ResetMouse();

            MouseState state = OpenTK.Input.Mouse.GetState();

            _mouseLast = new Point(state.X, state.Y);
        }
Пример #12
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     GoombaSpriteFactory.Instance.LoadAllTextures(Content);
     BowserSpriteFactory.Instance.LoadAllTextures(Content);
     KoopaSpriteFactory.Instance.LoadAllTextures(Content);
     ItemSpriteFactory.Instance.LoadAllTextures(Content);
     BlockSpriteFactory.Instance.LoadAllTextures(Content);
     WorldElementSpriteFactory.Instance.LoadAllTextures(Content);
     MarioSpriteFactory.Instance.LoadAllTextures(Content);
     FireballSpriteFactory.Instance.LoadAllTextures(Content);
     AchievementSpriteFactory.Instance.LoadAllTextures(Content);
     LakituSpriteFactory.Instance.LoadAllTextures(Content);
     SoundEffects.Instance.LoadSoundEffects(Content);
     Songs.Instance.LoadSongs(Content);
     HUD = new HeadsUpDisplay(this, Content);
     WorldLoader.LoadWorld("Level1-1", this);
     Songs.Instance.PlaySong();
     Tester.RunTests(this);
 }
Пример #13
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractMeshesFromMoldelLoader ext = new ExtractMeshesFromMoldelLoader();
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "Model//leonScene");
            WorldLoader     wl   = new WorldLoader();

            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);


            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);

            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
        }
Пример #14
0
        protected override void Initialize()
        {
            Quit       = () => { this.Exit(); };
            LevelReset = () => { if (State == GameState.InGame)
                                 {
                                     GameWorld = WorldLoader.LoadWorld(Selector.CurrentLevel, this);
                                 }
            };
            MenuReset = () => { State = GameState.WorldSelector; };

            InputActions.LoadInputActions(this);
            controllers = new List <IController>();
            KeyboardController keyboard = new KeyboardController(this);
            GamePadController  gamepad  = new GamePadController(this);

            controllers.Add(keyboard);
            controllers.Add(gamepad);

            Selector = new LevelSelector(this);
            State    = GameState.WorldSelector;

            base.Initialize();
        }
Пример #15
0
        public void LoadWorld(string saveName)
        {
            if (World != null)
            {
                return;
            }

            ParticleRenderer = new ParticleRenderer();
            SkyboxRenderer   = new SkyboxRenderer();

            World loadedWorld = WorldLoader.LoadWorld(saveName);

            if (loadedWorld == null)
            {
                Console.WriteLine("DEBUG: generating World");

                BlockPos playerPos = new BlockPos(0, 10, 0);//MathUtil.NextFloat(-100, 100));

                World = new WorldClient("MyWorld", "Tomlow's Fuckaround", SettingsManager.GetString("worldseed"));

                Player = new EntityPlayerSp(World, playerPos.ToVec());

                World.AddEntity(Player);

                Player.SetItemStackInInventory(0, new ItemStack(ItemRegistry.GetItem(BlockRegistry.GetBlock <BlockCraftingTable>())));
            }
            else
            {
                World = loadedWorld;
            }

            ResetMouse();

            MouseState state = Mouse.GetState();

            _mouseLast = new Point(state.X, state.Y);
        }
Пример #16
0
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///must be called before all
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///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, "lionscene");
            ///Create the WOrld Loader
            ///Convert the ModelLoaderData in World Entities
            WorldLoader wl = new WorldLoader();

            ///Register some Custom Handler
            ///The Default arent good all the time
            ///Called when an object is created, the default creates a triangle mesh entity and a deferred Material (whith Custom Shader) and add it to the world
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            ///When a ligh is created, the default just add the light
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            ///when a camera is created, the default just add the camera
            wl.OnCreateICamera += new CreateICamera(wl_OnCreateICamera);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            ///Add some directional lights
            #region Lights
            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.3f;
            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

            ///Add a post effect
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

            ///add a camera
            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-30), new Vector3(50, 50, 75), GraphicInfo);
            cam.FarPlane  = 500;
            cam.NearPlane = 1;

            this.World.CameraManager.AddCamera(cam);

            {
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.B, bumpChange);
                this.BindInput(ik);
            }
            {
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.V, specularChange);
                this.BindInput(ik);
            }

            lt = new LightThrowBepu(this.World, factory);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///Create the water
            ///Water is just a Shader that Creates a Water like texture and binds it to a model
            {
                IModelo sm    = new SimpleModel(factory, "Model\\block");
                Matrix  trans = Matrix.CreateTranslation(new Vector3(0, 50, 0));
                Plane   plano = Plane.Transform(new Plane(0, 1, 0, 0), trans);
                ///The water is VERRRRY big, the reflection and refraction will looks like blocked, its normal, increasy the size of the reflection/refrection buffer to correct this (bigger cost)
                ///We normally use the SAME transformation applyied to the plane (if not stranges affects can happen)
                IPhysicObject pi = new BoxObject(new Vector3(0, 50, 0), 1, 1, 1, 5, new Vector3(3000, 0.1f, 3000), trans, MaterialDescription.DefaultBepuMaterial());
                pi.isMotionLess = true;
                ///Water shader, will refract and reflect according to the plano passed in the parameter
                ///Using default Parameters, there are lots of things that can be changed. See WaterCompleteShader
                DeferredWaterCompleteShader shader = new DeferredWaterCompleteShader(800, 600, plano, 0.1f);
                shader.SpecularIntensity = 0.01f;
                shader.SpecularPower     = 50;
                IMaterial mat  = new DeferredMaterial(shader);
                IObject   obj4 = new IObject(mat, sm, pi);
                this.World.AddObject(obj4);
            }

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");

            this.AttachCleanUpAble(ext);
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "shadow");
            WorldLoader     wl   = new WorldLoader();

            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight  += new CreateILight(wl_OnCreateILight);
            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);
            DirectionalLightPE ld6 = new DirectionalLightPE(Vector3.Up, Color.White);
            float li = 0.5f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            ld6.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            this.World.AddLight(ld6);
            #endregion

            this.World.CameraManager.AddCamera(new CameraFirstPerson(true, GraphicInfo));

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

            lt = new LightThrowBepu(this.World, factory, 100);
        }
Пример #18
0
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                ///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);
            }


            ///Create and add a sound to the SoundAudioPlayer
            ap = new SoundAudioPlayer(factory);
            ap.AddSoundToRepository("Songs/bye", "bye");

            ///Create a sound effect without the SoundAudioPlayer (internaly the SoundAudioPlayer is a container of SimpleSoundEffect -- and some stuffs more)
            se = new SimpleSoundEffect(factory, "Songs/alarm");

            ///Load the Sounds that you hear in your Microsoft Media Player
            ///Just loading the first album found =P
            lm = new LocalMediaAudioPlayer();
            AlbumCollection ac = lm.MediaLibrary.Albums;

            lm.PlayAlbum(ac[0]);

            ///Creating a static 3D sound in the 0,0,0 (Bellow the island tree, go there and hear the sound getting louder)
            sound = new Static3DSound(factory, "Songs/pianosong", Vector3.Zero);
            this.World.AddSoundEmitter(sound, true);

            #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(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
Пример #19
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                ///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);
            }

            NeoforceGui guiManager = this.Gui as NeoforceGui;

            System.Diagnostics.Debug.Assert(guiManager != null);

            // Create and setup Window control.
            Window window = new Window(guiManager.Manager);

            window.Init();
            window.Text   = "Getting Started";
            window.Width  = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            // Create Button control and set the previous window as its parent.
            Button button = new Button(guiManager.Manager);

            button.Init();
            button.Text   = "OK";
            button.Width  = 72;
            button.Height = 24;
            button.Left   = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top    = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            // Add the window control to the manager processing queue.
            guiManager.Manager.Add(window);



            #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

            this.World.CameraManager.AddCamera(new CameraFirstPerson(false, GraphicInfo));

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

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
Пример #20
0
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                ///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);
            }

            {
                ///Procedural diffuse texture
                SimpleModel sm = new SimpleModel(factory, "Model\\block");
                sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.BlueViolet), TextureType.DIFFUSE);
                ///physic Ghost object(no collision)
                GhostObject pi = new GhostObject(new Vector3(0, 0, 0), Matrix.Identity, new Vector3(500, 500, 500));
                pi.isMotionLess = true;
                ///Transparency shader
                ///Transparent objects are NOT affected by lights
                ///It is a forward shader in the deferred engine (applied after all deferreed processing)
                ForwardTransparenteShader s = new ForwardTransparenteShader();
                ///If the texture does not have Alpha, you can create an alpha for all the model
                s.TransparencyLevel = 0.3f;
                ///THIS MODEL is DRAW AFTER all the Deferred ones (remember:light wont afect it)
                ///You can use all the forward material the same way we are using this
                ForwardMaterial mat  = new ForwardMaterial(s);
                IObject         obj4 = new IObject(mat, sm, pi);
                this.World.AddObject(obj4);
            }


            ///Transparent blocks
            for (int k = 0; k < 5; k++)
            {
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        ///Procedural yellow diffuse texture
                        SimpleModel sm = new SimpleModel(factory, "Model\\block");
                        sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE);
                        ///physic Ghost object(no collision)
                        GhostObject pi = new GhostObject(new Vector3(i * 10 + 100, 50 + k * 10, j * 10), Matrix.Identity, new Vector3(5));
                        pi.isMotionLess = true;
                        ///Transparency shader
                        ///Transparent objects are NOT affected by lights
                        ///It is a forward shader in the deferred engine (applied after all deferreed processing)
                        ForwardTransparenteShader s = new ForwardTransparenteShader();
                        ///If the texture does not have Alpha, you can create an alpha for all the model
                        s.TransparencyLevel = 0.3f;
                        ///THIS MODEL is DRAW AFTER all the Deferred ones (remember:light wont afect it)
                        ///You can use all the forward material the same way we are using this
                        ForwardMaterial mat  = new ForwardMaterial(s);
                        IObject         obj4 = new IObject(mat, sm, pi);
                        this.World.AddObject(obj4);
                    }
                }
            }

            lt = new LightThrowBepu(this.World, factory);

            #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

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

            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-10), new Vector3(150, 150, 200), GraphicInfo);

            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCUBE");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
Пример #21
0
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///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, "SSAO");
            ///Create the WOrld Loader
            ///Convert the ModelLoaderData in World Entities
            WorldLoader wl = new WorldLoader();

            ///Register some Custom HAnlder
            ///The Default arent good all the time
            ///Called when an object is created, the default creates a triangle mesh entity and a deferred Material (whith Custom Shader) and add it to the world
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            ///When a ligh is created, the default just add the light
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            ///when a camera is created, the default just add the camera
            wl.OnCreateICamera += new CreateICamera(wl_OnCreateICamera);
            wl.LoadWorld(factory, GraphicInfo, World, data);
            ///Add some directional lights to completely iluminate the world
            #region Lights
            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.4f;
            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

            {
                ///har way
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Enter, Active);
                this.BindInput(ik);
            }

            {
                ///easy way
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space);
                ik.KeyStateChange += new KeyStateChange(ik_KeyStateChange);
                this.BindInput(ik);
            }

            ssao = new SSAOPostEffect();
            //ssao.OutputONLYSSAOMAP = true;
            ssao.WhiteCorrection = 0.7f;
            ssao.Intensity       = 5;
            ssao.Diffscale       = 0.5f;

            ///Add a AA post effect
            this.RenderTechnic.AddPostEffect(ssao);


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(0), MathHelper.ToRadians(-10), new Vector3(0, 100, 150), GraphicInfo);
            ///add a camera
            this.World.CameraManager.AddCamera(cam);
        }
Пример #22
0
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///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, "lionscene");
            ///Create the WOrld Loader
            ///Convert the ModelLoaderData in World Entities
            WorldLoader wl = new WorldLoader();

            ///Register some Custom HAnlder
            ///The Default arent good all the time
            ///Called when an object is created, the default creates a triangle mesh entity and a deferred Material (whith Custom Shader) and add it to the world
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            ///When a ligh is created, the default just add the light
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            ///when a camera is created, the default just add the camera
            wl.OnCreateICamera += new CreateICamera(wl_OnCreateICamera);
            wl.LoadWorld(factory, GraphicInfo, World, data);


            ///the classical light throw
            lt = new LightThrowBepu(this.World, factory);

            ///Classical lights
            #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

            ///Classic Camera =P

            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-30), new Vector3(50, 50, 75), GraphicInfo);
            cam.FarPlane   = 500;
            cam.NearPlane  = 1;
            cam.MoveSpeed *= 2;


            this.World.CameraManager.AddCamera(cam);

            ///Some basic AA
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }
Пример #23
0
        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());
        }