public override void Prepare()
        {
            KWEngine.LoadModelFromFile("ConvexHull", @".\models\convexhull.glb");
            KWEngine.LoadModelFromFile("MS", @".\models\obj\mothership01_ball_end.obj");

            FOV = 45;

            SetAmbientLight(1, 1, 1, 1f);

            SetCameraPosition(0, 25, 0);
            SetCameraTarget(0, 0, 0);

            SetTextureSkybox(@".\textures\skybox1.dds");
            SetTextureBackgroundBrightnessMultiplier(4);

            /*
             * LightObject sun = new LightObject(LightType.Sun, true);
             * sun.SetPosition(30, 30, 30);
             * sun.SetColor(1, 1, 1, 0.8f);
             * sun.SetFOVBiasCoefficient(0.00009f);
             * AddLightObject(sun);
             */

            DebugShowPerformanceInTitle   = PerformanceUnit.FramesPerSecond;
            DebugShowCoordinateSystemGrid = GridType.GridXZ;

            CreateTestScene();
        }
Esempio n. 2
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("ConvexHull", @".\models\convexhull.glb");
            KWEngine.LoadModelFromFile("Paddle", @".\models\paddle.obj");

            FOV = 90;

            SetAmbientLight(1, 1, 1, 0.2f);

            SetCameraPosition(0, 0, 25);
            SetCameraTarget(0, 0, 0);

            SetTextureSkybox(@".\textures\skybox1.dds");
            SetTextureBackgroundBrightnessMultiplier(4);


            LightObject sun = new LightObject(LightType.Sun, false);

            sun.SetPosition(30, 30, 30);
            sun.SetColor(1, 1, 1, 0.8f);
            AddLightObject(sun);

            DebugShowPerformanceInTitle   = PerformanceUnit.FramesPerSecond;
            DebugShowCoordinateSystemGrid = GridType.GridXY;
            //DebugShowHitboxes = true;

            CreateTestScene();
        }
Esempio n. 3
0
        public override void Prepare()
        {
            //KWEngine.BuildTerrainModel("TerrainTest", @".\textures\heightmap256.png", @".\textures\sand_diffuse.dds", 10, 1, 10, 10, 10);
            KWEngine.BuildTerrainModel("TerrainTest", @".\textures\heightmapterraintest2x2.png", @".\textures\sand_diffuse.dds", 15, 5, 15, 10, 10);
            KWEngine.LoadModelFromFile("UBot", @".\models\jumpandrun\ubot.fbx");

            FOV = 90;
            SetAmbientLight(1, 1, 1, 0.25f);
            SetTextureSkybox(@".\textures\skybox_mipmaptest.jpg");
            SetTextureBackgroundBrightnessMultiplier(4);



            Immovable t = new Immovable();

            t.SetModel("TerrainTest");
            t.IsCollisionObject = true;
            t.SetPosition(5, 0, 0);
            //t.SetPositionY(1);
            AddGameObject(t);

            //CreateFreeFloatPlayer();
            CreateUBotPlayer();

            LightObject sun = new LightObject(LightType.Sun, false);

            sun.SetPosition(100, 100, 100);
            sun.SetColor(1, 1, 1, 1);
            AddLightObject(sun);

            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;

            //DebugShowCoordinateSystemGrid = GridType.GridXZ;
        }
Esempio n. 4
0
        private void CreateTerrainTestObject()
        {
            KWEngine.BuildTerrainModel("Terrain", @".\textures\heightmap2.png", @".\textures\sand_diffuse.dds", 20, 2, 20, 1, 1);
            Immovable floor2 = new Immovable();

            floor2.SetModel("Terrain");
            floor2.IsCollisionObject = true;
            floor2.SetPosition(0, -12, 0);
            floor2.SetTexture(@".\textures\sand_normal.dds", TextureType.Normal);
            AddGameObject(floor2);
        }
