Ejemplo n.º 1
0
 //Desk object constructor.
 public Desk(int inWidth, int inDepth, int inNumDrawers, string inSurface)
 {
     width      = inWidth;
     depth      = inDepth;
     numDrawers = inNumDrawers;
     surface    = (SurfaceMaterial)Enum.Parse(typeof(SurfaceMaterial), inSurface);
 }
        //Set SurfaceMaterial
        public void SetSurfaceMaterial(string value)
        {
            switch (value)
            {
            case "Oak":
                Material = SurfaceMaterial.Oak;
                break;

            case "Laminate":
                Material = SurfaceMaterial.Laminate;
                break;

            case "Pine":
                Material = SurfaceMaterial.Pine;
                break;

            case "Rosewood":
                Material = SurfaceMaterial.Rosewood;
                break;

            case "Veneer":
                Material = SurfaceMaterial.Veneer;
                break;
            }
        }
Ejemplo n.º 3
0
        private SurfaceMaterial GetSurface()
        {
            if (_tyreRaycastResults == null)
            {
                _tyreRaycastResults = new RaycastHit2D[32];
            }

            int resultCount = Physics2D.RaycastNonAlloc(transform.position, Vector2.zero, _tyreRaycastResults, 0f, LayerMask.GetMask("Surface"));

            SurfaceMaterial bestSurface = null;

            for (int i = resultCount - 1; i >= 0; i--)
            {
                RaycastHit2D hit = _tyreRaycastResults[i];
                if (!(hit.transform.GetComponentInParent <SurfaceMaterial>() is SurfaceMaterial sf))
                {
                    continue;
                }

                if (bestSurface == null)
                {
                    bestSurface = sf;
                    continue;
                }

                if (sf.Priority < bestSurface.Priority)
                {
                    continue;
                }

                bestSurface = sf;
            }

            return(bestSurface);
        }
