Пример #1
0
            public static FlexibleData FromLLSD(LLSD llsd)
            {
                FlexibleData flex = new FlexibleData();

                if (llsd.Type == LLSDType.Map)
                {
                    LLSDMap map = (LLSDMap)llsd;

                    flex.Softness = map["simulate_lod"].AsInteger();
                    flex.Gravity  = (float)map["gravity"].AsReal();
                    flex.Drag     = (float)map["air_friction"].AsReal();
                    flex.Wind     = (float)map["wind_sensitivity"].AsReal();
                    flex.Tension  = (float)map["tension"].AsReal();
                    flex.Force    = LLVector3.FromLLSD(map["user_force"]);
                }

                return(flex);
            }
Пример #2
0
        public static LLVector3 ParseLLVector3(string key, LLSDMap reply)
        {
            LLSD llsd;

            if (reply.TryGetValue(key, out llsd))
            {
                if (llsd.Type == LLSDType.Array)
                {
                    LLVector3 vec = new LLVector3();
                    vec.FromLLSD(llsd);
                    return(vec);
                }
                else if (llsd.Type == LLSDType.String)
                {
                    LLSDArray array = (LLSDArray)LLSDParser.DeserializeNotation(llsd.AsString());
                    LLVector3 vec   = new LLVector3();
                    vec.FromLLSD(array);
                    return(vec);
                }
            }

            return(LLVector3.Zero);
        }
Пример #3
0
        public static LLVector3 ParseLLVector3(string key, LLSDMap reply)
        {
            LLSD llsd;
            if (reply.TryGetValue(key, out llsd))
            {
                if (llsd.Type == LLSDType.Array)
                {
                    LLVector3 vec = new LLVector3();
                    vec.FromLLSD(llsd);
                    return vec;
                }
                else if (llsd.Type == LLSDType.String)
                {
                    LLSDArray array = (LLSDArray)LLSDParser.DeserializeNotation(llsd.AsString());
                    LLVector3 vec = new LLVector3();
                    vec.FromLLSD(array);
                    return vec;
                }
            }

            return LLVector3.Zero;
        }
Пример #4
0
        public static Primitive FromLLSD(LLSD llsd)
        {
            Primitive prim = new Primitive();

            LLObject.ObjectData data = new ObjectData();

            LLSDMap map     = (LLSDMap)llsd;
            LLSDMap volume  = (LLSDMap)map["volume"];
            LLSDMap path    = (LLSDMap)volume["path"];
            LLSDMap profile = (LLSDMap)volume["profile"];

            #region Path/Profile

            data.PathBegin        = (float)path["begin"].AsReal();
            data.PathCurve        = (PathCurve)path["curve"].AsInteger();
            data.PathEnd          = (float)path["end"].AsReal();
            data.PathRadiusOffset = (float)path["radius_offset"].AsReal();
            data.PathRevolutions  = (float)path["revolutions"].AsReal();
            data.PathScaleX       = (float)path["scale_x"].AsReal();
            data.PathScaleY       = (float)path["scale_y"].AsReal();
            data.PathShearX       = (float)path["shear_x"].AsReal();
            data.PathShearY       = (float)path["shear_y"].AsReal();
            data.PathSkew         = (float)path["skew"].AsReal();
            data.PathTaperX       = (float)path["taper_x"].AsReal();
            data.PathTaperY       = (float)path["taper_y"].AsReal();
            data.PathTwist        = path["twist"].AsInteger();
            data.PathTwistBegin   = path["twist_begin"].AsInteger();

            data.ProfileBegin  = (float)profile["begin"].AsReal();
            data.ProfileCurve  = (ProfileCurve)profile["curve"].AsInteger();
            data.ProfileHole   = (HoleType)profile["hole"].AsInteger();
            data.ProfileEnd    = (float)profile["end"].AsReal();
            data.ProfileHollow = (float)profile["hollow"].AsReal();

            #endregion Path/Profile

            prim.Data = data;

            if (map["phantom"].AsBoolean())
            {
                prim.Flags |= ObjectFlags.Phantom;
            }

            if (map["physical"].AsBoolean())
            {
                prim.Flags |= ObjectFlags.Physics;
            }

            if (map["shadows"].AsBoolean())
            {
                prim.Flags |= ObjectFlags.CastShadows;
            }

            prim.ParentID = (uint)map["parentid"].AsInteger();
            prim.Position = LLVector3.FromLLSD(map["position"]);
            prim.Rotation = LLQuaternion.FromLLSD(map["rotation"]);
            prim.Scale    = LLVector3.FromLLSD(map["scale"]);
            prim.Flexible = FlexibleData.FromLLSD(map["flexible"]);
            prim.Light    = LightData.FromLLSD(map["light"]);
            prim.Sculpt   = SculptData.FromLLSD(map["sculpt"]);
            prim.Textures = TextureEntry.FromLLSD(map["textures"]);

            return(prim);
        }