public static Direct3DGraphicsFacade Create(RenderForm form)
        {
            // Low-level device
            var device = Direct3DGraphicsDevice.Create(form);

            // Load support defaults
            var shaderLoader        = new Direct3DShaderLoader(device.InternalD3DDevice);
            var techniqueCollection = Direct3DTechniqueCollection.Create(shaderLoader);
            var textureFactory      = new Direct3DTextureFactory(device.InternalD3DDevice);
            var presetsStore        = Direct3DPresetsStore.Create(device, textureFactory);

            return(new Direct3DGraphicsFacade {
                Device = device,
                Techniques = techniqueCollection,
                Presets = presetsStore
            });
        }
示例#2
0
        internal static Direct3DTechniqueCollection Create(Direct3DShaderLoader shaderLoader)
        {
            var collection = new Direct3DTechniqueCollection();

            collection.Forward = new Technique {
                Passes       = 1,
                VertexShader = shaderLoader.LoadVertexShaderFromFile("shaders/forward", InputLayoutFormat.PositionNormalColorTextureInstanced, "VSMain"),
                PixelShader  = shaderLoader.LoadPixelShaderFromFile("shaders/forward", "PSMain"),
            };
            collection.ForwardDepthOnly = new Technique {
                Passes       = 1,
                VertexShader = shaderLoader.LoadVertexShaderFromFile("shaders/forward_depth_only", InputLayoutFormat.PositionNormalColorTextureInstanced, "VSMain"),
                PixelShader  = shaderLoader.LoadPixelShaderFromFile("shaders/forward_depth_only", "PSMain"),
            };
            collection.ForwardWater = new Technique {
                Passes         = 1,
                VertexShader   = shaderLoader.LoadVertexShaderFromFile("shaders/forward_water", InputLayoutFormat.WaterVertex, "VSMain"),
                HullShader     = shaderLoader.LoadHullShaderFromFile("shaders/forward_water", "HSMain"),
                DomainShader   = shaderLoader.LoadDomainShaderFromFile("shaders/forward_water", "DSMain"),
                GeometryShader = shaderLoader.LoadGeometryShaderFromFile("shaders/forward_water", "GSMain"),
                PixelShader    = shaderLoader.LoadPixelShaderFromFile("shaders/forward_water", "PSMain"),
            };
            collection.ForwardSkyFromAtmosphere = new Technique {
                Passes       = 1,
                VertexShader = shaderLoader.LoadVertexShaderFromFile("shaders/forward_skyfromatomsphere", InputLayoutFormat.PositionNormalColorTextureInstanced, "VSMain"),
                PixelShader  = shaderLoader.LoadPixelShaderFromFile("shaders/forward_skyfromatomsphere", "PSMain"),
            };
            //collection.DeferredToGBuffer = new Technique {
            //   Passes = 1,
            //   PixelShader = internalAssetLoader.LoadPixelShaderFromFile("shaders/deferred_to_gbuffer", "PSMain"),
            //   VertexShader = internalAssetLoader.LoadVertexShaderFromFile("shaders/deferred_to_gbuffer", VertexLayout.PositionNormalColorTexture, "VSMain")
            //};
            //collection.DeferredFromGBuffer = new Technique {
            //   Passes = 1,
            //   PixelShader = internalAssetLoader.LoadPixelShaderFromFile("shaders/deferred_from_gbuffer", "PSMain"),
            //   VertexShader = internalAssetLoader.LoadVertexShaderFromFile("shaders/deferred_from_gbuffer", VertexLayout.PositionNormalColorTexture, "VSMain")
            //};
            return(collection);
        }