Пример #1
0
        private void CreateGLBTestObject()
        {
            Immovable mattest = new Immovable();

            mattest.SetModel("MatTest");
            mattest.SetPosition(-3, 1, 5);
            mattest.IsShadowCaster = true;
            mattest.SetScale(1f);
            //mattest.SetSpecularReflectionEnabled(true);
            AddGameObject(mattest);

            Immovable mattest255 = new Immovable();

            mattest255.SetModel("MatTest255");
            mattest255.SetPosition(-7, 1, 5);
            mattest255.IsShadowCaster = true;
            mattest255.SetScale(1f);
            //mattest255.SetSpecularReflectionEnabled(true);
            AddGameObject(mattest255);

            Immovable kwcube6test = new Immovable();

            kwcube6test.SetModel("KWCube6");
            kwcube6test.SetPosition(-5, -0.5f, 5);
            kwcube6test.SetScale(10, 1, 10);
            kwcube6test.SetTexture(@".\textures\pavement01.jpg", TextureType.Albedo, CubeSide.Top);
            kwcube6test.SetTexture(@".\textures\pavement01_normal.jpg", TextureType.Normal, CubeSide.Front);
            kwcube6test.SetTextureRepeat(5, 1, CubeSide.Front);
            AddGameObject(kwcube6test);
        }
Пример #2
0
        public override void Prepare()
        {
            FOV = 90;
            SetAmbientLight(1, 1, 1, 0.25f);
            SetTextureSkybox(@".\textures\skybox_mipmaptest.jpg");
            SetTextureBackgroundBrightnessMultiplier(4);


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

            _sphere.SetModel("KWSphere");
            _sphere.SetPosition(0, 0, 0);
            _sphere.SetColor(1, 0, 0);
            AddGameObject(_sphere);

            //CreateFreeFloatPlayer();
            //CreateUBotPlayer();

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

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

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

            DebugShowCoordinateSystemGrid = GridType.GridXZ;
        }
Пример #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;
        }
Пример #4
0
        public override void Prepare()
        {
            FOV = 15;
            SetAmbientLight(1, 1, 1, 0.0f);
            SetCameraPosition(0, 0, 50f);
            SetCameraTarget(0, 0, 0);

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

            for (int i = 0; i < 5; i++)
            {
                Immovable c = new Immovable();
                c.SetModel("KWCube");
                c.SetPosition(i * 3f - 6f, 0, 0);
                c.SetScale(1, 1, 1);
                c.SetGlow(1, 1, 1, i / 5f);
                c.IsShadowCaster = false;
                AddGameObject(c);
            }

            for (int i = 0; i < 5; i++)
            {
                Immovable c = new Immovable();
                c.SetModel("KWCube");
                c.SetPosition(i * 3f - 6f, 4, 0);
                c.SetScale(0.25f, 0.075f, 0.5f);
                c.SetGlow(1, 1, 1, i / 5f);
                c.IsShadowCaster = false;
                AddGameObject(c);
            }

            DebugShowPerformanceInTitle = PerformanceUnit.FramesPerSecond;
        }
        private void CreateTestScene()
        {
            PlayerSphere s = new PlayerSphere();

            s.SetModel("KWSphere");
            s.SetPosition(4, 1, 0);
            s.SetScale(2);
            //s.SetScale(2);
            s.Name              = "Sphere #1";
            s.IsShadowCaster    = true;
            s.IsCollisionObject = true;
            //s.ColorEmissive = new Vector4(1, 1, 1, 0.1f);
            AddGameObject(s);

            /*Immovable ms = new Immovable();
             * ms.SetModel("MS");
             * ms.IsCollisionObject = true;
             * AddGameObject(ms);*/

            Immovable sC = new Immovable();

            sC.SetModel("KWSphere");
            sC.SetPosition(-5, 1, 0);
            sC.SetScale(2);
            sC.Name              = "Sphere #2";
            sC.IsShadowCaster    = true;
            sC.IsCollisionObject = true;
            sC.SetTexture(@".\textures\Metal022_1K_Color.jpg");
            sC.SetTexture(@".\textures\Metal022_1K_Normal.jpg", TextureType.Normal);
            sC.SetTexture(@".\textures\Metal022_1K_Metalness.jpg", TextureType.Metalness);
            sC.SetTexture(@".\textures\Metal022_1K_Roughness.jpg", TextureType.Roughness);
            //AddGameObject(sC);

            CubeRoughnessTest floor = new CubeRoughnessTest();

            floor.SetModel("KWCube");
            floor.Name = "Floor";
            floor.SetPosition(0, -0.5f, 0);
            floor.SetScale(10, 1, 10);
            floor.SetColor(1, 0, 0);
            floor.IsShadowCaster    = true;
            floor.IsCollisionObject = true;
            //AddGameObject(floor);

            Immovable convexHull = new Immovable();

            convexHull.SetModel("ConvexHull");
            convexHull.SetScale(2);
            convexHull.SetPosition(0, 1, 0);
            convexHull.IsCollisionObject = true;
            convexHull.IsShadowCaster    = true;
            AddGameObject(convexHull);

            DebugShowHitboxes = true;
        }
Пример #6
0
        public override void Act(KeyboardState ks, MouseState ms)
        {
            if (ks[Key.Escape])
            {
                CurrentWindow.SetWorld(new GameWorldStart());
                return;
            }

            Vector3 mousepos3d = HelperIntersection.GetMouseIntersectionPoint(ms, Plane.Y, 1);

            _sphere.SetPosition(mousepos3d);
            if (HelperIntersection.IsPointInsideGameObject(mousepos3d, t))
            {
                t.SetGlow(1, 0, 0, 1);
            }
            else
            {
                t.SetGlow(1, 0, 0, 0);
            }
        }
Пример #7
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);
        }
