Пример #1
0
        public static ResourceSet GenerateTextureResourceSetForCubeMapping <T>(ModelRuntimeDescriptor <T> modelRuntimeState, int meshIndex, DisposeCollectorResourceFactory factory, GraphicsDevice graphicsDevice) where T : struct, VertexLocateable
        {
            RealtimeMaterial material = modelRuntimeState.Model.GetMaterial(meshIndex);

            Image <Rgba32> front  = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapFront));
            Image <Rgba32> back   = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapBack));
            Image <Rgba32> left   = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapLeft));
            Image <Rgba32> right  = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapRight));
            Image <Rgba32> top    = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapTop));
            Image <Rgba32> bottom = Image.Load <Rgba32>(Path.Combine(AppContext.BaseDirectory, modelRuntimeState.Model.BaseDir, material.cubeMapBottom));

            TextureView cubeMapTextureView = ResourceGenerator.CreateCubeMapTextureViewFromImages(front,
                                                                                                  back,
                                                                                                  left,
                                                                                                  right,
                                                                                                  top,
                                                                                                  bottom,
                                                                                                  factory,
                                                                                                  graphicsDevice);



            return(factory.CreateResourceSet(new ResourceSetDescription(
                                                 modelRuntimeState.TextureResourceLayout,
                                                 cubeMapTextureView,
                                                 modelRuntimeState.TextureSampler
                                                 )));
        }
Пример #2
0
        public static ResourceSet GenerateResourceSetForShadowMapping(ResourceLayout textureLayout, TextureView shadowMapTexView, DisposeCollectorResourceFactory factory)
        {
            var sampler = ResourceGenerator.GenerateBiLinearSampler_Border(factory);

            return(factory.CreateResourceSet(new ResourceSetDescription(
                                                 textureLayout,
                                                 shadowMapTexView,
                                                 sampler
                                                 )));
        }