Esempio n. 5
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("AK47", @".\models\ak47.obj");

            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
            FOV = 90;
            SetAmbientLight(1, 1, 1, 0.5f);

            Player p = new Player();

            p.SetModel("KWCube");
            p.SetScale(1, 2, 1);
            p.SetPosition(0, 1, 0);
            p.IsCollisionObject = true;
            p.FPSEyeOffset      = 0;
            AddGameObject(p);
            SetFirstPersonObject(p);

            Immovable floor = new Immovable();

            floor.SetModel("KWCube");
            floor.SetScale(50, 2, 50);
            floor.SetPosition(0, -1, 0);
            floor.IsCollisionObject = true;
            floor.IsShadowCaster    = true;
            floor.SetTexture(@".\textures\sand_diffuse.dds");
            floor.SetTextureRepeat(10, 10);
            AddGameObject(floor);

            Immovable shadowCaster = new Immovable();

            shadowCaster.SetModel("KWCube");
            shadowCaster.IsShadowCaster = true;
            shadowCaster.SetPosition(0, 3, 2);
            shadowCaster.SetScale(2);
            shadowCaster.SetTexture(@".\textures\mpanel_diffuse.dds");
            AddGameObject(shadowCaster);

            SetFirstPersonObjectItemModel("AK47", true, true);
            SetFirstPersonObjectItemModelViewOffset(0.5f, -1, 0f);
            SetFirstPersonObjectItemModelRotation(0, 0, 0);
            SetFirstPersonObjectItemModelScale(1.25f);

            SetTextureSkybox(@".\textures\skybox3.dds");

            LightObject l1 = new LightObject(LightType.Sun, true);

            l1.SetPosition(50, 100, 50);
            l1.SetColor(1, 0, 0, 5);
            //l1.SetDistanceMultiplier(10);
            AddLightObject(l1);

            //DebugShadowLight = l1;
        }
Esempio n. 6
0
        private void CreateTerrainTestObject()
        {
            KWEngine.BuildTerrainModel("Terrain", @".\textures\heightmap.png", @".\textures\sand_diffuse.dds", 10, 1, 10, 1, 1);
            Immovable floor2 = new Immovable();

            floor2.SetModel("Terrain");
            floor2.IsCollisionObject = true;
            floor2.IsShadowCaster    = true;
            floor2.SetPosition(5, 0, 5);
            floor2.SetRoughness(0.9f);
            floor2.SetTexture(@".\textures\sand_normal.dds", TextureType.Normal);
            floor2.SetTextureTerrainBlendMapping(
                @".\textures\blendmap.png",
                @".\textures\metal022_1K_Color.jpg",
                @".\textures\bg_greenmountains.dds",
                @".\textures\metalplates006_1k_color.jpg");
            AddGameObject(floor2);
        }
Esempio n. 7
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("UBot", @".\Models\JumpAndRun\UBot.fbx");
            KWEngine.LoadModelFromFile("Platform10", @".\Models\JumpAndRun\Platform10.obj");
            KWEngine.LoadModelFromFile("Platform02", @".\Models\JumpAndRun\Platform02.obj");

            SetTextureBackground(@".\Textures\bg_greenmountains.dds", 1, 1);
            WorldDistance = 1000;

            SetCameraPosition(0, 0, 50);
            SetCameraTarget(0, 0, 0);
            FOV = 30;

            GeneratePlatforms();

            // Player object:
            _player = new Player();
            _player.SetModel("UBot");
            _player.SetScale(2);
            _player.SetColor(0.9f, 0.9f, 0.9f);
            _player.SetRotation(0, 90, 0);
            _player.SetMetalness(0.25f);
            _player.Name = "Heinz";
            _player.SetPosition(0, 4f, 0);
            _player.IsCollisionObject = true;
            _player.UpdateLast        = true;
            AddGameObject(_player);

            Platform floor = new Platform();

            floor.SetModel("Platform02");
            floor.IsCollisionObject = true;
            floor.SetPosition(0, 3f, 0);
            AddGameObject(floor);

            SetAmbientLight(1, 1, 1, 0.4f);
            SetTextureBackgroundBrightnessMultiplier(2.5f);
            _sun = new LightObject(LightType.Sun, false);
            _sun.SetColor(1, 1, 1, 3.5f);
            UpdateSunPosition();
            AddLightObject(_sun);
            //DebugShadowLight = _sun;
        }
Esempio n. 8
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("UBot", @".\models\KlotzMann.fbx");
            KWEngine.LoadModelFromFile("AK47", @".\models\ak47.obj");
            foreach (string name in KWEngine.GetModelBoneNames("UBot"))
            {
                Console.WriteLine(name);
            }
            FOV = 90;
            SetAmbientLight(1, 1, 1, 1);
            SetTextureSkybox(@".\textures\skybox_mipmaptest.jpg");
            SetTextureBackgroundBrightnessMultiplier(1f);

            SetCameraPosition(0, 2.5f, 10);
            SetCameraTarget(0, 2.5f, 0);

            CreateUBotPlayer();

            DebugShowCoordinateSystemGrid = GridType.GridXY;
        }
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("GLTFHULL", @".\models\gltfclippingtest.fbx");
            FOV = 90;

            SetAmbientLight(1, 1, 1, 0.3f);
            SetCameraPosition(0, 5, 10);
            SetCameraTarget(0, 2.5f, 0);

            LightObject sun = new LightObject(LightType.Sun, false);

            sun.SetPosition(30, 30, 30);
            sun.SetColor(1, 1, 1, 0.75f);
            AddLightObject(sun);

            DebugShowPerformanceInTitle   = PerformanceUnit.FramesPerSecond;
            DebugShowCoordinateSystemGrid = GridType.GridXZ;
            //DebugShowHitboxes = true;

            CreateTestScene();
        }
