示例#1
0
    protected virtual void RealizeTextureOnMaterial(Material material, TextureDetail textureDetail)
    {
        if (material == null)
        {
            throw new InvalidOperationException("Cannot realize textures on a null material.");
        }

        switch (textureDetail.DetailType)
        {
        case TextureDetailType.Texture:
            string texturePath = textureDetail.DetailValue.ToString();
            if (string.IsNullOrEmpty(texturePath))
            {
                throw new ApplicationException("Cannot load texture from a null/empty path!");
            }

            texturePath = texturePath.Trim('"');

            Texture2D texture = Resources.Load <Texture2D>(texturePath);
            if (texture == null)
            {
                DebugMessage("Could not find a texture at path " + texturePath);
            }

            material.SetTexture(textureDetail.DetailKey, texture);
            break;

        case TextureDetailType.Tint:
            Color color = (Color)textureDetail.DetailValue;
            material.SetColor(textureDetail.DetailKey, color);
            break;

        case TextureDetailType.Int:
            int integer = (int)textureDetail.DetailValue;
            material.SetInt(textureDetail.DetailKey, integer);
            break;

        case TextureDetailType.Float:
            float number = (float)textureDetail.DetailValue;
            material.SetFloat(textureDetail.DetailKey, number);
            break;

        case TextureDetailType.Offset:
            Vector2 offset = (Vector2)textureDetail.DetailValue;
            material.SetTextureOffset(textureDetail.DetailKey, offset);
            break;

        default:
            throw new ApplicationException("Unexpected Texture Detail Type: " + textureDetail.DetailType);
        }
    }
示例#2
0
        public static List <武汉光谷.IndustryDetail> SetTheJsonObj2(/*string path*/)
        {
            Dictionary <int, Dictionary <int, Dictionary <int, int> > > Scores = new Dictionary <int, Dictionary <int, Dictionary <int, int> > >();

            Dictionary <int, Dictionary <int, int> > companyScores = new Dictionary <int, Dictionary <int, int> >();
            Dictionary <int, int> companyTexScores = new Dictionary <int, int>();



            //Dictionary<string, IndustryDetail> industrys = new Dictionary<string, IndustryDetail>();
            List <武汉光谷.IndustryDetail> industrys = new List <IndustryDetail>();
            IndustryDetail             industry  = new IndustryDetail();

            industry.Id           = 0;
            industry.Name         = "光电子信息产业";
            industry.Introduction =
                "光谷是我国光通信产业的发源地,我国最大的光纤光缆、光器件研发和生产基地,我国最大的光通信技术研发基地和激光产业发展引领区,中国最大的中小尺寸显示面板生产和研发基地。光纤光缆的生产规模居全球第一,代表国家参与世界竞争的品牌。";
            industrys.Add(industry);
            //industrys.Add(industry);
            //industrys.Add(industry.Name,industry);
            //Dictionary<string,CompanyDetail> companys =new Dictionary<string, CompanyDetail>();
            Scores.Add(industry.Id, companyScores);


            List <CompanyDetail> companys = new List <CompanyDetail>();

            industry.CompanyDetails = companys;
            CompanyDetail company = new CompanyDetail();

            company.Id                  = 0;
            company.Company             = "中国信息通信科技集团有限公司";
            company.CompanyIntroduction =
                "烽火科技集团是国际知名的信息通信网络产品与解决方案提供商。已跻身全球光通信最具竞争力企业十强,其中,光传输产品收入全球前五;宽带接入产品收入全球前四;光缆综合实力全球前四,连续八年位列中国光缆企业出口第一。";
            company.TextureDetails = new Dictionary <int, TextureDetail>();
            TextureDetail tex = new TextureDetail();

            tex.Id           = 0;
            tex.Path         = "0.jpg";
            tex.Introduction = "【高速光器件测试】中国信科集团(烽火科技)研发人员正在对光系统核心芯片进行检测";
            company.TextureDetails.Add(tex.Id, tex);

            companys.Add(company);
            //companys.Add(company);
            //companys.Add(company.Company,company);
            //companys.Add(company.Company+"2", company);
            companyScores.Add(company.Id, companyTexScores);
            companyTexScores.Add(tex.Id, 100);

            Write2Json2(Scores, @"D:\Desktop\ScoreDetail.json");
            return(industrys);
        }
示例#3
0
 public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj)
 {
     if (obj is Texture)
     {
         ObjectDetail detail = null;
         foreach (var v in CheckList)
         {
             if (v.checkObject == obj)
             {
                 detail = v;
             }
         }
         if (detail == null)
         {
             detail = new TextureDetail(obj, this);
         }
         detail.AddObjectReference(refObj, detailRefObj);
     }
 }
示例#4
0
    protected virtual Material ParseMaterial(MaterialDetail detail)
    {
        Material originalMaterial = Resources.Load <Material>(detail.MaterialPath);

        Material material = Instantiate(originalMaterial);

        if (material == null)
        {
            throw new ApplicationException("Could not find a material at path " + detail.MaterialPath);
        }

        material.name = detail.Name;

        for (int i = 0; i < detail.TextureDetails.Count; i++)
        {
            TextureDetail textureDetail = detail.TextureDetails[i];
            RealizeTextureOnMaterial(material, textureDetail);
        }

        return(material);
    }
示例#5
0
        public static void ParseRDPSetOtherMode(F3DEX2Command cmd,
                                                out PipelineMode pm, out CycleType cyc, out TexturePersp tp, out TextureDetail td, out TextureLOD tl,
                                                out TextureLUT tt, out TextureFilter tf, out TextureConvert tc, out CombineKey ck, out ColorDither cd,
                                                out AlphaDither ad, out AlphaCompare ac, out DepthSource zs, out RenderMode rm)
        {
            rm = new RenderMode(cmd.Words & (0xFFFFFFFF & ~((ulong)AlphaCompare.Mask | (ulong)DepthSource.Mask)));

            if (!rm.Known) // Handle TCL modes by checking again with alpha compare and dither included
            {
                rm = new RenderMode(cmd.Words & (0xFFFFFFFF & ~(ulong)DepthSource.Mask));
            }

            ulong wordH = cmd.Words >> 32;

            ad  = (AlphaDither)(wordH & (ulong)AlphaDither.Mask);
            cd  = (ColorDither)(wordH & (ulong)ColorDither.Mask);
            ck  = (CombineKey)(wordH & (ulong)CombineKey.Mask);
            pm  = (PipelineMode)(wordH & (ulong)PipelineMode.Mask);
            cyc = (CycleType)(wordH & (ulong)CycleType.Mask);
            tp  = (TexturePersp)(wordH & (ulong)TexturePersp.Mask);
            td  = (TextureDetail)(wordH & (ulong)TextureDetail.Mask);
            tl  = (TextureLOD)(wordH & (ulong)TextureLOD.Mask);
            tt  = (TextureLUT)(wordH & (ulong)TextureLUT.Mask);
            tf  = (TextureFilter)(wordH & (ulong)TextureFilter.Mask);
            tc  = (TextureConvert)(wordH & (ulong)TextureConvert.Mask);

            ac = (AlphaCompare)(cmd.Words & (ulong)AlphaCompare.Mask);
            zs = (DepthSource)(cmd.Words & (ulong)DepthSource.Mask);
        }