示例#1
0
        public ActionResult addProductDAO(PView item, HttpPostedFileBase[] picture)
        {
            int id    = Repository.AddProduct(item);
            int count = 0;

            if (picture != null)
            {
                foreach (var p in picture)
                {
                    byte   status = 2;
                    string path   = Path.Combine(Server.MapPath("~/Content/Picture/Admin/Product"), Path.GetFileName(p.FileName));
                    p.SaveAs(path);
                    if (count == 0)
                    {
                        status = 1;
                    }
                    Repository.AddImage(new ProImageView {
                        Name = p.FileName, IDP = id, StatusIMG = status
                    });
                    count++;
                }
            }

            return(RedirectToAction("editProduct"));
        }
        /// <summary>
        /// Draw
        /// </summary>
        /// <param name="gt"></param>
        /// <param name="obj"></param>
        /// <param name="render">The render.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights"></param>
        protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList <Light.ILight> lights)
        {
            Pid.SetValue(shaderId);
            PuseGlow.SetValue(useGlow);
            PuseBump.SetValue(useBump);
            PuseSpecular.SetValue(useSpecular);
            PView.SetValue(cam.View);
            PProjection.SetValue(cam.Projection);
            PCameraPos.SetValue(cam.Position);
            PreflectionIndex.SetValue(reflectionIndex);

            Matrix wld = obj.WorldMatrix;

            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
                for (int j = 0; j < bi.Count(); j++)
                {
                    //PDiffuse.SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE,i,j));
                    //PTexture.SetValue(obj.Modelo.GetTextureInformation(i)[j].getCubeTexture(TextureType.ENVIRONMENT));

                    render.device.Textures[0] = obj.Modelo.GetTextureInformation(i)[j].getTexture(TextureType.DIFFUSE);
                    render.device.Textures[4] = obj.Modelo.GetTextureInformation(i)[j].getCubeTexture(TextureType.ENVIRONMENT);

                    if (useBump)
                    {
                        //PNormalMap.SetValue(obj.Modelo.getTexture(TextureType.BUMP, i, j));
                        render.device.Textures[1] = obj.Modelo.GetTextureInformation(i)[j].getTexture(TextureType.BUMP);
                    }
                    if (useSpecular)
                    {
                        //PSpecularMap.SetValue(obj.Modelo.getTexture(TextureType.SPECULAR, i, j));
                        render.device.Textures[2] = obj.Modelo.GetTextureInformation(i)[j].getTexture(TextureType.SPECULAR);
                        PspecularIntensityScale.SetValue(SpecularIntensityMapScale);
                        PspecularPowerScale.SetValue(SpecularPowerMapScale);
                    }
                    else
                    {
                        PspecularIntensity.SetValue(specularIntensity);
                        PspecularPower.SetValue(specularPower);
                    }

                    if (useGlow)
                    {
                        //Pglow.SetValue(obj.Modelo.getTexture(TextureType.GLOW, i, j));
                        render.device.Textures[3] = obj.Modelo.GetTextureInformation(i)[j].getTexture(TextureType.GLOW);
                    }


                    Matrix w1 = Matrix.Multiply(bi[j].ModelLocalTransformation, wld);
                    PWorld.SetValue(w1);
                    PWorldInverseTranspose.SetValue(Matrix.Transpose(Matrix.Invert(w1)));

                    render.RenderBatch(bi[j], _shader);
                }
            }
        }
