示例#1
0
        public void LoadContent(ContentManager content)
        {
            Box = TextureFactory.CreateBorder(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 128, 1);

            Border = TextureFactory.CreateBorder(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 128, 1);

            Buttons[0] = TextureFactory.CreateBorder(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 48, 1);
            Buttons[1] = TextureFactory.CreateBorder(Color.WhiteSmoke, new Color(0.16f, 0.19f, 0.23f, 0.7f), 128, 48, 1);
            Buttons[2] = TextureFactory.CreateBorder(Color.LightGray, new Color(0.19f, 0.23f, 0.27f, 0.7f), 128, 48, 1);

            Checkbox[0] = TextureFactory.CreateBorder(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 48, 48, 2);
            Checkbox[1] = TextureFactory.CreateColor(Color.DarkGray, 1, 1);
            Checkbox[2] = TextureFactory.CreateColor(Color.White, 1, 1);

            Sliders[0] = TextureFactory.CreateColor(new Color(0.08f, 0.12f, 0.16f, 0.7f), 1, 1);
            Sliders[1] = TextureFactory.CreateGradiant(Color.LightBlue, Color.CadetBlue, 16, 16);

            if (!string.IsNullOrEmpty(_fontName))
            {
                Font = content.Load <SpriteFont>(_fontName);
            }
        }
示例#2
0
 public override void Start()
 {
     _borderTexture = TextureFactory.CreateColor(Color.Black, 1, 1);
 }
示例#3
0
        public override void Initialize()
        {
            base.Initialize();

            _camera.AddComponent <VRPlayerEnabler>();
            Destroy(_directionalLight.GetComponent <LensFlare>());

            SetControlMode(ControllerSwitcher.ControllerType.FPS, new Vector3(0, 2, 0), Vector3.Zero, true);

            // Setup the terrain.
            var terrainMaterial = new StandardMaterial();

            terrainMaterial.MainTexture = TextureFactory.CreateColor(Color.White, 1, 1);
            terrainMaterial.Shininess   = 32;
            terrainMaterial.Tiling      = new Vector2(16);

            var go      = GameObjectFactory.CreateTerrain();
            var terrain = go.GetComponent <Terrain>();

            terrain.Geometry.Size = new Vector3(1);
            terrain.Geometry.Build();
            terrain.Flatten();
            terrain.Renderer.Material      = terrainMaterial;
            terrain.Renderer.ReceiveShadow = true;
            terrain.Renderer.CastShadow    = false;
            terrain.Renderer.Enabled       = false;
            Add(go);

            // Generate the Sky
            var content = Application.Content;

            RenderSettings.Skybox.Generate(Application.GraphicsDevice, DemoGame.NatureSkybox, 256);

            RenderSettings.FogMode = FogMode.None;

            // Caches
            GameObject  cube        = null;
            GameObject  light       = null;
            PBRMaterial pbrMaterial = null;
            Renderer    renderer    = null;

            // Generates the grid of spheres
            var startPos = 7.0f;
            var x        = -startPos;
            var z        = -startPos;
            var margin   = 2.5f;

            for (var i = 0; i < (int)startPos; i++)
            {
                for (var j = 0; j < (int)startPos; j++)
                {
                    cube = GameObjectFactory.CreateMesh(GeometryType.Sphere);
                    cube.Transform.Translate(x, 1.5f, z);

                    pbrMaterial = new PBRMaterial
                    {
                        MainTexture = TextureFactory.CreateColor(Color.White, 1, 1),
                        //IrradianceMap = irradianceMap
                    };

                    var roughness = (float)i / startPos;
                    var metallic  = (float)j / startPos;

                    pbrMaterial.CreateRMSFromValues(roughness, metallic);

                    renderer          = cube.GetComponent <Renderer>();
                    renderer.Material = pbrMaterial;

                    /* light = GameObjectFactory.CreateLight(LightType.Point, RandomHelper.GetColor(), 2, 0);
                     * light.Transform.Position = new Vector3(x, 5, z);
                     *
                     * light = GameObjectFactory.CreateLight(LightType.Point, RandomHelper.GetColor(), 2, 0);
                     * light.Transform.Position = new Vector3(x + 5, -15, z - 5);*/

                    z += margin;
                }

                x += margin;
                z  = -startPos;
            }
        }