Пример #1
0
        public void SetVertexShader(string shaderFile, Func <byte[], InputLayoutWrapper> inputLayoutFunc, bool isDebug = true)
        {
            shaderFile = GetShaderFilePath(shaderFile);
            byte[] vertexShaderByteCode = ShaderBytecode.CompileFromFile(shaderFile, "VS", "vs_5_0", ShaderFlags.SkipOptimization | ShaderFlags.Debug, EffectFlags.None);
            this.VertexShader = new VertexShader(PipelineManager.Get().Device, vertexShaderByteCode);


            this.InputLayoutWrapper = inputLayoutFunc(vertexShaderByteCode);
        }
Пример #2
0
        public static InputLayoutWrapper PosColor(byte[] vertexShaderByteCode)
        {
            InputLayout layout = new InputLayout(PipelineManager.Get().Device, ShaderSignature.GetInputSignature(vertexShaderByteCode),
                                                 new[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0)
            });

            var wrapper = new InputLayoutWrapper(layout, 32);

            return(wrapper);
        }
Пример #3
0
        public static InputLayoutWrapper PosTexCoordNormal(byte[] vertexShaderByteCode)
        {
            InputLayout layout = new InputLayout(PipelineManager.Get().Device, ShaderSignature.GetInputSignature(vertexShaderByteCode),
                                                 new[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("TEXCOORD", 0, Format.R32G32_Float, 16, 0),
                new InputElement("NORMAL", 0, Format.R32G32B32_Float, 24, 0),
            });

            var wrapper = new InputLayoutWrapper(layout, 36);

            return(wrapper);
        }