Ejemplo n.º 4
0
        static Property FindTextureProperty(SurfaceMaterial material, string name, Property include = null)
        {
            var name1 = name.ToLower();
            var name2 = name1 + "color";
            var props = material.FindProperties(
                p => p.Name.ToLower() == name1 /* ||
                                                * p.Name.ToLower() == name2*/).ToList();

            if (include != null && !props.Contains(include))
            {
                props.Add(include);
            }

            foreach (var p in props)
            {
                foreach (var src in p.SrcObjects)
                {
                    if (src is Texture)
                    {
                        return(p);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
 public Desk(decimal Width, decimal Depth, int NumberofDrawer, SurfaceMaterial surfaceMaterial)
 {
     this.Width           = Width;
     this.Depth           = Depth;
     this.NumberofDrawer  = NumberofDrawer;
     this.SurfaceMaterial = surfaceMaterial;
 }
Ejemplo n.º 6
0
        public decimal GetQuotePrice(SurfaceMaterial material, int shippingIndex)
        {
            decimal Base = 200;

            this.QuotePrice = Base + GetAreaPrice() + GetDrawerPrice() + GetMaterialPrice(material) + GetShipping(shippingIndex);
            return(this.QuotePrice);
        }
Ejemplo n.º 7
0
 public Desk(decimal width, decimal depth, int drawers, SurfaceMaterial deskMaterial)
 {
     Width    = width;
     Depth    = depth;
     Drawers  = drawers;
     Material = deskMaterial;
 }
Ejemplo n.º 8
0
 void Awake()
 {
     for (int i = 0; i < physicsMaterials.Length; i++)
     {
         SurfaceMaterial.add(physicsMaterials[i], surfaceMaterials[i]);
     }
 }
Ejemplo n.º 9
0
 public Desk(decimal width                   = 24,
             decimal depth                   = 12,
             int numberOfDrawers             = 0,
             SurfaceMaterial surfaceMaterial = SurfaceMaterial.Pine)
 {
     this.width           = width;
     this.depth           = depth;
     this.numberOfDrawers = numberOfDrawers;
     this.surfaceMaterial = surfaceMaterial;
 }
Ejemplo n.º 10
0
        public Desk(int width, int depth, int drawers, SurfaceMaterial material)
        {
            Guid id = Guid.NewGuid();

            DeskId   = id;
            Width    = width;
            Depth    = depth;
            Drawers  = drawers;
            Material = material;
        }
Ejemplo n.º 11
0
        private void SearchQuotesMaterialComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SearchQuotesMaterialComboBox.Text == "Laminate")
            {
                chosenMaterial = SurfaceMaterial.Laminate;
            }
            else if (SearchQuotesMaterialComboBox.Text == "Oak")
            {
                chosenMaterial = SurfaceMaterial.Oak;
            }
            else if (SearchQuotesMaterialComboBox.Text == "Rosewood")
            {
                chosenMaterial = SurfaceMaterial.Rosewood;
            }
            else if (SearchQuotesMaterialComboBox.Text == "Veneer")
            {
                chosenMaterial = SurfaceMaterial.Veneer;
            }
            else if (SearchQuotesMaterialComboBox.Text == "Pine")
            {
                chosenMaterial = SurfaceMaterial.Pine;
            }
            List <DeskQuote> resultsList = new List <DeskQuote>();
            string           json        = "";

            try
            {
                json = File.ReadAllText("..\\..\\quotes.json");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine(e);
            }

            List <DeskQuote> quoteList = JsonConvert.DeserializeObject <List <DeskQuote> >(json);

            for (int i = 0; i < quoteList.Count; i++)
            {
                if (quoteList[i].Desk.DeskMaterial == chosenMaterial)
                {
                    resultsList.Add(quoteList[i]);
                }
            }

            resultsGridView.DataSource = resultsList;
            Count.Text = resultsGridView.RowCount.ToString() + " Results";
            resultsGridView.Columns[3].DefaultCellStyle.Format = "d";
            resultsGridView.Columns[4].DefaultCellStyle.Format = "c";
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SurfaceMaterial = await _context.SurfaceMaterial.FirstOrDefaultAsync(m => m.Id == id);

            if (SurfaceMaterial == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 13
0
        public void writeQuoteToFile(string customerName, Desk desk, int width, int depth,
                                     SurfaceMaterial material, int numberOfDrawers, int rushOrderOptions)
        {
            DeskQuote deskQuote = new DeskQuote();

            deskQuote.CustomerName         = customerName;
            deskQuote.Desk                 = desk;
            deskQuote.Desk.Width           = width;
            deskQuote.Desk.Depth           = depth;
            deskQuote.Desk.DeskMaterial    = material;
            deskQuote.Desk.NumberOfDrawers = numberOfDrawers;
            deskQuote.ShippingDays         = rushOrderOptions;
            deskQuote.QuoteTotal           = calculateTotalQuote(deskQuote.Desk, deskQuote.Desk.Width,
                                                                 deskQuote.Desk.Depth, deskQuote.Desk.DeskMaterial, deskQuote.Desk.NumberOfDrawers, deskQuote.ShippingDays);
            deskQuote.QuoteDate       = DateTime.Now;
            deskQuote.DeskMaterial    = material;
            deskQuote.NumberOfDrawers = numberOfDrawers;
            deskQuote.Depth           = depth;
            deskQuote.Width           = width;

            string date = deskQuote.QuoteDate.ToString("MM/dd/yyyy");


            string displayOutput = "Customer Name: " + deskQuote.CustomerName + Environment.NewLine +
                                   "Desk Width: " + deskQuote.Desk.Width + Environment.NewLine +
                                   "Desk Depth: " + deskQuote.Desk.Depth + Environment.NewLine +
                                   "Desk Material: " + deskQuote.Desk.DeskMaterial + Environment.NewLine +
                                   "Desk Drawer Count: " + deskQuote.Desk.NumberOfDrawers + Environment.NewLine +
                                   "Rush Order: " + deskQuote.ShippingDays + Environment.NewLine +
                                   "Quate Date: " + date + Environment.NewLine +
                                   "Quote Total: $" + deskQuote.QuoteTotal;

            DisplayQuote.Quote = displayOutput;

            if (!File.Exists("..\\..\\quotes.json"))
            {
                File.Create("..\\..\\quotes.json").Close();
            }

            var data = File.ReadAllText("..\\..\\quotes.json");

            var listQuotes = JsonConvert.DeserializeObject <List <DeskQuote> >(data) ?? new List <DeskQuote>();

            listQuotes.Add(deskQuote);

            data = JsonConvert.SerializeObject(listQuotes.ToArray());
            File.WriteAllText("..\\..\\quotes.json", data);
        }
Ejemplo n.º 14
0
        public RenderingController(SurfaceMaterial mat, int w, int h)
        {
            FrameDescription frame;

            config = new MaterialViewRayEngineConfiguration(mat, mat);
            SetupRenderer();
            using (var frameFile = new FileStream(frameName, FileMode.Open, FileAccess.Read))
            {
                using (var reader = new StreamReader(frameFile))
                    frame = (FrameDescription)SerializationService.Deserialize(reader.ReadToEnd(), typeof(FrameDescription));
            }
            frame["ImageWidth"] = w;
            frame["ImageHeight"] = h;
            frame.FrameName = Path.GetFileNameWithoutExtension(frameName);
            config.OpenFrame(frame);
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SurfaceMaterial = await _context.SurfaceMaterial.FindAsync(id);

            if (SurfaceMaterial != null)
            {
                _context.SurfaceMaterial.Remove(SurfaceMaterial);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 16
0
        //private void loadGrid(string searchTerm)
        //{
        //    dataGridView2.Rows.Clear();
        //    string[] deskQuotes = File.ReadAllLines(@"quotes.txt");
        //    foreach (string deskQuote in deskQuotes)
        //    {
        //        if (deskQuote.Contains(searchTerm))
        //        {
        //            string[] arrRow = deskQuote.Split(new char[] { ',' });
        //            dataGridView2.Rows.Add(arrRow);
        //        }
        //    }
        //}

        private void lblMaterial_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <DeskQuote> myQuotes = new List <DeskQuote>();
            string           readText = File.ReadAllText("C:\\Users\\lisac\\Documents\\quotes.txt");
            var             lines     = readText.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            SurfaceMaterial material  = (SurfaceMaterial)lblMaterial.SelectedItem;

            foreach (var line in lines)
            {
                var quote = new DeskQuote(line);
                if (material.Name.CompareTo(quote.Desk.SurfaceMaterial.Name) == 0)
                {
                    myQuotes.Add(quote);
                }
            }
            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = myQuotes;
        }
Ejemplo n.º 17
0
        public static void ApplyMaterialOverrides(SurfaceMaterial[] surfMats, Dictionary<string, Func<MaterialInfo, SurfaceMaterial>> overrideFuncs)
        {

            for (int index = 0; index < surfMats.Length; index++)
            {
                if (surfMats[index] == null)
                    continue;
                if (overrideFuncs.ContainsKey(surfMats[index].Name))
                {
                    var newMat = overrideFuncs[surfMats[index].Name](surfMats[index].First.MaterialData);
                    if (newMat != null)
                    {
                        Tracer.TraceLine(string.Format("$!$ Material override-{2} - {0} to {1}", surfMats[index].First.GetType().Name, newMat.First.GetType().Name, surfMats[index].Name));
                        surfMats[index] = newMat;
                    }
                }
            }

        }
Ejemplo n.º 18
0
        static Property GetMaterialColorProperty(SurfaceMaterial material, string name, Property include = null)
        {
            var name1 = name.ToLower();
            var name2 = name1 + "color";
            var props = material.FindProperties(
                p => p.Name.ToLower() == name1 /* ||
                                                * p.Name.ToLower() == name2*/).ToList();

            var v = new _FbxSharp.Vector3(0, 0, 0);

            if (include != null && !props.Contains(include))
            {
                props.Add(include);
            }

            foreach (var p in props)
            {
                if (p.PropertyDataType == typeof(_FbxSharp.Vector3))
                {
                    v = (_FbxSharp.Vector3)p.GetValue();
                    if (v != _FbxSharp.Vector3.Zero)
                    {
                        return(p);
                    }
                }
            }

            foreach (var p in props)
            {
                if (p.PropertyDataType == typeof(_FbxSharp.Color))
                {
                    v = p.Get <_FbxSharp.Color>().ToVector3();
                    if (v != _FbxSharp.Vector3.Zero)
                    {
                        return(p);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 19
0
        public void writeQuoteToFile(string customerName, Desk desk, int width, int depth,
                                     SurfaceMaterial material, int numberOfDrawers, int rushOrderOptions)
        {
            DeskQuote deskQuote = new DeskQuote();

            deskQuote._customerName         = customerName;
            deskQuote._desk                 = desk;
            deskQuote._desk.Width           = width;
            deskQuote._desk.Depth           = depth;
            deskQuote._desk.DeskMaterial    = material;
            deskQuote._desk.NumberOfDrawers = numberOfDrawers;
            deskQuote._rushDays             = rushOrderOptions;
            deskQuote._quoteTotal           = calculateTotalQuote(deskQuote._desk, deskQuote._desk.Width,
                                                                  deskQuote._desk.Depth, deskQuote._desk.DeskMaterial, deskQuote._desk.NumberOfDrawers, deskQuote._rushDays);

            StreamWriter writer;

            writer = new StreamWriter(@"c:\tmp\DeskQuotes.txt");
            string output = "Customer Name: " + deskQuote._customerName + "\n" +
                            "Desk Width: " + deskQuote._desk.Width + "\n" +
                            "Desk Depth: " + deskQuote._desk.Depth + "\n" +
                            "Desk Material: " + deskQuote._desk.DeskMaterial + "\n" +
                            "Desk Drawer Count: " + deskQuote._desk.NumberOfDrawers + "\n" +
                            "Rush Order: " + deskQuote._rushDays + "\n" +
                            "Quote Total: $" + deskQuote._quoteTotal;

            writer.WriteLine(output);
            writer.Close();

            string displayOutput = "Customer Name: " + deskQuote._customerName + Environment.NewLine +
                                   "Desk Width: " + deskQuote._desk.Width + Environment.NewLine +
                                   "Desk Depth: " + deskQuote._desk.Depth + Environment.NewLine +
                                   "Desk Material: " + deskQuote._desk.DeskMaterial + Environment.NewLine +
                                   "Desk Drawer Count: " + deskQuote._desk.NumberOfDrawers + Environment.NewLine +
                                   "Rush Order: " + deskQuote._rushDays + Environment.NewLine +
                                   "Quote Total: $" + deskQuote._quoteTotal;

            DisplayQuote.Quote = displayOutput;
        }
Ejemplo n.º 20
0
        private void loadGrid(SurfaceMaterial desktopMaterial)
        {
            var quotesFile = @"quotes.json";

            using (StreamReader reader = new StreamReader(quotesFile))
            {
                //This loads in the existing quotes
                string           quotes     = reader.ReadToEnd();
                List <DeskQuote> deskQuotes = JsonConvert.DeserializeObject <List <DeskQuote> >(quotes);

                dataGridView1.DataSource = deskQuotes.Select(d => new
                {
                    Date            = d.currentDate,
                    Customer        = d.customerName,
                    Depth           = d.desk.Depth,
                    Width           = d.desk.Width,
                    Drawers         = d.desk.NumberOfDrawers,
                    SurfaceMaterial = d.desk.SurfaceMaterial,
                    DeliveryType    = d.desk.RushOption,
                    QuoteAmount     = d.price.ToString("c")
                }).Where(q => q.SurfaceMaterial == desktopMaterial)
                                           .ToList();
            }
        }
Ejemplo n.º 21
0
 public DeskQuote(string customerName, int rushDays, double width, double depth, int numOfDrawers, SurfaceMaterial material)
 {
     CustomerName    = customerName;
     RushDays        = rushDays;
     Desk.Width      = width;
     Desk.Depth      = depth;
     Desk.NumDrawers = numOfDrawers;
     Desk.Material   = material;
 }
Ejemplo n.º 22
0
 public decimal GetMaterialPrice(SurfaceMaterial material)
 {
     return((decimal)material);
 }
Ejemplo n.º 23
0
 public decimal CalculateQuoteTotal(int surfacearea, int drawers, SurfaceMaterial material, int rushDays)
 {
     QuoteTotal = BASE_PRICE + SurfaceAreaFee(surfacearea) + DrawerFee(drawers) + (int)material + RushFee(rushDays, surfacearea);
     return(QuoteTotal);
 }
Ejemplo n.º 24
0
        static MaterialContent GetMaterialFromMaterial(SurfaceMaterial material, ShaderContent vertexShaderStage, ShaderContent fragmentShaderStage, IContentImporter importer, string filename)
        {
            var shaderTuple = new Tuple <ShaderContent, ShaderContent>(vertexShaderStage, fragmentShaderStage);

            if (_materialsCache.ContainsKey(material) && _materialsCache[material].ContainsKey(shaderTuple))
            {
                return(_materialsCache[material][shaderTuple]);
            }

            if (!_materialsCache.ContainsKey(material))
            {
                _materialsCache[material] = new Dictionary <Tuple <ShaderContent, ShaderContent>, MaterialContent>();
            }

            var material2 = new MaterialContent();

            material2.VertexShader   = vertexShaderStage;
            material2.FragmentShader = fragmentShaderStage;
            material2.Alpha          = 1;
            material2.DiffuseColor   = new Vector3(0.5f, 0.5f, 0.5f);
            material2.Name           = material.Name;

            Property diffuseProp;
            Property emissiveProp;
            Property textureProp;

            if (material is SurfaceLambert)
            {
                var lambert = material as SurfaceLambert;
                diffuseProp  = GetMaterialColorProperty(lambert, "Diffuse", lambert.Diffuse);
                emissiveProp = GetMaterialColorProperty(lambert, "Emissive", lambert.Emissive);
                textureProp  = FindTextureProperty(lambert, "Diffuse", lambert.Diffuse);
            }
            else
            {
                diffuseProp  = GetMaterialColorProperty(material, "Diffuse");
                emissiveProp = GetMaterialColorProperty(material, "Emissive");
                textureProp  = FindTextureProperty(material, "Diffuse");
            }

            if (diffuseProp != null)
            {
                material2.DiffuseColor = GetPropertyValue(diffuseProp);
            }
            if (emissiveProp != null)
            {
                material2.EmissiveColor = GetPropertyValue(emissiveProp);
            }
            if (textureProp != null)
            {
                var tex = GetMaterialTexture(textureProp, importer, filename);
                if (tex != null)
                {
                    material2.Texture = tex;
                }
            }

            if (material is SurfacePhong)
            {
                var phong = material as SurfacePhong;

                var specularProp = GetMaterialColorProperty(phong, "Specular", phong.Specular);
                if (specularProp != null)
                {
                    material2.SpecularColor = GetPropertyValue(specularProp);

                    var props =
                        phong.FindProperties(
                            p => p.Name.ToLower() == "shininessexponent" ||
                            p.Name.ToLower() == "shininess");
                    double shininess = 0;
                    foreach (var prop in props)
                    {
                        if (prop.PropertyDataType == typeof(double))
                        {
                            shininess = prop.Get <double>();
                            if (shininess > 0)
                            {
                                break;
                            }
                        }
                    }

                    material2.SpecularPower = (float)shininess;
                }
            }

            if (material is SurfaceLambert)
            {
                var transparencyFactor = (material as SurfaceLambert).TransparencyFactor;
                if (transparencyFactor != null)
                {
                    material2.Alpha = (float)(1 - transparencyFactor.Get());
                }
            }

            _materialsCache[material][shaderTuple] = material2;

            return(material2);
        }
Ejemplo n.º 25
0
 public MaterialInstance(DCVoxelMaterial material, DeferredRenderer dRenderer, DX11Game gamez)
 {
     Material = material;
     Shader   = new SurfaceMaterial(gamez, dRenderer.TexturePool.LoadTexture(material.Texture));
 }
Ejemplo n.º 26
0
 //determine material price based on user selection and return price
 public int CalcMaterialPrice(SurfaceMaterial material)
 {
     int price = 0;
     switch (material)
     {
         case SurfaceMaterial.Oak:
             price = 200;
             break;
         case SurfaceMaterial.Laminate:
             price = 100;
             break;
         case SurfaceMaterial.Pine:
             price = 50;
             break;
         case SurfaceMaterial.Marble:
             price = 500;
             break;
         case SurfaceMaterial.Walnut:
             price = 250;
             break;
         case SurfaceMaterial.Metal:
             price = 300;
             break;
         default:
             Console.WriteLine("Invalid material choice detected during calculations.");
             return 0;
     }
     return price;
 }
Ejemplo n.º 27
0
 /// <summary>放射率[-]を初期化する</summary>
 /// <param name="sMaterial">表面素材</param>
 /// <remarks>空調・衛生技術データブック(株式会社テクノ菱和)のデータの平均値を利用</remarks>
 public void InitializeEmissivity(SurfaceMaterial sMaterial)
 {
     switch (sMaterial)
     {
         case SurfaceMaterial.BlackBody:
             LongWaveEmissivity = 1.0;
             SolarAbsorptance = 1.0;
             break;
         case SurfaceMaterial.Asphalt:
         case SurfaceMaterial.BlackPaint:
             LongWaveEmissivity = 0.94;
             SolarAbsorptance = 0.915;
             break;
         case SurfaceMaterial.RedBrick:
         case SurfaceMaterial.DarkTile:
         case SurfaceMaterial.DarkPaint:
         case SurfaceMaterial.Concrete:
         case SurfaceMaterial.Stone:
             LongWaveEmissivity = 0.9;
             SolarAbsorptance = 0.725;
             break;
         case SurfaceMaterial.CreamColorBrick:
         case SurfaceMaterial.CreamColorPaint:
         case SurfaceMaterial.Plaster:
             LongWaveEmissivity = 0.9;
             SolarAbsorptance = 0.4;
             break;
         case SurfaceMaterial.AluminumPaint:
         case SurfaceMaterial.BronzePaint:
             LongWaveEmissivity = 0.5;
             SolarAbsorptance = 0.4;
             break;
         case SurfaceMaterial.Brass:
         case SurfaceMaterial.Aluminum:
         case SurfaceMaterial.Zinc:
             LongWaveEmissivity = 0.25;
             SolarAbsorptance = 0.525;
             break;
         case SurfaceMaterial.PolishedBrass:
             LongWaveEmissivity = 0.035;
             SolarAbsorptance = 0.4;
             break;
         case SurfaceMaterial.PolishedAluminum:
         case SurfaceMaterial.TinPlate:
             LongWaveEmissivity = 0.03;
             SolarAbsorptance = 0.25;
             break;
     }
 }
Ejemplo n.º 28
0
 private static string GetMaterialName(SurfaceMaterial mt)
 {
     return string.Format("[{0}]_|_<{1}>", mt.First!=null ? mt.First.GetType().Name :"Empty", mt.Name);
 }
 public MaterialViewRayEngineConfiguration(SurfaceMaterial mat, SurfaceMaterial pm)
 {
     this.config = new ConfigurableEntity(GlobalConfiguration.Instance);
     this.ObjectMaterial = mat;
     this.PlaneMaterial = pm;
 }
Ejemplo n.º 30
0
 public void Update() => _currentSurface = GetSurface();
Ejemplo n.º 31
0
 public Surface(SurfaceGeometry geometry, SurfaceMaterial material)
 {
     Geometry         = geometry;
     Material         = material;
     Geometry.Surface = this;
 }
Ejemplo n.º 32
0
        public double calculateTotalQuote(Desk desk, int width, int depth,
                                          SurfaceMaterial material, int numberOfDrawers, int rushOrderOptions)
        {
            double rushPrice     = 0;
            double materialPrice = 0;
            double surfaceArea   = width * depth;

            // Calculate materialPrice.
            if (material == SurfaceMaterial.Oak)
            {
                materialPrice = 200;
            }
            else if (material == SurfaceMaterial.Laminate)
            {
                materialPrice = 100;
            }
            else if (material == SurfaceMaterial.Pine)
            {
                materialPrice = 50;
            }
            else if (material == SurfaceMaterial.Rosewood)
            {
                materialPrice = 300;
            }
            else if (material == SurfaceMaterial.Veneer)
            {
                materialPrice = 125;
            }

            // Calculate rushPrice.
            switch (rushOrderOptions)
            {
            case 3:
                if (surfaceArea < 1000)
                {
                    rushPrice = 60;
                }
                else if (surfaceArea >= 1000 || surfaceArea <= 2000)
                {
                    rushPrice = 70;
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = 80;
                }
                break;

            case 5:
                if (surfaceArea < 1000)
                {
                    rushPrice = 40;
                }
                else if (surfaceArea >= 1000 || surfaceArea <= 2000)
                {
                    rushPrice = 50;
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = 60;
                }
                break;

            case 7:
                if (surfaceArea < 1000)
                {
                    rushPrice = 30;
                }
                else if (surfaceArea >= 1000 || surfaceArea <= 2000)
                {
                    rushPrice = 35;
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = 40;
                }
                break;

            default:
                Console.WriteLine("Something probably went wrong.");
                break;
            }

            double total = (surfaceArea * CUBICPRICE) + (numberOfDrawers * DRAWERPRICE) + rushPrice + materialPrice;

            return(total);
        }
Ejemplo n.º 33
0
        public double calculateTotalQuote(Desk desk, int width, int depth,
                                          SurfaceMaterial material, int numberOfDrawers, int rushOrderOptions)
        {
            double rushPrice     = 0;
            double materialPrice = 0;
            double surfaceArea   = width * depth;

            double[,] rushOrderPriceMap = GetRushOrder(surfaceArea, rushOrderOptions);
            List <int> materialPriceList = new List <int>()
            {
                200, 100, 50, 300, 125
            };

            // Calculate materialPrice.
            if (material == SurfaceMaterial.Oak)
            {
                materialPrice = materialPriceList[0];
            }
            else if (material == SurfaceMaterial.Laminate)
            {
                materialPrice = materialPriceList[1];
            }
            else if (material == SurfaceMaterial.Pine)
            {
                materialPrice = materialPriceList[2];
            }
            else if (material == SurfaceMaterial.Rosewood)
            {
                materialPrice = materialPriceList[3];
            }
            else if (material == SurfaceMaterial.Veneer)
            {
                materialPrice = materialPriceList[4];
            }

            // Calculate rushPrice.
            switch (rushOrderOptions)
            {
            case 3:
                if (surfaceArea < 1000)
                {
                    rushPrice = rushOrderPriceMap[0, 0];
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    rushPrice = rushOrderPriceMap[0, 1];
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = rushOrderPriceMap[0, 2];
                }
                break;

            case 5:
                if (surfaceArea < 1000)
                {
                    rushPrice = rushOrderPriceMap[1, 0];
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    rushPrice = rushOrderPriceMap[1, 1];
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = rushOrderPriceMap[1, 2];
                }
                break;

            case 7:
                if (surfaceArea < 1000)
                {
                    rushPrice = rushOrderPriceMap[2, 0];
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    rushPrice = rushOrderPriceMap[2, 1];
                }
                else if (surfaceArea > 2000)
                {
                    rushPrice = rushOrderPriceMap[2, 2];
                }
                break;

            default:
                break;
            }

            // Get total price of order
            if (surfaceArea > 1000)
            {
                double total = (surfaceArea * SQUAREPRICE) + (numberOfDrawers * DRAWERPRICE) + rushPrice + materialPrice + 200;
                return(total);
            }
            else
            {
                double total = (numberOfDrawers * DRAWERPRICE) + rushPrice + materialPrice + 200;
                return(total);
            }
        }
Ejemplo n.º 34
0
        private void Init()
        {
            var materialInfo = new MaterialInfo()
                {
                    Name = "object_materialview_test",
                    DiffuseReflectance =  new RgbSpectrum(0.6f), GlossReflectance = new RgbSpectrum(0f, 0.45f, 0.65f), PhongExponent = 50f,SpecularReflectance = new RgbSpectrum(0.75f),
                    DiffuseTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\Oxidated.jpg" },// { FilePath = @"I:\3D\Textures\102.png" },
                    //BumpTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\102bump.png" },
                    NormalMap = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\Oxidated.normal.jpg" }
                };
            var secondMI = new MaterialInfo()
                {
                    Name = "smi",
                    DiffuseReflectance = new RgbSpectrum(0.75f),
                    SpecularReflectance = new RgbSpectrum(0.75f)
                };
            ObjectMaterial = new SurfaceMaterial
                (
                //new MatteMaterial(materialInfo.DiffuseReflectance) { MaterialData = materialInfo }
                new OrenNayarMaterial(materialInfo.DiffuseReflectance, 0.2f) { MaterialData = materialInfo }
                //new AnisotropicPhong(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, 10f, 10f) { MaterialData = materialInfo}
                //new GlassMaterial(materialInfo.DiffuseReflectance + 0.2f, materialInfo.GlossReflectance + 0.2f, 1.0005f, 1.5f, true, true) { MaterialData = materialInfo }
                
                //new MetalMaterial(materialInfo.DiffuseReflectance, materialInfo.PhongExponent, true){MaterialData = materialInfo}
                /*
                 */

               // new MatteMirrorMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, true) { MaterialData = materialInfo }
                // new ArchGlassMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, true, true) { MaterialData = materialInfo}
                    
                /*
                new DistributionBsdf(10.175f, materialInfo.DiffuseReflectance
                    //,new FresnelDielectric(1.39f, 0.6f)
                    ,new FresnelConductor(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance)
                    ) {MaterialData = materialInfo} */
                //new MirrorMaterial(materialInfo.DiffuseReflectance, true) { MaterialData = materialInfo }
                //new MatteMaterial(secondMI.DiffuseReflectance) { MaterialData = secondMI }
                //new TranslucentMaterial(materialInfo.DiffuseReflectance) { MaterialData = secondMI }
                //new MatteMaterial(materialInfo.DiffuseReflectance){ MaterialData = materialInfo }
                /*
                new MatteMaterial(materialInfo.DiffuseReflectance){ MaterialData = materialInfo }
                 * 
                new MirrorMaterial(secondMI.DiffuseReflectance, true) { MaterialData = secondMI }*/
              //new AlloyMaterial(materialInfo.DiffuseReflectance, materialInfo.GlossReflectance, materialInfo.PhongExponent, 0.5f, true) {MaterialData = materialInfo}
                    );

            var planeMI = new MaterialInfo()
                {
                    Name = "plane_material",
                    DiffuseReflectance = new RgbSpectrum(0.7f),
                    DiffuseTexture = new ImageTextureInfo() { FilePath = "Finishes.Flooring.Tile.Diamond.Red.jpg" },
                    //{ FilePath = @"I:\3D\Textures\CEDFENCE.jpg" },
                    //BumpTexture = new ImageTextureInfo() { FilePath = @"I:\3D\Textures\102bump.png" },
                    BumpMap = new ImageTextureInfo() { FilePath = "Finishes.Flooring.Tile.Diamond.Red.bump.jpg" }
                    
                    //{ FilePath = @"I:\3D\Textures\CEDFENCE.Normal.jpg" }

                };
            PlaneMaterial = new SurfaceMaterial(

                new MatteMaterial(planeMI.DiffuseReflectance) 

                // new DistributionBsdf(1.175f, materialInfo.DiffuseReflectance ,new FresnelDielectric(1.39f, 0.6f))
                { MaterialData = planeMI});

        }
Ejemplo n.º 35
0
        private void generateQuote_btn_Click(object sender, EventArgs e)
        {
            try
            {
                //check for required and collect values
                string errorMessage = "";

                if (CustomerName_tb.Text == string.Empty)
                {
                    //MessageBox.Show("Please enter a Customer Name");
                    errorMessage += "Customer Name is Required\n";
                    CustomerName_tb.BackColor = Color.Aqua;
                }

                if (DeskWidth_tb.Text == string.Empty)
                {
                    errorMessage          += "Desk Width is Required\n";
                    DeskWidth_tb.BackColor = Color.Aqua;
                }

                if (DeskDepth_tb.Text == string.Empty)
                {
                    errorMessage          += "Desk Depth is Required\n";
                    DeskDepth_tb.BackColor = Color.Aqua;
                }

                if (SurfaceMaterial_tb.SelectedIndex < 0)
                {
                    errorMessage += "Surface Material is Required\n";
                    SurfaceMaterial_tb.BackColor = Color.Aqua;
                }

                if (errorMessage.Length > 0)
                {
                    MessageBox.Show(errorMessage);
                    return;
                }

                CustomerName    = CustomerName_tb.Text;
                DeskWidth       = int.Parse(DeskWidth_tb.Text);
                DeskDepth       = int.Parse(DeskDepth_tb.Text);
                surfaceMaterial = (SurfaceMaterial)SurfaceMaterial_tb.SelectedValue;

                Drawers = Decimal.ToInt32(DeskDrawers_tb.Value);

                if (radioButtonStandard.Checked)
                {
                    RushDays = 14;
                }
                if (radioButton7Day.Checked)
                {
                    RushDays = 7;
                }
                if (radioButton5Day.Checked)
                {
                    RushDays = 5;
                }
                if (radioButton3Day.Checked)
                {
                    RushDays = 3;
                }

                //now we have our parts so create the qoute object by calling the constructor
                NewQuote = new DeskQoute(CustomerName, DateTime.Now, DeskWidth, DeskDepth, Drawers, surfaceMaterial, RushDays);

                //let user know it worked
                MessageBox.Show("New Qoute Successful.\nQuoute total:" + NewQuote.QuoteTotal.ToString("C2"));
            }
            catch (Exception exception)
            {
                Console.WriteLine("Generic Exception Handler: {0}", exception.ToString());
            }

            //save DeskQuote as CSV file
            try
            {
                SaveQuoteToCSV(NewQuote);
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }

            //all done, so refresh form
            FormReset(); //not working so just go back to main menu
        }
Ejemplo n.º 36
0
        public DeskQoute(string customerName, DateTime quoteDate, int width, int depth, int drawers, SurfaceMaterial material, int rushDays)
        {
            CustomerName         = customerName;
            Quotedate            = quoteDate;
            Desk.Width           = width;
            Desk.Depth           = depth;
            Desk.NumOfDrawers    = drawers;
            Desk.SurfaceMaterial = material;
            RushDays             = rushDays;

            SurfaceArea = Desk.Width * Desk.Depth;

            this.QuoteTotal = CalculateQuoteTotal(SurfaceArea, drawers, material, RushDays);
        }
Ejemplo n.º 37
0
 public static void ApplyMaterialOverrides(SurfaceMaterial[] surfMats, RayEngineScene scene)
 {
     ApplyMaterialOverrides(surfMats, overrides);
     OverrideTextures(scene.OptTextures, scene.texturesMap);
 }
Ejemplo n.º 38
0
 public static void ApplyMaterialOverrides(SurfaceMaterial[] surfMats)
 {
     ApplyMaterialOverrides(surfMats, overrides);
 }