Esempio n. 10
0
        public override void Prepare()
        {
            //KWEngine.LoadModelFromFile("ddstest", @".\models\placeholdertest.gltf");
            KWEngine.LoadModelFromFile("MatTest", @".\models\gltftestcube.glb");
            KWEngine.LoadModelFromFile("MatTest255", @".\models\gltftestcube255.glb");
            KWEngine.LoadModelFromFile("EmissionTest", @".\models\emission_gltf_test.glb");

            FOV = 45;

            SetAmbientLight(1, 1, 1, 0.2f);

            SetCameraPosition(0, 10, 0);
            SetCameraTarget(0, 0, 0);

            SetTextureSkybox(@".\textures\skybox1.dds");
            //SetTextureBackground(@".\textures\bg_greenmountains.png");
            SetTextureBackgroundBrightnessMultiplier(5f);

            CreateMetalSphereTestObject();
            CreateCubeTestObject();
            CreateGLBTestObject();
            CreateTerrainTestObject();

            //CreateRoomForLightTest();


            CreateFreeFloatPlayer();

            LightObject sun = new LightObject(LightType.Sun, true);

            sun.SetPosition(30, 30, 30);
            sun.SetFOVBiasCoefficient(0.02f);
            sun.SetColor(1, 1, 1, 3);
            AddLightObject(sun);

            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
            //DebugShadowLight = sun;
            DebugShowCoordinateSystemGrid = GridType.GridXZ;
        }
Esempio n. 11
0
        public override void Prepare()
        {
            FOV = 90;



            KWEngine.LoadModelFromFile("ArenaOuter", @".\Models\ArenaOuter\ArenaOuter.fbx");
            KWEngine.LoadModelFromFile("ArenaPlatform", @".\Models\ArenaOuter\ArenaPlatform.obj");
            KWEngine.LoadModelFromFile("ArenaPlatforms", @".\Models\ArenaOuter\ArenaPlatforms.fbx");
            KWEngine.LoadModelFromFile("AK47", @".\models\ak47.obj");

            KWEngine.BuildTerrainModel("Arena", @".\textures\heightmapArena.png", @".\textures\sand_diffuse.dds", 150, 10, 150, 7.5f, 7.5f);
            Immovable terra = new Immovable();

            terra.SetModel("Arena");
            terra.SetPosition(0, -0.5f, 0);
            terra.IsShadowCaster = true;
            terra.SetTexture(@".\textures\sand_normal.dds", TextureType.Normal);
            AddGameObject(terra);


            Immovable floor = new Immovable();

            floor.SetModel("KWCube");
            floor.SetScale(80, 5, 80);
            floor.SetPosition(0, -2.5f, 0);
            floor.SetTextureRepeat(5, 5);
            floor.IsCollisionObject = true;
            floor.IsShadowCaster    = true;
            floor.SetTexture(@".\textures\sand_diffuse.dds");
            floor.SetTexture(@".\textures\sand_normal.dds", TextureType.Normal);
            AddGameObject(floor);

            Immovable arenaOuter = new Immovable();

            arenaOuter.SetModel("ArenaOuter");
            arenaOuter.IsCollisionObject = true;
            arenaOuter.IsShadowCaster    = true;
            AddGameObject(arenaOuter);


            Immovable arenaPlatforms = new Immovable();

            arenaPlatforms.SetModel("ArenaPlatforms");
            arenaPlatforms.IsCollisionObject = true;
            arenaPlatforms.IsShadowCaster    = true;
            AddGameObject(arenaPlatforms);

            PlatformUpDown testPlatform = new PlatformUpDown();

            testPlatform.SetModel("ArenaPlatform");
            testPlatform.SetScale(1.5f);
            testPlatform.SetMetalness(1);
            testPlatform.SetRoughness(0.5f);
            testPlatform.SetPosition(15, 1.5f, 0);
            testPlatform.IsCollisionObject = true;
            testPlatform.IsShadowCaster    = true;
            AddGameObject(testPlatform);


            _player = new Player();
            _player.SetModel("KWCube");
            _player.SetScale(1, 2, 1);
            _player.IsShadowCaster    = false;
            _player.IsCollisionObject = true;
            _player.SetPosition(25, 1f, 25);
            _player.FPSEyeOffset = 0.75f;
            _player.UpdateLast   = true;
            AddGameObject(_player);
            SetFirstPersonObject(_player, 230);

            SetFirstPersonObjectItemModel("AK47", true, true);
            SetFirstPersonObjectItemModelViewOffset(0.5f, -1, 0);

            SetTextureSkybox(@".\textures\skybox1.dds");
            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;

            _sunLightWithShadow = new LightObject(LightType.Sun, true);
            _sunLightWithShadow.SetPosition(200, 200, 50);
            _sunLightWithShadow.SetTarget(25, 25, 0);
            _sunLightWithShadow.SetColor(1, 0.75f, 0.5f, 2.5f);
            _sunLightWithShadow.SetNearAndFarBounds(100, 400);
            _sunLightWithShadow.SetFOV(125);
            _sunLightWithShadow.SetFOVBiasCoefficient(_alpha, _hardness);
            AddLightObject(_sunLightWithShadow);
            //DebugShadowLight = _sunLightWithShadow;

            SetAmbientLight(1, 0.75f, 0.5f, 0.3f);
            SetTextureBackgroundBrightnessMultiplier(4);
        }
