Exemple #1
0
 public CFGrid()
 {
     _Colour1 = new Colour();
     _Colour2 = new Colour();
     _Scale = 1;
     _Ratio = 0.9f;
     _IsCheckerboard = true;
 }
        public void Set(Colour colour, double max, IGUIUpdateable guiUpdateTarget)
        {
            _GUIUpdateTarget = guiUpdateTarget;
            _Colour = colour;
            _Maximum = max;

            RenderSliders();

            UpdateSwatch();
        }
Exemple #3
0
 public static void ReadColour(XmlReader reader, ref Colour colour)
 {
     string attr = reader.GetAttribute("colour");
     if (attr != null)
     {
         string[] rgb = attr.Split(',');
         colour._Red = float.Parse(rgb[0]);
         colour._Green = float.Parse(rgb[1]);
         colour._Blue = float.Parse(rgb[2]);
     }
 }
Exemple #4
0
 public Material()
 {
     _SpecularPower = 5;
     _Opacity = 1.0f;
     _RefractiveIndex = 1.0f;
     _Density = 1.0f;
     _TintDensity = 0.1f;
     _Shininess = 1.0f;
     _DiffuseColour = new Colour(1.0f, 0.5f, 0.0f);
     _SpecularColour = new Colour(0.4f, 0.4f, 0.4f);
     _EmissiveColour = new Colour(0.0f, 0.0f, 0.0f);
     _Reflectivity = new Colour(0.3f, 0.3f, 0.3f);
     _AbsorptionColour = new Colour(0.0f, 0.0f, 0.0f);
     _MaterialFunction = "";
 }
Exemple #5
0
        public XElement CreateElement(string name, bool preview)
        {
            XElement mat;
            if (preview)
            {
                Colour black = new Colour(0, 0, 0);
                mat = new XElement(name,
                    new XAttribute("specularPower", 10),
                    new XAttribute("opacity", 1),
                    new XAttribute("density", 1),
                    new XAttribute("tintdensity", 0.1),
                    new XAttribute("shininess", 1),
                    new XAttribute("refractiveIndex", 1),
                    _DiffuseColour.CreateElement("DIFFUSECOLOUR"),
                    black.CreateElement("SPECULARCOLOUR"),
                    _EmissiveColour.CreateElement("EMISSIVECOLOUR"),
                    black.CreateElement("REFLECTIVITYCOLOUR"),
                    _AbsorptionColour.CreateElement("ABSORPTIONCOLOUR"));
            }
            else
            {
                mat = new XElement(name,
                    new XAttribute("specularPower", _SpecularPower),
                    new XAttribute("opacity", _Opacity),
                    new XAttribute("density", _Density),
                    new XAttribute("tintdensity", _TintDensity),
                    new XAttribute("shininess", _Shininess),
                    new XAttribute("refractiveIndex", _RefractiveIndex),
                    _DiffuseColour.CreateElement("DIFFUSECOLOUR"),
                    _SpecularColour.CreateElement("SPECULARCOLOUR"),
                    _EmissiveColour.CreateElement("EMISSIVECOLOUR"),
                    _Reflectivity.CreateElement("REFLECTIVITYCOLOUR"),
                    _AbsorptionColour.CreateElement("ABSORPTIONCOLOUR"));
            }

            if (_MaterialFunction.Length > 0) mat.Add(new XAttribute("materialFunction", _MaterialFunction));

            return mat;
        }
Exemple #6
0
 public Colour(Colour rhs)
 {
     _Red = rhs._Red;
     _Green = rhs._Green;
     _Blue = rhs._Blue;
 }
Exemple #7
0
 public WorldLight()
 {
     _Colour  = new Colour();
     _Samples = 1;
 }
Exemple #8
0
 public WorldLight(Colour colour, int samples)
 {
     _Colour = colour;
     _Samples = samples;
 }
Exemple #9
0
 public PointLight(Colour colour, Vector3 position)
 {
     _Colour = colour;
     _Position = position;
 }
Exemple #10
0
 public SphereLight(Colour colour, Vector3 position, float radius, int samples)
 {
     _Colour = colour;
     _Position = position;
     _Radius = radius;
     _Samples = samples;
 }
Exemple #11
0
 public DirectionalLight(Colour colour, Vector3 direction, float area, int samples)
 {
     _Colour = colour;
     _Direction = direction;
     _Area = area;
     _Samples = samples;
 }