示例#3
0
        public ActionResult Product(string id)
        {
            ViewBag.STT = 0;
            if (id == null)
            {
                RedirectToAction("Index");
            }
            PView pv = Repository.GetProdViewByID(Convert.ToInt32(id));

            ViewBag.Prod = pv;
            return(View());
        }
        public Dictionary <string, object> FindStationAndElevationAtXY(double x, double y)
        {
            double station = 0.0, elevation = 0.0;
            bool   isOn
                = PView.FindStationAndElevationAtXY
                      (x, y, ref station, ref elevation);

            return(new Dictionary <string, object>
            {
                { "Station", station },
                { "Elevation", elevation },
                { "IsOnPView", isOn }
            });
        }
        public Dictionary <string, object> FindXYAtStationAndElevation(double station, double elevation)
        {
            double x = 0.0, y = 0.0;
            bool   isOn
                = PView.FindXYAtStationAndElevation
                      (station, elevation, ref x, ref y);

            return(new Dictionary <string, object>
            {
                { "X", x },
                { "Y", y },
                { "IsOnPView", isOn }
            });
        }
        /// <summary>
        /// Draw
        /// </summary>
        /// <param name="gt"></param>
        /// <param name="obj"></param>
        /// <param name="render">The render.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights"></param>
        protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList <Light.ILight> lights)
        {
            Pid.SetValue(shaderId);
            PuseParalax.SetValue(useParalax);
            PuseGlow.SetValue(useGlow);
            PuseBump.SetValue(useBump);
            PuseSpecular.SetValue(useSpecular);
            PView.SetValue(cam.View);
            PProjection.SetValue(cam.Projection);

            if (useParalax)
            {
                this._shader.Parameters["CameraPos"].SetValue(cam.Position);
            }

            Matrix wld = obj.WorldMatrix;

            for (int i = 0; i < obj.Modelo.MeshNumber; i++)
            {
                BatchInformation[] bi = obj.Modelo.GetBatchInformation(i);
                for (int j = 0; j < bi.Count(); j++)
                {
                    Matrix w1 = Matrix.Multiply(bi[j].ModelLocalTransformation, wld);
                    PWorld.SetValue(w1);

                    render.device.Textures[0] = obj.Modelo.getTexture(TextureType.DIFFUSE, i, j);
                    //PTexture.SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE, i, j));
                    if (useBump)
                    {
                        if (useParalax)
                        {
                            //this._shader.Parameters["HeightMap"].SetValue(obj.Modelo.getTexture(TextureType.PARALAX,i,j));
                            render.device.Textures[5] = obj.Modelo.getTexture(TextureType.PARALAX, i, j);
                            this._shader.Parameters["scaleBias"].SetValue(scaleBias);
                        }

                        PWorldInverseTranspose.SetValue(Matrix.Transpose(Matrix.Invert(w1)));
                        //PNormalMap.SetValue(obj.Modelo.getTexture(TextureType.BUMP, i, j));
                        render.device.Textures[1] = obj.Modelo.getTexture(TextureType.BUMP, i, j);
                    }
                    if (useSpecular)
                    {
                        //PSpecularMap.SetValue(obj.Modelo.getTexture(TextureType.SPECULAR, i, j));
                        render.device.Textures[2] = obj.Modelo.getTexture(TextureType.SPECULAR, i, j);
                        PspecularIntensityScale.SetValue(SpecularIntensityMapScale);
                        PspecularPowerScale.SetValue(SpecularPowerMapScale);
                    }
                    else
                    {
                        PspecularIntensity.SetValue(specularIntensity);
                        PspecularPower.SetValue(specularPower);
                    }

                    if (useGlow)
                    {
                        //Pglow.SetValue(obj.Modelo.getTexture(TextureType.GLOW, i, j));
                        render.device.Textures[3] = obj.Modelo.getTexture(TextureType.GLOW, i, j);
                    }

                    if (useAmbientCubeMap)
                    {
                        //PAmbientCube.SetValue(obj.Modelo.GetCubeTexture(TextureType.AMBIENT_CUBE_MAP, i, j));
                        render.device.Textures[4] = obj.Modelo.GetCubeTexture(TextureType.AMBIENT_CUBE_MAP, i, j);
                        PAmbientCubeMapScale.SetValue(AmbientCubeMapScale);
                    }

                    render.RenderBatch(bi[j], _shader);
                }
            }
        }