Esempio n. 12
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("Spaceship4", @".\Models\Spaceship\spaceship4.obj");
            KWEngine.LoadModelFromFile("Spaceship5", @".\Models\Spaceship\spaceship5.obj");
            KWEngine.LoadModelFromFile("Spaceship2", @".\Models\Spaceship\spaceship2.obj");
            KWEngine.LoadModelFromFile("Spaceship6", @".\Models\Spaceship\spaceship6.obj");

            //SoundPlay(@".\audio\dom.ogg", true, 0.4f);

            if (!_test)
            {
                _p = new Player();
                _p.SetModel("Spaceship4");
                _p.Name = "Player";
                _p.SetPositionY(-9);
                _p.SetRotation(90, 0, 180);
                _p.IsCollisionObject = true;
                AddGameObject(_p);
            }
            else
            {
                Box b1 = new Box();
                b1.SetModel("KWCube");
                b1.IsCollisionObject = true;
                b1.SetColor(1, 0, 0);
                b1.SetScale(10, 1, 1);
                b1.SetPosition(-5, 5, 0);
                b1.Name = "A";

                Box b2 = new Box();
                b2.SetModel("KWCube");
                b2.IsCollisionObject = true;
                b2.SetColor(0, 1, 0);
                b2.SetScale(1, 1, 1);
                b2.SetPosition(-8, 4, 0);
                b2.Name = "B";

                Box b3 = new Box();
                b3.SetModel("KWCube");
                b3.IsCollisionObject = true;
                b3.SetColor(1, 1, 0);
                b3.SetScale(3, 1, 1);
                b3.SetPosition(-5, 3, 0);
                b3.Name = "C";

                Box b4 = new Box();
                b4.SetModel("KWCube");
                b4.IsCollisionObject = true;
                b4.SetColor(0, 0, 1);
                b4.SetPosition(-3.5f, 2, 0);
                b4.SetScale(3, 1, 1);
                b4.Name = "D";

                Box b5 = new Box();
                b5.SetModel("KWCube");
                b5.IsCollisionObject = true;
                b5.SetColor(0, 1, 1);
                b5.SetScale(2, 1, 1);
                b5.SetPosition(3, 1, 0);
                b5.Name = "E";

                Box b6 = new Box();
                b6.SetModel("KWCube");
                b6.IsCollisionObject = true;
                b6.SetColor(1, 1, 1);
                b6.SetScale(2, 1, 1);
                b6.SetPosition(6, 0, 0);
                b6.Name = "F";

                Box b7 = new Box();
                b7.SetModel("KWCube");
                b7.IsCollisionObject = true;
                b7.SetColor(0.5f, 1, 0.5f);
                b7.SetScale(2, 1, 1);
                b7.SetPosition(7, -1, 0);
                b7.Name = "G";


                AddGameObject(b1);
                AddGameObject(b2);
                AddGameObject(b3);
                AddGameObject(b4);
                AddGameObject(b5);
                AddGameObject(b6);
                AddGameObject(b7);
            }

            FOV = 90;
            SetTextureBackground(@".\textures\spacebackground.dds", 2, 2);
            SetAmbientLight(1, 1, 1, 1);
            KWEngine.DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
        }