Exemple #12
0
 public AmbientLight(Colour colour)
 {
     _Colour = colour;
 }
Exemple #13
0
 public PointLight()
 {
     _Colour   = new Colour();
     _Position = new Vector3();
 }
Exemple #14
0
        public Colour Clone()
        {
            Colour ret = new Colour(_Red, _Green, _Blue);

            return(ret);
        }
Exemple #15
0
 public Colour(Colour rhs)
 {
     _Red   = rhs._Red;
     _Green = rhs._Green;
     _Blue  = rhs._Blue;
 }
Exemple #16
0
 public static Colour max(Colour col1, Colour col2)
 {
     return(new Colour(col1._Red > col2._Red ? col1._Red : col2._Red,
                       col1._Green > col2._Green ? col1._Green : col2._Green,
                       col1._Blue > col2._Blue ? col1._Blue : col2._Blue));
 }
Exemple #17
0
 public Vector3(Colour rhs)
 {
     x = rhs._Red; y = rhs._Green; z = rhs._Blue;
 }
Exemple #18
0
        private void GetMinMax(float[] renderBuffer, int renderWidth, int renderHeight)
        {
            _MinColour = new Colour(1000000.0f, 1000000.0f, 1000000.0f);
            _MaxColour = new Colour(0.0f, 0.0f, 0.0f);

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    int idx = (x + y * renderWidth) * 3;
                    float red = renderBuffer[idx], green = renderBuffer[idx + 1], blue = renderBuffer[idx + 2];
                    
                    if (red < _MinColour._Red) _MinColour._Red = red;
                    if (green < _MinColour._Green) _MinColour._Green = green;
                    if (blue < _MinColour._Blue) _MinColour._Blue = blue;

                    if (red > _MaxColour._Red) _MaxColour._Red = red;
                    if (green > _MaxColour._Green) _MaxColour._Green = green;
                    if (blue > _MaxColour._Blue) _MaxColour._Blue = blue;
                }
            }

            _MaxValue = Math.Max(_MaxColour._Red, Math.Max(_MaxColour._Green, _MaxColour._Blue));
        }
Exemple #19
0
 public WorldLight(Colour colour, int samples)
 {
     _Colour  = colour;
     _Samples = samples;
 }
Exemple #20
0
 public Colour Clone()
 {
     Colour ret = new Colour(_Red, _Green, _Blue);
     return ret;
 }
Exemple #21
0
 public AmbientLight()
 {
     _Colour = new Colour();
 }
Exemple #22
0
 public AmbientLight(Colour colour)
 {
     _Colour = colour;
 }
Exemple #23
0
 public DirectionalLight()
 {
     _Colour = new Colour();
     _Direction = new Vector3();
     _Area = 0.0f;
     _Samples = 1;
 }
Exemple #24
0
 public void SetColour(Colour colour, bool guiUpdate)
 {
     _Colour    = colour;
     _HSLColour = new HSLColour(colour);
     RenderSwatches();
 }
Exemple #25
0
 public SphereLight()
 {
     _Colour = new Colour();
     _Position = new Vector3();
     _Radius = 1;
     _Samples = 1;
 }
Exemple #26
0
 public CFConstant()
 {
     _Colour = new Colour();
 }
Exemple #27
0
 public PointLight()
 {
     _Colour = new Colour();
     _Position = new Vector3();
 }
Exemple #28
0
 public AmbientLight()
 {
     _Colour = new Colour();
 }
Exemple #29
0
 public WorldLight()
 {
     _Colour = new Colour();
     _Samples = 1;
 }
Exemple #30
0
 public static Colour max(Colour col1, Colour col2)
 {
     return new Colour(col1._Red > col2._Red ? col1._Red : col2._Red,
         col1._Green > col2._Green ? col1._Green : col2._Green,
         col1._Blue > col2._Blue ? col1._Blue : col2._Blue);
 }
Exemple #31
0
 public CFConstant(double red, double green, double blue)
 {
     _Colour = new Colour(red, green, blue);
 }
Exemple #32
0
 public PointLight(Colour colour, Vector3 position)
 {
     _Colour   = colour;
     _Position = position;
 }
Exemple #33
0
 public Vector3(Colour rhs) { x = rhs._Red; y = rhs._Green; z = rhs._Blue; }
Exemple #34
0
 public Background()
 {
     _Simple = true;
     _BackgroundColour = new Colour(0, 0, 0);
 }