Esempio n. 1
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;
        }
        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);
        }
Esempio n. 3
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();
        }
Esempio n. 4
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;
        }