本文整理汇总了C#中ISceneEntity类的典型用法代码示例。如果您正苦于以下问题:C# ISceneEntity类的具体用法?C# ISceneEntity怎么用?C# ISceneEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISceneEntity类属于命名空间,在下文中一共展示了ISceneEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
public void Remove(ISceneEntity sceneEntity)
{
if (!_items.Contains(sceneEntity))
throw new ItemDoesNotExistException(Resources.Message_Scene_entity_does_not_exists_in_the_stage);
_items.Remove(sceneEntity);
OnSceneEntityRemoved(sceneEntity);
}
示例2: AddOrUpdate
/// <summary>
///
/// </summary>
/// <param name="entity"></param>
/// <returns>True if the entity was added to the scene graph, false if
/// it was updated</returns>
public bool AddOrUpdate(ISceneEntity entity)
{
bool added;
m_syncRoot.EnterWriteLock();
try
{
if (!m_entityLocalIDs.ContainsKey(entity.LocalID))
{
// Sanity check
if (m_entityUUIDs.ContainsKey(entity.ID))
throw new ArgumentException("Cannot add entity with LocalID " + entity.LocalID + ", ID " + entity.ID + " already exists in the scene");
// Insert this entity into the scene graph, uint map, and UUID map
m_entityLocalIDs.Add(entity.LocalID, entity);
m_entityUUIDs.Add(entity.ID, entity);
added = true;
}
else
{
added = false;
}
// If this is a scene presence, add/update it in the presence collection
if (entity is IScenePresence)
m_presences.Add(entity.ID, (IScenePresence)entity);
}
finally { m_syncRoot.ExitWriteLock(); }
return added;
}
示例3: GetPriorityByDistance
private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
{
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
if (presence != null)
{
// If this is an update for our own avatar give it the highest priority
if (presence == entity)
return 0.0;
// Use the camera position for local agents and avatar position for remote agents
Vector3 presencePos = (presence.IsChildAgent) ?
presence.AbsolutePosition :
presence.CameraPosition;
// Use group position for child prims
Vector3 entityPos;
if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
else
entityPos = entity.AbsolutePosition;
return Vector3.DistanceSquared(presencePos, entityPos);
}
return double.NaN;
}
示例4: Add
public void Add(ISceneEntity sceneEntity)
{
if (_items.Contains(sceneEntity))
throw new ItemAlreadyExistsException(Resources.Message_Scene_entity_already_exists_in_the_stage);
_items.Add(sceneEntity);
OnSceneEntityAdded(sceneEntity);
}
示例5: PreloadSound
public void PreloadSound(ISceneEntity source, UUID soundID, float radius)
{
m_scene.CreateInterestListEvent(new InterestListEvent(
UUID.Combine(soundID, PRELOAD_EVENT_ID),
PRELOAD_SOUND,
source.ScenePosition,
new Vector3(radius),
new object[] { source, soundID })
);
}
示例6: GetColor
/// <summary>
/// Gets the color representation of the given entity.
/// </summary>
/// <returns>The color.</returns>
/// <param name="entity">Entity.</param>
public static Color GetColor(ISceneEntity entity)
{
// Build Color
if (entity.InBuild) {
if (entity.IsEnabled)
return SceneOpenButton_InBuild_Enabled;
else
return SceneOpenButton_InBuild_Disabled;
}
return SceneOpenButton_Regular;
}
示例7: GetUpdatePriority
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
{
double priority = 0;
if (entity == null)
return 100000;
switch (m_scene.UpdatePrioritizationScheme)
{
case UpdatePrioritizationSchemes.Time:
priority = GetPriorityByTime();
break;
case UpdatePrioritizationSchemes.Distance:
priority = GetPriorityByDistance(client, entity);
break;
case UpdatePrioritizationSchemes.SimpleAngularDistance:
priority = GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
break;
case UpdatePrioritizationSchemes.FrontBack:
priority = GetPriorityByFrontBack(client, entity);
break;
case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
priority = GetPriorityByBestAvatarResponsiveness(client, entity);
break;
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
}
// Adjust priority so that root prims are sent to the viewer first. This is especially important for
// attachments acting as huds, since current viewers fail to display hud child prims if their updates
// arrive before the root one.
if (entity is SceneObjectPart)
{
SceneObjectPart sop = ((SceneObjectPart)entity);
if (sop.IsRoot)
{
if (priority >= double.MinValue + m_childPrimAdjustmentFactor)
priority -= m_childPrimAdjustmentFactor;
}
else
{
if (priority <= double.MaxValue - m_childPrimAdjustmentFactor)
priority += m_childPrimAdjustmentFactor;
}
}
return priority;
}
示例8: GetUpdatePriority
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
{
switch (m_scene.UpdatePrioritizationScheme)
{
case UpdatePrioritizationSchemes.Time:
return GetPriorityByTime();
case UpdatePrioritizationSchemes.Distance:
return GetPriorityByDistance(client, entity);
case UpdatePrioritizationSchemes.SimpleAngularDistance:
return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
case UpdatePrioritizationSchemes.FrontBack:
return GetPriorityByFrontBack(client, entity);
case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
return GetPriorityByBestAvatarResponsiveness(client, entity);
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
}
}
示例9: GetUpdatePriority
/// <summary>
/// Returns the priority queue into which the update should be placed. Updates within a
/// queue will be processed in arrival order. There are currently 12 priority queues
/// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained
/// for avatar updates. The fair queuing discipline for processing the priority queues
/// assumes that the number of entities in each priority queues increases exponentially.
/// So for example... if queue 1 contains all updates within 10m of the avatar or camera
/// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number
/// of updates.
/// </summary>
public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity)
{
// If entity is null we have a serious problem
if (entity == null)
{
m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity");
throw new InvalidOperationException("Prioritization entity not defined");
}
// If this is an update for our own avatar give it the highest priority
if (client.AgentId == entity.UUID)
return 0;
uint priority;
// HACK
return GetPriorityByBestAvatarResponsiveness(client, entity);
switch (m_scene.UpdatePrioritizationScheme)
{
case UpdatePrioritizationSchemes.Time:
priority = GetPriorityByTime(client, entity);
break;
case UpdatePrioritizationSchemes.Distance:
priority = GetPriorityByDistance(client, entity);
break;
case UpdatePrioritizationSchemes.SimpleAngularDistance:
priority = GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
break;
case UpdatePrioritizationSchemes.FrontBack:
priority = GetPriorityByFrontBack(client, entity);
break;
case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
priority = GetPriorityByBestAvatarResponsiveness(client, entity);
break;
default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
}
return priority;
}
示例10: LinkChild
/// <summary>
/// Add this child to the group and set the parent ID's,
/// but do NOT set the link number,
/// the caller wants to deal with it if they call this
/// </summary>
/// <param name="child"></param>
/// <returns></returns>
public override bool LinkChild(ISceneEntity child)
{
lock (m_partsLock)
{
if (child is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)child;
//Root part is first
if (m_partsList.Count == 0)
{
m_rootPart = part;
}
//Set the parent prim
part.SetParent(this);
part.SetParentLocalId(m_rootPart.LocalId);
if (!m_parts.ContainsKey(child.UUID))
{
m_parts.Add(child.UUID, part);
m_partsList.Add(part);
}
m_partsList.Sort(m_scene.SceneGraph.linkSetSorter);
return true;
}
}
return false;
}
示例11: GetChildPrim
/// <summary>
/// Get a child prim of this group by UUID
/// </summary>
/// <param name="UUID"></param>
/// <param name="entity"></param>
/// <returns></returns>
public override bool GetChildPrim(UUID UUID, out ISceneEntity entity)
{
entity = GetChildPart(UUID);
return entity != null;
}
示例12: SendAgentTerseUpdate
// this is diferente from SendTerseUpdateToClient
// this sends bypassing entities updates
public void SendAgentTerseUpdate(ISceneEntity p)
{
ControllingClient.SendAgentTerseUpdate(p);
}
示例13: AddPrimBackupTaint
/// <summary>
/// Add a backup taint to the prim
/// </summary>
/// <param name="sceneObjectGroup"></param>
public void AddPrimBackupTaint (ISceneEntity sceneObjectGroup)
{
lock (m_backupTaintedPrims)
{
if (sceneObjectGroup is SceneObjectGroup)
{
if (!m_backupTaintedPrims.ContainsKey(sceneObjectGroup.UUID))
m_backupTaintedPrims.Add(sceneObjectGroup.UUID, (SceneObjectGroup)sceneObjectGroup);
}
}
}
示例14: TriggerSignificantObjectMovement
public void TriggerSignificantObjectMovement (ISceneEntity group)
{
SignificantObjectMovement handlerSignificantObjectMovement = OnSignificantObjectMovement;
if (handlerSignificantObjectMovement != null)
{
foreach (SignificantObjectMovement d in handlerSignificantObjectMovement.GetInvocationList ())
{
try
{
d (group);
}
catch (Exception e)
{
m_log.ErrorFormat (
"[EVENT MANAGER]: Delegate for TriggerSignificantObjectMovement failed - continuing. {0} {1}",
e.ToString (), e.StackTrace);
}
}
}
}
示例15: ReturnObjects
/// <summary>
/// Return the given objects to the agent given
/// </summary>
/// <param name="returnobjects">The objects to return</param>
/// <param name="AgentId">The agent UUID that will get the inventory items for these objects</param>
/// <returns></returns>
public bool ReturnObjects(ISceneEntity[] returnobjects,
UUID AgentId)
{
if (returnobjects.Length == 0)
return true;
//AddReturns(returnobjects[0].OwnerID, returnobjects[0].Name, returnobjects.Length, returnobjects[0].AbsolutePosition, "parcel owner return");
#if (!ISWIN)
List<uint> IDs = new List<uint>();
foreach (ISceneEntity grp in returnobjects)
IDs.Add(grp.LocalId);
#else
List<uint> IDs = returnobjects.Select(grp => grp.LocalId).ToList();
#endif
IClientAPI client;
m_scene.ClientManager.TryGetValue(AgentId, out client);
//Its ok if the client is null, its taken care of
DeRezObjects(client, IDs, returnobjects[0].RootChild.GroupID, DeRezAction.Return, UUID.Zero);
return true;
}