Esempio n. 13
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("Robot", @".\models\UBot\ubot.fbx");
            KWEngine.LoadModelFromFile("Lab", @".\models\labyrinth\walls.obj");
            KWEngine.LoadModelFromFile("Panel", @".\models\spacepanel\scifipanel.obj");
            KWEngine.LoadModelFromFile("Spaceship", @".\models\spaceship\spaceship4.obj");

            KWEngine.BuildTerrainModel("Terrain", @".\textures\heightmap.png", @".\textures\sand_diffuse.dds", 100, 2, 100, 5, 5);

            SetAmbientLight(0, 0.25f, 1f, 0.25f);
            SetCameraPosition(100, 100, 100);
            WorldDistance = 1000;

            Immovable ship = new Immovable();

            ship.SetModel("Spaceship");
            ship.IsCollisionObject = true;
            ship.IsShadowCaster    = true;
            ship.SetPosition(-35, 3.5f, -25);
            ship.SetScale(15);
            ship.AddRotationZ(25, true);
            ship.AddRotationX(40, true);
            AddGameObject(ship);

            Immovable floor = new Immovable();

            floor.SetModel("Terrain");
            floor.IsCollisionObject = true;
            floor.IsShadowCaster    = true;
            floor.SetTexture(@".\textures\sand_normal.dds", TextureType.Normal);
            AddGameObject(floor);

            Immovable wallLeft1 = new Immovable();

            wallLeft1.Name = "WallLeft";
            wallLeft1.SetModel("KWCube");
            wallLeft1.IsCollisionObject = true;
            wallLeft1.IsShadowCaster    = true;
            wallLeft1.SetScale(2, 10, 100);
            wallLeft1.SetPosition(-49, 5, 0);
            AddGameObject(wallLeft1);

            Immovable wallRight = new Immovable();

            wallRight.Name = "WallRight";
            wallRight.SetModel("KWCube");
            wallRight.IsCollisionObject = true;
            wallRight.IsShadowCaster    = true;
            wallRight.SetScale(2, 10, 100);
            wallRight.SetPosition(49, 5, 0);
            AddGameObject(wallRight);

            Immovable wallFront = new Immovable();

            wallFront.Name = "WallFront";
            wallFront.SetModel("KWCube");
            wallFront.IsCollisionObject = true;
            wallFront.IsShadowCaster    = true;
            wallFront.SetScale(100, 10, 2);
            wallFront.SetPosition(0, 5, 49);
            AddGameObject(wallFront);

            Immovable wallBack = new Immovable();

            wallBack.Name = "WallBack";
            wallBack.SetModel("KWCube");
            wallBack.IsCollisionObject = true;
            wallBack.IsShadowCaster    = true;
            wallBack.SetScale(100, 10, 2);
            wallBack.SetPosition(0, 5, -49);
            AddGameObject(wallBack);

            p = new Player();
            p.SetModel("Robot");
            p.Name = "Player";
            p.SetPosition(-5, 0f, -5);
            p.SetScale(4);
            p.AnimationID         = 0;
            p.AnimationPercentage = 0;
            p.IsShadowCaster      = true;
            p.IsCollisionObject   = true;
            p.IsPickable          = true;
            p.TurnTowardsXZ(new Vector3(0, 0, 0));
            //p.SetSpecularOverride(true, 8, 32);
            AddGameObject(p);
            //SetFirstPersonObject(p);

            p._flashlight = new LightObject(LightType.Directional, true);
            p._flashlight.SetColor(1, 0.75f, 0, 5f);
            p._flashlight.SetNearAndFarBounds(1f, 10);
            p._flashlight.SetFOV(150);
            //p._flashlight.SetFOVBiasCoefficient(0.025f);
            AddLightObject(p._flashlight);


            Immovable lab = new Immovable();

            lab.Name = "Labyrinth";
            lab.SetModel("Lab");
            lab.IsCollisionObject = true;
            lab.IsShadowCaster    = true;
            //lab.SetSpecularOverride(true, 0, 2048);
            AddGameObject(lab);

            Panel panel = new Panel();

            panel.Name = "Panel";
            panel.SetModel("Panel");
            panel.SetPosition(10, 0.25f, -5);
            panel.SetScale(3);
            //panel.SetSpecularOverride(true, 2, 1024);
            //panel.SetTextureForMesh(0, @".\models\spacepanel\scifipanel2.png");
            panel.IsShadowCaster    = true;
            panel.IsPickable        = true;
            panel.IsCollisionObject = true;
            AddGameObject(panel);

            /*
             * PanelLight pLight = new PanelLight();
             * pLight.Type = LightType.Directional;
             * pLight.SetColor(1, 1, 1, 1);
             * pLight.SetPosition(10, 5, -5);
             * pLight.SetTarget(10, 0, -5);
             * pLight.SetDistanceMultiplier(5f);
             * AddLightObject(pLight);
             */

            LightObject sun = new LightObject(LightType.Sun, true);

            sun.SetPosition(125, 200, -125);
            sun.SetTarget(0, 0, 0);
            sun.SetFOV(140);
            sun.SetNearAndFarBounds(100, 400);
            sun.SetColor(0, 0.5f, 1.0f, 0.5f);
            AddLightObject(sun);

            HUDObject ho = new HUDObject(HUDObjectType.Text, 24, 24);

            ho.SetText("kwengine.de");
            ho.SetGlow(1, 0, 0, 1);
            ho.SetRotation(0, 0);
            AddHUDObject(ho);

            //DebugShadowLight = sun;

            DebugShowHitboxes           = false;
            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
            if (IsFirstPersonMode)
            {
                FOV = 90;
            }
            else
            {
                FOV = 45;
            }
        }
