Exemplo n.º 1
0
        public void CompileInMemory(bool defaultCtor)
        {
            var shaderModel = new ShaderModel(
                shaderFileName: "MyEffect.cs",
                generatedClassName: "MyEffect",
                generatedNamespace: "Shaders",
                description: "This is MyEffect",
                targetFramework: TargetFramework.WPF,
                registers: new List <Register>
            {
                new Register(
                    name: "Value",
                    type: typeof(double),
                    ordinal: 1,
                    description: "This is the value",
                    min: null,
                    max: null,
                    defaultValue: 0),
            });

            Assert.NotNull(ShaderClass.CompileInMemory(shaderModel.CSharpClass(defaultCtor)));
        }
Exemplo n.º 2
0
        public void CompileInMemory()
        {
            var shaderModel = new ShaderModel(
                shaderFileName: "Foo.cs",
                generatedClassName: "Foo",
                generatedNamespace: "Shaders",
                description: "This is Foo",
                targetFramework: TargetFramework.WPF,
                registers: new List <ShaderModelConstantRegister>
            {
                new ShaderModelConstantRegister(
                    registerName: "Bar",
                    registerType: typeof(double),
                    registerNumber: 1,
                    description: "This is Bar",
                    minValue: null,
                    maxValue: null,
                    defaultValue: 0)
            });

            var code = ShaderClass.GetSourceText(new CSharpCodeProvider(), shaderModel, includePixelShaderConstructor: false);

            Assert.NotNull(ShaderClass.CompileInMemory(code));
        }