public ShaderCode SamplingLoading() { CodeGenerator generator = new CodeGenerator(BindingStage.VertexShader); Texture2DBinder <Floatx3> texture = generator.CreateTexture2D <Floatx3>("Texture"); SamplerBinder sampler = generator.CreateSampler("Sampler"); Floatx3 sampled = texture.Sample(sampler, generator.InputFloatx2(PinComponent.TexCoord0)); return(generator.ShaderCode); }
public ShaderCode Swizzle() { CodeGenerator generator = new CodeGenerator(BindingStage.VertexShader); Floatx3 p = generator.InputFloatx3(PinComponent.Position); Float4x4 m = generator.CreateFloat4x4("Matrix"); p.XYZ = (new Floatx4(p, 1.0f) * m).XYZ; return(generator.ShaderCode); }
/// <summary> /// Sample at specific address. /// </summary> public T Sample([NotNull] SamplerBinder sampler, [NotNull] Floatx3 address) { if (address.Generator != this.Generator || sampler.Generator != this.Generator) { throw new ArgumentException("Mixing generators not allowed."); } SampleOperation op = new SampleOperation(); op.BindInputs(sampler.Pin, pin, address.Pin); return((T)this.Generator.CreateFrom(op.Outputs[0])); }
/// <summary> /// Sample at specific address. /// </summary> public T Sample([NotNull] SamplerBinder sampler, [NotNull] Floatx3 address, Integerx3 offset) { if (address.Generator != this.Generator || ((object)offset != null && offset.Generator != this.Generator) || sampler.Generator != this.Generator) { throw new ArgumentException("Mixing generators not allowed."); } SampleOperation op = new SampleOperation(); if ((object)offset != null) { op.BindInputs(sampler.Pin, pin, address.Pin, offset.Pin); } else { op.BindInputs(sampler.Pin, pin, address.Pin); } return((T)this.Generator.CreateFrom(op.Outputs[0])); }
/// <summary> /// Samples at specific address. /// </summary> public T Sample([NotNull] SamplerBinder sampler, [NotNull] Floatx3 address) { return(Sample(sampler, address, null)); }
/// <summary> /// Constructor. /// </summary> public Float3x3(Floatx3 row1, Vector3f row2, Vector3f row3) { this.pin = CodeGenerator.Compound(out generator, row1, row2, row3); }