Esempio n. 14
0
        private void CreateRoomForLightTest()
        {
            SetAmbientLight(1, 1, 1, 0.25f);

            KWEngine.BuildTerrainModel("Terrain", @".\textures\heightmap2.png", @".\textures\sand_diffuse.dds", 20, 2, 20, 5, 5);

            Cube e1 = new Cube();

            e1.SetModel("KWCube");
            e1.SetPosition(0, 2, 0);
            e1.IsShadowCaster = true;
            AddGameObject(e1);

            Cube c1 = new Cube();

            c1.SetModel("KWCube");
            c1.SetScale(20, 10, 2);
            c1.SetPosition(0, 5, -11);
            c1.IsShadowCaster = true;
            c1.SetTexture(@".\textures\pavement01.jpg");
            AddGameObject(c1);

            /*
             * Cube c2 = new Cube();
             * c2.SetModel("KWCube");
             * c2.SetScale(20, 2, 20);
             * c2.SetPosition(0, -1, 0);
             * c2.SetTexture(@".\textures\pavement01.jpg");
             * c2.IsShadowCaster = true;
             * AddGameObject(c2);
             */
            Cube c2 = new Cube();

            c2.SetModel("Terrain");
            c2.SetPosition(0, 0, 0);
            c2.IsShadowCaster = true;
            AddGameObject(c2);

            Cube c3 = new Cube();

            c3.SetModel("KWCube");
            c3.SetScale(2, 10, 20);
            c3.SetPosition(-11, 5, 0);
            c3.SetTexture(@".\textures\pavement01.jpg");
            c3.IsShadowCaster = true;
            AddGameObject(c3);

            Cube c4 = new Cube();

            c4.SetModel("KWCube");
            c4.SetScale(2, 10, 20);
            c4.SetPosition(+11, 5, 0);
            c4.IsShadowCaster = true;
            c4.SetTexture(@".\textures\pavement01.jpg");
            AddGameObject(c4);

            // Testing Cubes and Spheres
            Cube box1 = new Cube();

            box1.SetModel("KWCube");
            box1.SetPosition(-5, 1, 0);
            box1.SetScale(2);
            box1.IsShadowCaster = true;
            AddGameObject(box1);

            Cube box2 = new Cube();

            box2.SetModel("KWCube");
            box2.SetPosition(0, 0.5f, -3);
            box2.SetScale(1);
            box2.IsShadowCaster = true;
            //box2.SetMetalness(0.9f);
            box2.Opacity = 1;
            AddGameObject(box2);

            Cube box3 = new Cube();

            box3.SetModel("KWCube");
            box3.SetPosition(0, 3, -7.5f);
            box3.SetScale(3);
            box3.IsShadowCaster = true;
            AddGameObject(box3);

            _pointlightWithShadow = new LightObject(LightType.Point, true);
            _pointlightWithShadow.SetPosition(0, 5, 0);
            _pointlightWithShadow.SetNearAndFarBounds(1, 15);
            _pointlightWithShadow.SetColor(1, 0, 0, 2);
            _pointlightWithShadow.SetFOVBiasCoefficient(_momentBias, _depthBias);
            AddLightObject(_pointlightWithShadow);
        }