Пример #8
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;
        }
Пример #9
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 = 90;
            SetAmbientLight(1, 1, 1, 0.25f);
            SetCameraPosition(0, 10, 5f);
            SetCameraTarget(0, 0, 0);

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

            /*
             * _sun = new LightObject(LightType.Sun, true);
             * _sun.SetPosition(15, 15, 15);
             * _sun.SetTarget(0, 0, 0);
             * _sun.SetColor(1, 1, 1, 2);
             * AddLightObject(_sun);
             */


            _point = new LightObject(LightType.Point, false);
            _point.SetPosition(5, 1, 0);
            _point.SetColor(1, 1, 1, 1);
            _point.SetNearAndFarBounds(1, _multi);
            AddLightObject(_point);

            _spot = new LightObject(LightType.Directional, false);
            _spot.SetPosition(-5, 1, 0);
            _spot.SetTarget(0, 0, 0);
            _spot.SetNearAndFarBounds(1, _multi);
            _spot.SetColor(1, 1, 1, 1);
            AddLightObject(_spot);

            Immovable floor = new Immovable();

            floor.SetModel("KWCube");
            floor.SetPosition(0, -1, 0);
            floor.SetScale(20, 2, 20);
            floor.IsShadowCaster = false;
            AddGameObject(floor);

            //CreateSpheres();

            // DebugShadowLight = _sun;
            DebugShowPerformanceInTitle   = PerformanceUnit.FramesPerSecond;
            DebugShowCoordinateSystemGrid = GridType.GridXZ;
        }
Пример #10
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);
        }
        private void CreateTestScene()
        {
            CallerCube convexHull = new CallerCube();

            convexHull.SetModel("GLTFHULL");
            convexHull.SetScale(2);
            convexHull.SetPosition(0, 1, 0);
            //convexHull.SetColor(0, 1, 0);
            convexHull.IsCollisionObject = true;
            convexHull.Name = "Hull #1";
            AddGameObject(convexHull);

            Immovable convexHull2 = new Immovable();

            convexHull2.SetModel("KWSphere");
            convexHull2.SetScale(1f); //, 2, 1);
            convexHull2.SetPosition(1, 2.5f, 0);
            convexHull2.SetColor(1, 0, 0);
            convexHull2.AddRotationX(45, true);
            convexHull2.AddRotationZ(45, true);
            convexHull2.IsCollisionObject = true;
            convexHull2.Name = "Hull #2";
            AddGameObject(convexHull2);
        }
Пример #12
0
        private void CreateTestScene()
        {
            ReflectObject s = new ReflectObject();

            s.SetModel("KWSphere");
            s.SetPosition(0, -4, 0);
            s.SetScale(1, 1, 1);
            //s.AddRotationZ(0);
            s.Name              = "DaBall!";
            s.IsShadowCaster    = false;
            s.IsCollisionObject = true;
            s.UpdateLast        = true;
            s.SetTexture(@".\textures\Metal022_1K_Color.jpg");
            s.SetTexture(@".\textures\Metal022_1K_Normal.jpg", TextureType.Normal);
            s.SetTexture(@".\textures\Metal022_1K_Metalness.jpg", TextureType.Metalness);
            s.SetTexture(@".\textures\Metal022_1K_Roughness.jpg", TextureType.Roughness);
            AddGameObject(s);

            Immovable sC = new Immovable();

            sC.SetModel("KWSphere");
            sC.SetPosition(0, 6, 0);
            sC.SetScale(4);
            sC.Name = "Obstacle Sphere";
            sC.IsCollisionObject = true;
            sC.SetColor(0, 1, 0);
            AddGameObject(sC);

            Cube sC2 = new Cube();

            sC2.SetModel("KWCube");
            sC2.Name = "Obstacle Cube";
            sC2.SetPosition(-5, 5f, 0);
            sC2.SetScale(2);
            sC2.AddRotationZ(-45);
            sC2.SetColor(1, 0, 0);
            sC2.IsCollisionObject = true;
            AddGameObject(sC2);

            Immovable convexHull = new Immovable();

            convexHull.SetModel("KWCube");
            convexHull.SetScale(2);
            convexHull.SetPosition(5, 5, 0);
            convexHull.IsCollisionObject = true;
            AddGameObject(convexHull);

            ReflectPaddle player = new ReflectPaddle(s);

            player.SetModel("Paddle");
            player.SetPosition(0, -6, 0);
            player.SetScale(2);
            player.IsCollisionObject = true;
            AddGameObject(player);

            Immovable wallLeft = new Immovable();

            wallLeft.SetModel("KWCube");
            wallLeft.SetPosition(-10.5f, 0, 0);
            wallLeft.SetScale(1, 20, 1);
            wallLeft.IsCollisionObject = true;
            AddGameObject(wallLeft);

            Immovable wallRight = new Immovable();

            wallRight.SetModel("KWCube");
            wallRight.SetPosition(10.5f, 0, 0);
            wallRight.SetScale(1, 20, 1);
            wallRight.IsCollisionObject = true;
            AddGameObject(wallRight);

            Immovable wallTop = new Immovable();

            wallTop.SetModel("KWCube");
            wallTop.SetPosition(0, 10.5f, 0);
            wallTop.SetScale(20, 1, 1);
            wallTop.IsCollisionObject = true;
            AddGameObject(wallTop);

            Immovable wallBottom = new Immovable();

            wallBottom.SetModel("KWCube");
            wallBottom.SetPosition(0, -10.5f, 0);
            wallBottom.SetScale(20, 1, 1);
            wallBottom.IsCollisionObject = true;
            AddGameObject(wallBottom);

            //CreateTerrainTestObject();
        }
Пример #13
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);
        }
Пример #14
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;
            }
        }
Пример #15
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;
        }