public SibenikMaterial(Device device, TweakBar bar, String name) : base(device, bar, name) { bar.AddColor(Prefix + "diffuse", "Diffuse", name, new Color3(1, 1, 1)); bar.AddColor(Prefix + "specular", "Specular", name, new Color3(1, 1, 1)); bar.AddFloat(Prefix + "shininess", "Shininess", name, 1, 256, 64, 0.1, 2); bar.AddFloat(Prefix + "brightness", "Brightness", name, 0, 15000, 5, 50, 2); pixelShader = Material.CompileShader(device, "sibenik"); constantBuffer = Material.AllocateMaterialBuffer(device, BufferSize); sampler = new SamplerState(device, new SamplerStateDescription() { ComparisonFunction = Comparison.Always, AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap, AddressW = TextureAddressMode.Wrap, Filter = Filter.Anisotropic, BorderColor = Color4.Black, MaximumAnisotropy = 16, MaximumLod = 15, MinimumLod = 0, MipLodBias = 0, }); }
public GroundMaterial(Device device, TweakBar bar, String name) : base(device, bar, name) { bar.AddFloat(Prefix + "albedo", "Albedo", name, 0, 100, 30, 0.1, 2); pixelShader = Material.CompileShader(device, "ground"); constantBuffer = Material.AllocateMaterialBuffer(device, BufferSize); sampler = new SamplerState(device, new SamplerStateDescription() { ComparisonFunction = Comparison.Always, AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap, AddressW = TextureAddressMode.Wrap, Filter = Filter.Anisotropic, BorderColor = Color4.Black, MaximumAnisotropy = 16, MaximumLod = 15, MinimumLod = 0, MipLodBias = 0, }); }
private void InitializeTweakBar() { if (!TweakBar.InitializeLibrary(device)) throw new ExternalException("Failed to initialize AntTweakBar!"); else { mainBar = new TweakBar(null, "Configuration Options"); /* Configuration options go below. */ mainBar.AddFloat("gamma", "Gamma", "General", 1, 3, 2.2, 0.05, 3, "Gamma response to calibrate to the monitor."); mainBar.AddFloat("exposure", "Exposure", "General", 0.001, 1.5, 0.001, 0.001, 3, "Exposure level at which to render the scene."); mainBar.AddBoolean("diffraction", "Enable", "Diffraction", "Yes", "No", true, "Whether to display diffraction effects or not."); mainBar.AddInteger("quality", "Quality", "Diffraction", 1, 4, (int)Settings.quality, 1, "The quality of the diffraction effects (from 1 to 4)."); mainBar.AddFloat("fnumber", "f-number", "Diffraction", 1, 16, 1.5, 0.05, 2, "The f-number at which to simulate the aperture."); mainBar.AddFloat("glare", "Glare", "Diffraction", 0, 1, 0, 0.01, 2); mainBar.AddFloat("size", "Size", "Diffraction", 0, 1, 0.5, 0.01, 2); mainBar.AddBoolean("scale_correct", "Scale Correction", "Diffraction", "Yes", "No", true); mainBar.AddFloat("rotation_sensitivity", "Rotation", "Navigation", 0, 5, Settings.rotationSensitivity, 0.01, 2, "The sensitivity of mouse rotation."); mainBar.AddFloat("movement_sensitivity", "Movement", "Navigation", 0, 1, Settings.movementSensitivity, 0.01, 2, "The sensitivity of keyboard movement."); mainBar.AddFloat("field_of_view", "Field Of View", "Navigation", 10, 120, 75, 1, 2, "The sensitivity of keyboard movement."); /* TweakBar listeners go below. */ mainBar["quality"].VariableChange += QualityChange; mainBar["exposure"].VariableChange += ExposureChange; mainBar["gamma"].VariableChange += GammaChange; mainBar["fnumber"].VariableChange += FNumberChange; mainBar["glare"].VariableChange += GlareChange; mainBar["size"].VariableChange += SizeChange; mainBar["scale_correct"].VariableChange += ScaleCorrectChange; mainBar["rotation_sensitivity"].VariableChange += RotationChange; mainBar["movement_sensitivity"].VariableChange += MovementChange; mainBar["field_of_view"].VariableChange += FieldOfViewChange; } }