Esempio n. 15
0
        public override void Prepare()
        {
            FOV = 90;
            //SunAmbientFactor = 0.8f;
            //SetSunPosition(25, 20, 50);
            //SetSunTarget(10, 0, 0);
            //KWEngine.ShadowMapCoefficient = 0.00075f;
            //DebugShowHitboxes = true;
            //DebugShadowCaster = true;

            KWEngine.LoadModelFromFile("Main", @".\models\forum\forum_main.fbx");
            KWEngine.LoadModelFromFile("Upper", @".\models\forum\forum_upper.fbx");
            KWEngine.LoadModelFromFile("Stairs", @".\models\forum\forum_stairs.fbx");
            KWEngine.LoadModelFromFile("Tables", @".\models\forum\forum_tables.fbx");
            KWEngine.LoadModelFromFile("HBMain", @".\models\forum\forum_hitbox_main.fbx");
            KWEngine.LoadModelFromFile("HBUpper", @".\models\forum\forum_hitbox_upper.fbx");
            KWEngine.LoadModelFromFile("HBStairs", @".\models\forum\forum_hitbox_stairs.fbx");

            Immovable main = new Immovable();

            main.SetModel("Main");
            main.IsShadowCaster = true;
            AddGameObject(main);

            Immovable upper = new Immovable();

            upper.SetModel("Upper");
            upper.IsShadowCaster = true;
            AddGameObject(upper);

            Immovable stairs = new Immovable();

            stairs.SetModel("Stairs");
            stairs.IsShadowCaster = true;
            AddGameObject(stairs);

            Immovable tables = new Immovable();

            tables.SetModel("Tables");
            tables.IsCollisionObject = true;
            tables.IsShadowCaster    = true;
            AddGameObject(tables);

            Immovable hbMain = new Immovable();

            hbMain.SetModel("HBMain");
            hbMain.IsCollisionObject = true;
            hbMain.Opacity           = 0;
            AddGameObject(hbMain);

            Immovable hbUpper = new Immovable();

            hbUpper.SetModel("HBUpper");
            hbUpper.IsCollisionObject = true;
            hbUpper.Opacity           = 0;
            AddGameObject(hbUpper);

            Immovable hbStairs = new Immovable();

            hbStairs.SetModel("HBStairs");
            hbStairs.IsCollisionObject = true;
            hbStairs.Opacity           = 0;
            AddGameObject(hbStairs);

            _player = new Player();
            _player.SetModel("KWCube");
            _player.SetScale(0.5f, 1.8f, 0.5f);
            _player.IsShadowCaster    = false;
            _player.IsCollisionObject = true;
            _player.SetPosition(0, 0.9f, 0);
            _player.FPSEyeOffset = 0.75f;
            _player.UpdateLast   = true;
            AddGameObject(_player);
            SetFirstPersonObject(_player, 0);

            SetTextureSkybox(@".\textures\skybox1.jpg");
            //SetTextureSkyboxRotation(90);
            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
        }
Esempio n. 16
0
        /// <summary>
        /// Explosionskonstruktormethode
        /// </summary>
        /// <param name="position">Position der Explosion</param>
        /// <param name="particleCount">Anzahl der Partikel</param>
        /// <param name="particleSize">Größe der Partikel</param>
        /// <param name="radius">Radius der Explosion</param>
        /// <param name="durationInSeconds">Dauer der Explosion in Sekunden</param>
        /// <param name="type">Art der Explosion</param>
        /// <param name="glow">Glühfarbe der Explosion</param>
        /// <param name="texture">Textur der Explosion (optional)</param>
        public Explosion(Vector3 position, int particleCount, float particleSize, float radius, float durationInSeconds, ExplosionType type, Vector4 glow, string texture = null)
        {
            _currentWorld = GLWindow.CurrentWindow.CurrentWorld;

            if (_currentWorld == null)
            {
                throw new Exception("World is null. Cannot create Explosion in an empty world.");
            }


            if (type == ExplosionType.Cube || type == ExplosionType.CubeRingY || type == ExplosionType.CubeRingZ)
            {
                _model = KWEngine.GetModel("KWCube");
            }
            else if (type == ExplosionType.Sphere || type == ExplosionType.SphereRingY || type == ExplosionType.SphereRingZ)
            {
                _model = KWEngine.GetModel("KWSphere");
            }
            else if (type == ExplosionType.Star || type == ExplosionType.StarRingY || type == ExplosionType.StarRingZ)
            {
                _model = KWEngine.KWStar;
            }
            else if (type == ExplosionType.Heart || type == ExplosionType.HeartRingY || type == ExplosionType.HeartRingZ)
            {
                _model = (KWEngine.KWHeart);
            }
            else if (type == ExplosionType.Skull || type == ExplosionType.SkullRingY || type == ExplosionType.SkullRingZ)
            {
                _model = (KWEngine.KWSkull);
            }
            else
            {
                _model = (KWEngine.KWDollar);
            }

            _type         = type;
            Glow          = glow;
            Position      = position;
            _amount       = particleCount >= 4 && particleCount <= MAX_PARTICLES ? particleCount : particleCount < 4 ? 4 : MAX_PARTICLES;
            _spread       = radius > 0 ? radius : 10;
            _duration     = durationInSeconds > 0 ? durationInSeconds : 2;
            _particleSize = particleSize > 0 ? particleSize : 1f;

            for (int i = 0, arrayIndex = 0; i < _amount; i++, arrayIndex += 4)
            {
                if ((int)type < 100)
                {
                    int randomIndex  = HelperRandom.GetRandomNumber(0, AxesCount - 1);
                    int randomIndex2 = HelperRandom.GetRandomNumber(0, AxesCount - 1);
                    int randomIndex3 = HelperRandom.GetRandomNumber(0, AxesCount - 1);
                    _directions[arrayIndex]     = Axes[randomIndex].X;
                    _directions[arrayIndex + 1] = Axes[randomIndex2].Y;
                    _directions[arrayIndex + 2] = Axes[randomIndex3].Z;
                    _directions[arrayIndex + 3] = HelperRandom.GetRandomNumber(0.1f, 1.0f);
                }
                else if ((int)type >= 100 && (int)type < 1000)
                {
                    _directions[arrayIndex]     = 0;
                    _directions[arrayIndex + 1] = 1;
                    _directions[arrayIndex + 2] = 0;
                    _directions[arrayIndex + 3] = HelperRandom.GetRandomNumber(0.01f, 1.0f);
                }
                else
                {
                    _directions[arrayIndex]     = 0;
                    _directions[arrayIndex + 1] = 0;
                    _directions[arrayIndex + 2] = 1;
                    _directions[arrayIndex + 3] = HelperRandom.GetRandomNumber(0.01f, 1.0f);
                }
            }
            int  texId        = -1;
            bool textureFound = false;

            if (texture != null && texture.Length > 0)
            {
                textureFound = KWEngine.CustomTextures[_currentWorld].TryGetValue(texture, out texId);
            }
            if (textureFound)
            {
                _textureId = texId;
            }
            else
            {
                if (texture != null)
                {
                    Action a = () => SetTexture(texture);
                    HelperGLLoader.AddCall(this, a);
                }
            }
        }
