当前位置: 首页>>代码示例>>C#>>正文


C# Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem方法代码示例

本文整理汇总了C#中Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem方法的典型用法代码示例。如果您正苦于以下问题:C# Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem方法的具体用法?C# Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem怎么用?C# Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Universe.ScriptEngine.VirtualScript.LSL_Types.list的用法示例。


在下文中一共展示了Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: llSetKeyframedMotion

 public void llSetKeyframedMotion(LSL_List keyframes, LSL_List options)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;
     if (!m_host.IsRoot)
     {
         Error("llSetKeyframedMotion", "Must be used in the root object!");
         return;
     }
     KeyframeAnimation.Data dataType = KeyframeAnimation.Data.Both;
     KeyframeAnimation.Modes currentMode = KeyframeAnimation.Modes.Forward;
     for (int i = 0; i < options.Length; i += 2)
     {
         LSL_Integer option = options.GetLSLIntegerItem(i);
         LSL_Integer value = options.GetLSLIntegerItem(i + 1);
         if (option == ScriptBaseClass.KFM_COMMAND)
         {
             m_host.ParentEntity.AddKeyframedMotion(null, (KeyframeAnimation.Commands)value.value);
             break; //Its supposed to be the only option in the list
         }
         if (option == ScriptBaseClass.KFM_MODE)
         {
             currentMode = (KeyframeAnimation.Modes)value.value;
         }
         else if (option == ScriptBaseClass.KFM_DATA)
         {
             dataType = (KeyframeAnimation.Data)value.value;
         }
     }
     List<Vector3> positions = new List<Vector3>();
     List<Quaternion> rotations = new List<Quaternion>();
     List<float> times = new List<float>();
     for (int i = 0; i < keyframes.Length; i += (dataType == KeyframeAnimation.Data.Both ? 3 : 2))
     {
         if (dataType == KeyframeAnimation.Data.Both ||
             dataType == KeyframeAnimation.Data.Translation)
         {
             LSL_Vector pos = keyframes.GetVector3Item(i);
             positions.Add(pos.ToVector3());
         }
         if (dataType == KeyframeAnimation.Data.Both ||
             dataType == KeyframeAnimation.Data.Rotation)
         {
             LSL_Rotation rot = keyframes.GetQuaternionItem(i + (dataType == KeyframeAnimation.Data.Both ? 1 : 0));
             Quaternion quat = rot.ToQuaternion();
             quat.Normalize();
             rotations.Add(quat);
         }
         LSL_Float time = keyframes.GetLSLFloatItem(i + (dataType == KeyframeAnimation.Data.Both ? 2 : 1));
         times.Add((float)time);
     }
     KeyframeAnimation animation = new KeyframeAnimation
                                       {
                                           CurrentMode = currentMode,
                                           PositionList = positions.ToArray(),
                                           RotationList = rotations.ToArray(),
                                           TimeList = times.ToArray(),
                                           CurrentAnimationPosition = 0,
                                           InitialPosition = m_host.AbsolutePosition,
                                           InitialRotation = m_host.GetRotationOffset()
                                       };
     m_host.ParentEntity.AddKeyframedMotion(animation, KeyframeAnimation.Commands.Play);
 }
开发者ID:VirtualReality,项目名称:Universe,代码行数:62,代码来源:LSL_Api.cs

