예제 #1
0
        private void CreateSkyboxes(GraphicsDevice device, ContentStack content, FrameService frameService, CubeMapGenerator cubeMapGenerator, IrradianceMapGenerator irradianceMapGenerator, EnvironmentMapGenerator environmentMapGenerator)
        {
            var skyboxNames = new string[]
            {
                "Skyboxes/Circus/Circus_Backstage_3k",
                "Skyboxes/Industrial/fin4_Bg",
                "Skyboxes/Milkyway/Milkyway_small",
                "Skyboxes/Grid/testgrid",
                "Skyboxes/Loft/Newport_Loft_Ref"
            };

            foreach (var name in skyboxNames)
            {
                content.Push("generator");
                var equiRect    = content.Load <Texture2D>(name);
                var albedo      = cubeMapGenerator.Generate(equiRect);
                var irradiance  = irradianceMapGenerator.Generate(equiRect);
                var environment = environmentMapGenerator.Generate(equiRect);

                content.Pop();
                content.Link(albedo);
                content.Link(irradiance);
                content.Link(environment);

                this.Textures.Add(new SkyboxTextures(name, albedo, irradiance, environment));
            }

            frameService.Skybox = SkyboxGenerator.Generate(device, this.Textures[0].Albedo,
                                                           this.Textures[0].Irradiance,
                                                           this.Textures[0].Environment);
        }
예제 #2
0
        public SkyboxSceneService(GraphicsDevice device, ContentStack content, CubeMapGenerator cubeMapGenerator, IrradianceMapGenerator irradianceMapGenerator, EnvironmentMapGenerator environmentMapGenerator, FrameService frameService)
        {
            this.Textures     = new List <SkyboxTextures>();
            this.FrameService = frameService;

            content.Push("skybox");
            this.CreateSkyboxes(device, content, frameService, cubeMapGenerator, irradianceMapGenerator, environmentMapGenerator);
        }