コード例 #1
0
ファイル: ParserLight.cs プロジェクト: guozanhua/easydown
    public void Fill(Component com, MyJson.IJsonNode json)
    {
        Light t = com as Light;
        t.type = (LightType)json.GetDictItem("type").AsInt();
        if (t.type == LightType.Spot)
        {
            t.range = (float)json.GetDictItem("range").AsDouble();
            t.spotAngle = (float)json.GetDictItem("spotangle").AsDouble();




        }
        if (t.type == LightType.Point)
        {
            t.range = (float)json.GetDictItem("range").AsDouble();

        }

        if (t.type != LightType.Area)
        {
            t.color = ComponentTypeConvert.StringToColor(json.GetDictItem("color").AsString());
            t.intensity = (float)json.GetDictItem("intensity").AsDouble();

            //t.cookie
            //t.cookiesize
            t.shadows = (LightShadows)json.GetDictItem("shadowtype").AsInt();

            if (t.shadows != LightShadows.None)
            {
                t.shadowStrength = (float)json.GetDictItem("shadowStrength").AsDouble();
                t.shadowBias = (float)json.GetDictItem("shadowBias").AsDouble();
                //shadow质量找不到怎么操作
            }

            if (t.shadows == LightShadows.Soft)
            {
                t.shadowSoftness = (float)json.GetDictItem("shadowSoftness").AsDouble();
                t.shadowSoftnessFade = (float)json.GetDictItem("shadowSoftnessFade").AsDouble();

            }
            //Drawhalo not found
            //flare
            t.renderMode = (LightRenderMode)json.GetDictItem("renderMode").AsInt();

            json.SetDictValue("renderMode", (int)t.renderMode);
            t.cullingMask = json.GetDictItem("cullingMask").AsInt();

            //lightmapping not found


        }
    }