/// <summary> /// Initilize various objects /// </summary> protected override void Initialize() { _keyboardManager = new KeyboardManager(this); Components.Add(_keyboardManager); _keyboardManager.AddListener(this); _mouseManager = new MouseManager(this); Components.Add(_mouseManager); _mouseManager.AddListener(this); //_camera = new CameraFirstPerson(this, 45, 0.01f, 100.0f); _camera = new CameraTrackBall(this, 45, 0.01f, 100.0f); _camera.Position = new Vector3(0, 0, 5); Components.Add(_camera); createVolumeRaycaster(); _gradEditor = new GradientEditor(); _gradient = new Gradient(); GradientSegment seg = new GradientSegment(); seg.Left = 0.0f; seg.Middle = 0.5f; seg.Right = 1.0f; seg.LeftColor = new Vector4(1, 0, 0, 1.0f); seg.RightColor = new Vector4(1, 0, 0, 1.0f); seg.ColType = GradientSegment.ColorType.HSV_CCW; _gradient.AddSegment(seg); //seg.LookUpTable = palette.Colors; //_gradient.AddSegment(seg); //seg = new GradientSegment(); //seg.Left = 0; //seg.Middle = 0.333f/2.0f; //seg.Right = 0.333f; //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0, 1.0f); //seg.RightColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f); //seg.ColType = GradientSegment.ColorType.HSV_CW; //_gradient.AddSegment(seg); //seg = new GradientSegment(); //seg.Left = 0.333f; //seg.Middle = 0.333f+(1.0f-0.333f) / 2.0f; //seg.Right = 1.0f; //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f); //seg.RightColor = ColorHelper.HsvToRgb(0.25f * 360.0f, 0, 1.0f, 1); //seg.ColType = GradientSegment.ColorType.HSV_CW; //_gradient.AddSegment(seg); _gradEditor.Gradient = _gradient; Color[] cols = _gradient.GetColors(256); _vrc.TransferFunction = cols; TransferFunction tf = new TransferFunction(); tf.Colors = cols; tf.preIntegrate(); _vrc.TransferFunctionPreInt = tf; _gradEditor.Show(); VolumeRaycasterSettings raySettings = new VolumeRaycasterSettings(_vrc); raySettings.Show(); base.Initialize(); }