Esempio n. 17
0
        public override void Prepare()
        {
            KWEngine.LoadModelFromFile("UBot", @".\Models\JumpAndRun\UBot.fbx");

            SetTextureSkybox(@".\Textures\skybox3.dds");
            SetTextureBackgroundBrightnessMultiplier(4);
            SetAmbientLight(1, 1, 1, 0.25f);
            WorldDistance = 50;

            // Player object:
            _player = new Player();
            _player.SetModel("UBot");
            _player.SetScale(1.8f);
            _player.SetRotation(0, 180, 0);
            _player.SetMetalness(0.25f);
            _player.Name = "Player";
            //_player.SetRoughness(1);
            _player.SetPosition(0, 0, 0);
            _player.IsCollisionObject = true;
            _player.IsShadowCaster    = true;
            _player.UpdateLast        = true;
            AddGameObject(_player);

            Platform floor = new Platform();

            floor.SetModel("KWCube");
            floor.SetTexture(@".\textures\mpanel_diffuse.dds");
            floor.SetTexture(@".\textures\mpanel_normal.dds", TextureType.Normal);
            //floor.SetTexture(@".\textures\mpanel_roughness.dds", TextureType.Roughness);
            //floor.SetTexture(@".\textures\mpanel_metalness.dds", TextureType.Metalness);
            floor.SetRoughness(0.25f);
            floor.SetMetalness(0.1f);
            floor.SetTextureRepeat(5, 5);
            floor.IsCollisionObject = true;
            floor.SetPosition(0, -1f, 0);
            floor.SetScale(50, 2, 50);
            floor.Name           = "Floor";
            floor.IsShadowCaster = true;
            AddGameObject(floor);

            _sun = new LightObject(LightType.Sun, true);
            _sun.SetPosition(-200, 100, 50);
            _sun.SetTarget(0, 0, 0);
            _sun.SetFOV(45);
            _sun.SetNearAndFarBounds(200, 350);
            _sun.SetColor(1, 1, 1, 4);
            _sun.SetFOVBiasCoefficient(0.00003f, 0f);
            AddLightObject(_sun);
            //DebugShadowLight = _sun;

            SetCameraPosition(0, 0, 10);
            SetCameraTarget(0, 0, 0);
            FOV = 90;

            CurrentWindow.CursorVisible = false;
            CurrentWindow.CursorGrabbed = true;

            // Place some obstacles:
            Immovable i1 = new Immovable();

            i1.SetModel("KWCube");
            i1.SetPosition(2.5f, 1f, -5);
            i1.SetScale(2);
            i1.IsPickable = true;
            i1.Name       = "Obstacle Box #1";
            i1.SetRoughness(0.5f);
            i1.SetColor(1, 0.25f, 0.25f);
            i1.SetTexture(@".\textures\MetalPlates006_1K_ColorBright.jpg");
            //i1.SetSpecularReflectionEnabled(true);
            i1.IsShadowCaster    = true;
            i1.IsCollisionObject = true;
            AddGameObject(i1);

            // Place HUD crosshair:
            _crosshair = new HUDObject(HUDObjectType.Image, CurrentWindow.Width / 2, CurrentWindow.Height / 2);
            _crosshair.SetTexture(@".\textures\crosshair.dds");
            _crosshair.SetScale(64, 64);
            AddHUDObject(_crosshair);

            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
        }