本文整理汇总了C#中Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetQuaternionItem方法的典型用法代码示例。如果您正苦于以下问题:C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetQuaternionItem方法的具体用法?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetQuaternionItem怎么用?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetQuaternionItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
的用法示例。
在下文中一共展示了Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list.GetQuaternionItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPrimParams
protected void SetPrimParams(ISceneEntity part, LSL_List rules)
{
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 SceneObjectPart)
(part as SceneObjectPart).Name = name;
}
else if (code == (int)ScriptBaseClass.PRIM_DESC)
{
if (remain < 1)
return;
string desc = rules.Data[idx++].ToString();
if (part is SceneObjectPart)
(part as SceneObjectPart).Description = desc;
}
else if (code == (int)ScriptBaseClass.PRIM_ROT_LOCAL)
{
if (remain < 1)
return;
LSL_Rotation lr = rules.GetQuaternionItem(idx++);
if (part is SceneObjectPart)
SetRot((part as SceneObjectPart), Rot2Quaternion(lr));
}
else if (code == (int)ScriptBaseClass.PRIM_POSITION)
{
if (remain < 1)
return;
v = rules.GetVector3Item(idx++);
if (part is SceneObjectPart)
SetPos(part as SceneObjectPart, v);
else if (part is ScenePresence)
{
(part as ScenePresence).OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
(part as ScenePresence).SendTerseUpdateToAllClients();
}
}
else if (code == (int)ScriptBaseClass.PRIM_SIZE)
{
if (remain < 1)
return;
v = rules.GetVector3Item(idx++);
if (part is SceneObjectPart)
SetScale(part as SceneObjectPart, v);
}
else if (code == (int)ScriptBaseClass.PRIM_ROTATION)
{
if (remain < 1)
return;
if (part is SceneObjectPart) { }
else return;
LSL_Rotation q = rules.GetQuaternionItem(idx++);
// try to let this work as in SL...
if ((part as SceneObjectPart).ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(part as SceneObjectPart, Rot2Quaternion(q));
}
else
{
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectGroup group = (part as SceneObjectPart).ParentGroup;
if (group != null) // a bit paranoid, maybe
{
SceneObjectPart rootPart = group.RootPart;
if (rootPart != null) // again, better safe than sorry
{
SetRot((part as SceneObjectPart), rootPart.RotationOffset * Rot2Quaternion(q));
}
}
}
}
else if (code == (int)ScriptBaseClass.PRIM_TYPE)
{
//.........这里部分代码省略.........
示例2: 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)
{
ShoutError("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<int> times = new List<int>();
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);
}
int time = keyframes.GetLSLIntegerItem(i + (dataType == KeyframeAnimation.Data.Both ? 2 : 1));
times.Add(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);
}
示例3: SetPrimParams
protected void SetPrimParams(IEntity part, LSL_List rules)
{
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, 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));
}
//.........这里部分代码省略.........
示例4: ConvertLSLToWindlight
private 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;
}
//.........这里部分代码省略.........