示例#1
0
        public void SetMaterial(Material material, IGUIUpdateable guiUpdateable)
        {
            _Material = material;
            _GUIUpdateable = guiUpdateable;

            RenderMaterial();
        }
示例#2
0
 public Sphere(Vector3 position, Vector3 scale, Matrix3 rotation)
 {
     _Position = position;
     _Scale = scale;
     _Rotation = rotation;
     _Material = new Material();
     _IgnoreLighting = false;
 }
示例#3
0
 public Circle(Vector3 centre, Vector3 scale, Matrix3 rotation)
 {
     _Material = new Material();
     _Position = new Vector3();
     _Rotation = new Matrix3();
     _Position = centre;
     _Scale = scale;
     _Rotation = rotation;
 }
示例#4
0
 public Sphere()
 {
     _Position = new Vector3(0, 0, 0);
     _Scale = new Vector3(1, 1, 1);
     _Rotation = new Matrix3();
     _Rotation.MakeIdentity();
     _Material = new Material();
     _IgnoreLighting = false;
 }
示例#5
0
        public MaterialEditor(Material material)
        {
            InitializeComponent();

            _Material = material;
            _OK = false;

            ConfigureGUI();

            RenderPreview();
        }
示例#6
0
 public Material(Material rhs)
 {
     _SpecularPower = rhs._SpecularPower;
     _Opacity = rhs._Opacity;
     _RefractiveIndex = rhs._RefractiveIndex;
     _Density = rhs._Density;
     _TintDensity = rhs._TintDensity;
     _Shininess = rhs._Shininess;
     _DiffuseColour = rhs._DiffuseColour.Clone();
     _SpecularColour = rhs._SpecularColour.Clone();
     _EmissiveColour = rhs._EmissiveColour.Clone();
     _Reflectivity = rhs._Reflectivity.Clone();
     _AbsorptionColour = rhs._AbsorptionColour.Clone();
     _MaterialFunction = rhs._MaterialFunction;
 }
示例#7
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ((MainWindow)System.Windows.Application.Current.MainWindow).StopPreview();

            MaterialEditor ownedWindow = new MaterialEditor(_Material);

            ownedWindow.Owner = Window.GetWindow(this);
            ownedWindow.ShowDialog();
            if (ownedWindow._OK)
            {
                _Material = ownedWindow._Material;
                _GUIUpdateable.GUIUpdate();
                RenderMaterial();
            }

            ((MainWindow)System.Windows.Application.Current.MainWindow).StartPreview();
        }
示例#8
0
        public override void CreateElement(XElement parent, Vector3 position)
        {
            Material mat = new Material();
            mat._DiffuseColour = new Colour(0, 0, 0);
            mat._SpecularColour = new Colour(0, 0, 0);
            mat._Reflectivity = new Colour(0, 0, 0);
            float attenuation = 1;
            mat._EmissiveColour = new Colour(_Colour._Red * attenuation, _Colour._Green * attenuation, _Colour._Blue * attenuation);

            Sphere sphere = new Sphere();
            sphere._Position = position;
            sphere._Scale = new Vector3(_Radius, _Radius, _Radius);
            sphere._Material = mat;
            sphere._IgnoreLighting = true;
            sphere.CreateElement(false, parent);

            parent.Add(new XElement("LIGHT",
                new XAttribute("type", 4),
                new XAttribute("colour", _Colour),
                new XAttribute("position", _Position),
                new XAttribute("radius", _Radius),
                new XAttribute("samples", _Samples)));
        }