示例2: ConvertLSLToWindlight

        void ConvertLSLToWindlight (ref WindlightDayCycle cycle, int preset, LSL_List list)
        {
            var skyDatas = cycle.Cycle.DataSettings.Values.ToList ();
            var skyData = skyDatas [preset];

            for (int i = 0; i < list.Data.Length; i += 2) {
                int key = list.GetLSLIntegerItem (i);
                switch (key) {
                case ScriptBaseClass.WL_AMBIENT: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.ambient = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_COLOR: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_color = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_POS_DENSITY1: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_pos_density1 = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_POS_DENSITY2: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_pos_density2 = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCALE: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_scale = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_X: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.cloud_scroll_rate.X = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_Y: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.cloud_scroll_rate.Y = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.enable_cloud_scroll.X = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: {
                        LSL_Integer integer = list.GetLSLIntegerItem (i + 1);
                        skyData.enable_cloud_scroll.Y = integer;
                        break;
                    }
                case ScriptBaseClass.WL_CLOUD_SHADOW: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.cloud_shadow = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_BLUE_DENSITY: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.blue_density = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_BLUR_HORIZON: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.blue_horizon = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_DENSITY_MULTIPLIER: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.density_multiplier = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_DISTANCE_MULTIPLIER: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.distance_multiplier = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_GAMMA: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.gamma = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_GLOW: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.glow = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_HAZE_DENSITY: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.haze_density = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_HAZE_HORIZON: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
                        skyData.haze_horizon = rot.ToVector4 ();
                        break;
                    }
                case ScriptBaseClass.WL_SKY_LIGHT_NORMALS: {
                        LSL_Rotation rot = list.GetQuaternionItem (i + 1);
//.........这里部分代码省略.........
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:101,代码来源:AA_API.cs

示例3: SetPrimParams

        public void SetPrimParams(IEntity part, LSL_List rules, bool allowOpenSimParams)
        {
            int idx = 0;

            while (idx < rules.Length)
            {
                int code = rules.GetLSLIntegerItem(idx++);

                int remain = rules.Length - idx;

                int face;
                LSL_Vector v;

                if (code == (int)ScriptBaseClass.PRIM_NAME)
                {
                    if (remain < 1)
                        return;

                    string name = rules.Data[idx++].ToString();
                    if (part is ISceneChildEntity)
                        (part as ISceneChildEntity).Name = name;
                }

                else if (code == (int)ScriptBaseClass.PRIM_DESC)
                {
                    if (remain < 1)
                        return;

                    string desc = rules.Data[idx++].ToString();
                    if (part is ISceneChildEntity)
                        (part as ISceneChildEntity).Description = desc;
                }

                else if (code == (int)ScriptBaseClass.PRIM_ROT_LOCAL)
                {
                    if (remain < 1)
                        return;
                    LSL_Rotation lr = rules.GetQuaternionItem(idx++);
                    if (part is ISceneChildEntity)
                        SetRot((part as ISceneChildEntity), Rot2Quaternion(lr));
                }

                else if (code == (int)ScriptBaseClass.PRIM_POSITION)
                {
                    if (remain < 1)
                        return;

                    v = rules.GetVector3Item(idx++);
                    if (part is ISceneChildEntity)
                        //SetPos(part as ISceneChildEntity, GetPartLocalPos(part as ISceneChildEntity) + v, true);
                        SetPos(part as ISceneChildEntity, v, true);
                    else if (part is IScenePresence)
                    {
                        (part as IScenePresence).OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
                        (part as IScenePresence).SendTerseUpdateToAllClients();
                    }
                }
                else if (code == (int)ScriptBaseClass.PRIM_POS_LOCAL)
                {
                    if (remain < 1)
                        return;

                    v = rules.GetVector3Item(idx++);
                    if (part is ISceneChildEntity)
                    {
                        if (((ISceneChildEntity)part).ParentID != 0)
                            ((ISceneChildEntity)part).OffsetPosition = new Vector3((float)v.x, (float)v.y,
                                                                                    (float)v.z);
                        else
                            part.AbsolutePosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
                    }
                    else if (part is IScenePresence)
                    {
                        (part as IScenePresence).OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
                        (part as IScenePresence).SendTerseUpdateToAllClients();
                    }
                }
                else if (code == (int)ScriptBaseClass.PRIM_SIZE)
                {
                    if (remain < 1)
                        return;

                    v = rules.GetVector3Item(idx++);
                    if (part is ISceneChildEntity)
                        SetScale(part as ISceneChildEntity, v);
                }
                else if (code == (int)ScriptBaseClass.PRIM_ROTATION)
                {
                    if (remain < 1)
                        return;

                    LSL_Rotation q = rules.GetQuaternionItem(idx++);
                    if (part is ISceneChildEntity)
                    {
                        // try to let this work as in SL...
                        if ((part as ISceneChildEntity).ParentID == 0)
                        {
                            // special case: If we are root, rotate complete SOG to new rotation
                            SetRot(part as ISceneChildEntity, Rot2Quaternion(q));
                        }
//.........这里部分代码省略.........
开发者ID:VirtualReality,项目名称:Universe,代码行数:101,代码来源:LSL_Api.cs


注:本文中的Universe.ScriptEngine.VirtualScript.LSL_Types.list.GetQuaternionItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。