本文整理汇总了C#中PrimFlags类的典型用法代码示例。如果您正苦于以下问题:C# PrimFlags类的具体用法?C# PrimFlags怎么用?C# PrimFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimFlags类属于命名空间,在下文中一共展示了PrimFlags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BuildFullUpdate
public static ObjectUpdatePacket BuildFullUpdate(Primitive obj, ulong regionHandle, PrimFlags flags)
{
ObjectUpdatePacket update = new ObjectUpdatePacket();
update.RegionData.RegionHandle = regionHandle;
update.RegionData.TimeDilation = UInt16.MaxValue;
update.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
update.ObjectData[0] = BuildUpdateBlock(obj, regionHandle, flags);
return update;
}
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:10,代码来源:SimulationObject.cs
示例2: BuildUpdateBlock
public static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlock(Primitive obj, ulong regionHandle, PrimFlags flags)
{
byte[] objectData = BuildObjectData(obj.Position, obj.Rotation, obj.Velocity,
obj.Acceleration, obj.AngularVelocity);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
update.ClickAction = (byte)obj.ClickAction;
update.CRC = 0;
update.ExtraParams = obj.GetExtraParamsBytes();
update.Flags = (byte)flags;
update.FullID = obj.ID;
update.Gain = obj.SoundGain;
update.ID = obj.LocalID;
update.JointAxisOrAnchor = obj.JointAxisOrAnchor;
update.JointPivot = obj.JointPivot;
update.JointType = (byte)obj.Joint;
update.Material = (byte)obj.PrimData.Material;
update.MediaURL = Utils.StringToBytes(obj.MediaURL);
update.NameValue = Utils.StringToBytes(NameValue.NameValuesToString(obj.NameValues));
update.ObjectData = objectData;
update.OwnerID = (obj.Properties != null ? obj.Properties.OwnerID : UUID.Zero);
update.ParentID = obj.ParentID;
update.PathBegin = Primitive.PackBeginCut(obj.PrimData.PathBegin);
update.PathCurve = (byte)obj.PrimData.PathCurve;
update.PathEnd = Primitive.PackEndCut(obj.PrimData.PathEnd);
update.PathRadiusOffset = Primitive.PackPathTwist(obj.PrimData.PathRadiusOffset);
update.PathRevolutions = Primitive.PackPathRevolutions(obj.PrimData.PathRevolutions);
update.PathScaleX = Primitive.PackPathScale(obj.PrimData.PathScaleX);
update.PathScaleY = Primitive.PackPathScale(obj.PrimData.PathScaleY);
update.PathShearX = (byte)Primitive.PackPathShear(obj.PrimData.PathShearX);
update.PathShearY = (byte)Primitive.PackPathShear(obj.PrimData.PathShearY);
update.PathSkew = Primitive.PackPathTwist(obj.PrimData.PathSkew);
update.PathTaperX = Primitive.PackPathTaper(obj.PrimData.PathTaperX);
update.PathTaperY = Primitive.PackPathTaper(obj.PrimData.PathTaperY);
update.PathTwist = Primitive.PackPathTwist(obj.PrimData.PathTwist);
update.PathTwistBegin = Primitive.PackPathTwist(obj.PrimData.PathTwistBegin);
update.PCode = (byte)obj.PrimData.PCode;
update.ProfileBegin = Primitive.PackBeginCut(obj.PrimData.ProfileBegin);
update.ProfileCurve = (byte)obj.PrimData.ProfileCurve;
update.ProfileEnd = Primitive.PackEndCut(obj.PrimData.ProfileEnd);
update.ProfileHollow = Primitive.PackProfileHollow(obj.PrimData.ProfileHollow);
update.PSBlock = obj.ParticleSys.GetBytes();
update.TextColor = obj.TextColor.GetBytes(true);
update.TextureAnim = obj.TextureAnim.GetBytes();
update.TextureEntry = obj.Textures == null ? new byte[0] : obj.Textures.ToBytes();
update.Radius = obj.SoundRadius;
update.Scale = obj.Scale;
update.Sound = obj.Sound;
update.State = obj.PrimData.State;
update.Text = Utils.StringToBytes(obj.Text);
update.UpdateFlags = (uint)flags;
update.Data = obj.GenericData == null ? new byte[0] : obj.GenericData;
return update;
}
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:55,代码来源:SimulationObject.cs
示例3: RemFlag
public void RemFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((Flags & flag) != 0)
{
//m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString());
Flags &= ~flag;
}
//m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
//ScheduleFullUpdate();
}
开发者ID:justasabc,项目名称:opensim,代码行数:11,代码来源:SceneObjectPart.cs
示例4: SendFullUpdateToClient
/// <summary>
/// Sends a full update to the client
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="lPos"></param>
/// <param name="clientFlags"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
{
// Suppress full updates during attachment editing
//
if (ParentGroup.IsSelected && IsAttachment)
return;
if (ParentGroup.IsDeleted)
return;
clientFlags &= ~(uint) PrimFlags.CreateSelected;
if (remoteClient.AgentId == _ownerID)
{
if ((uint) (_flags & PrimFlags.CreateSelected) != 0)
{
clientFlags |= (uint) PrimFlags.CreateSelected;
_flags &= ~PrimFlags.CreateSelected;
}
}
//bool isattachment = IsAttachment;
//if (LocalId != ParentGroup.RootPart.LocalId)
//isattachment = ParentGroup.RootPart.IsAttachment;
byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape,
lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID,
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient)));
}
开发者ID:intari,项目名称:OpenSimMirror,代码行数:36,代码来源:SceneObjectPart.cs
示例5: aggregateScriptEvents
public void aggregateScriptEvents()
{
AggregateScriptEvents = 0;
// Aggregate script events
lock (m_scriptEvents)
{
foreach (scriptEvents s in m_scriptEvents.Values)
{
AggregateScriptEvents |= s;
}
}
uint objectflagupdate = 0;
if (
((AggregateScriptEvents & scriptEvents.touch) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_end) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_start) != 0)
)
{
objectflagupdate |= (uint) PrimFlags.Touch;
}
if ((AggregateScriptEvents & scriptEvents.money) != 0)
{
objectflagupdate |= (uint) PrimFlags.Money;
}
if (AllowedDrop)
{
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
}
// subscribe to physics updates.
if (PhysActor != null)
{
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
}
if (m_parentGroup == null)
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
ScheduleUpdate(PrimUpdateFlags.FullUpdate);
return;
}
LocalFlags=(PrimFlags)objectflagupdate;
if (m_parentGroup != null && m_parentGroup.RootPart == this)
{
m_parentGroup.aggregateScriptEvents();
}
else
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
ScheduleUpdate(PrimUpdateFlags.PrimFlags);
}
}
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:62,代码来源:SceneObjectPart.cs
示例6: aggregateScriptEvents
public void aggregateScriptEvents()
{
if (ParentGroup == null || ParentGroup.RootPart == null)
return;
AggregateScriptEvents = 0;
// Aggregate script events
lock (m_scriptEvents)
{
foreach (scriptEvents s in m_scriptEvents.Values)
{
AggregateScriptEvents |= s;
}
}
uint objectflagupdate = 0;
if (
((AggregateScriptEvents & scriptEvents.touch) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_end) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_start) != 0)
)
{
objectflagupdate |= (uint) PrimFlags.Touch;
}
if ((AggregateScriptEvents & scriptEvents.money) != 0)
{
objectflagupdate |= (uint) PrimFlags.Money;
}
if (AllowedDrop)
{
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
}
SubscribeForCollisionEvents();
//if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
//{
// ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
//}
//else
//{
// ParentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
//}
LocalFlags = (PrimFlags)objectflagupdate;
if (ParentGroup != null && ParentGroup.RootPart == this)
{
ParentGroup.aggregateScriptEvents();
}
else
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
ScheduleFullUpdate();
}
}
开发者ID:VirTecIO,项目名称:opensim,代码行数:61,代码来源:SceneObjectPart.cs
示例7: SendFullUpdateToClientImmediate
public void SendFullUpdateToClientImmediate(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
{
clientFlags &= ~(uint)PrimFlags.CreateSelected;
if ((uint)(_flags & PrimFlags.Scripted) != 0)
clientFlags |= (uint)PrimFlags.Scripted;
else
clientFlags &= ~(uint)PrimFlags.Scripted;
if (remoteClient.AgentId == _ownerID)
{
if ((uint)(_flags & PrimFlags.CreateSelected) != 0)
{
clientFlags |= (uint)PrimFlags.CreateSelected;
_flags &= ~PrimFlags.CreateSelected;
}
}
else
{ // Someone else's object
// If it's worn as a HUD, don't send this no matter what
if (ParentGroup.IsAttachedHUD)
return;
}
remoteClient.SendPrimitiveToClientImmediate(this, clientFlags, lPos);
}
开发者ID:kf6kjg,项目名称:halcyon,代码行数:25,代码来源:SceneObjectPart.cs
示例8: AddFlag
public void AddFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((ObjectFlags & (uint) flag) == 0)
{
_flags |= flag;
if (flag == PrimFlags.TemporaryOnRez)
ResetExpire();
if (ParentGroup != null) // null when called from the persistence backup
if((flag & PrimFlags.Scripted) != 0 && !ParentGroup.IsScripted)
ParentGroup.RecalcScriptedStatus();
}
}
开发者ID:kf6kjg,项目名称:halcyon,代码行数:14,代码来源:SceneObjectPart.cs
示例9: AddFlag
public void AddFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((ObjectFlags & (uint) flag) == 0)
{
_flags |= flag;
if (flag == PrimFlags.TemporaryOnRez)
ResetExpire();
if((flag & PrimFlags.Scripted) != 0 && !ParentGroup.IsScripted)
ParentGroup.CheckIfScriptedStatusChanged();
}
}
开发者ID:digitalmystic,项目名称:halcyon,代码行数:13,代码来源:SceneObjectPart.cs
示例10: AddFlag
public void AddFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((ObjectFlags & (uint) flag) == 0)
{
_flags |= flag;
if (flag == PrimFlags.TemporaryOnRez)
ResetExpire();
}
}
开发者ID:BogusCurry,项目名称:halcyon,代码行数:11,代码来源:SceneObjectPart.cs
示例11: BuildUpdateBlock
public static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlock(Primitive prim, PrimFlags flags, uint crc)
{
byte[] objectData = new byte[60];
prim.Position.ToBytes(objectData, 0);
prim.Velocity.ToBytes(objectData, 12);
prim.Acceleration.ToBytes(objectData, 24);
prim.Rotation.ToBytes(objectData, 36);
prim.AngularVelocity.ToBytes(objectData, 48);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
update.ClickAction = (byte)prim.ClickAction;
update.CRC = crc;
update.ExtraParams = prim.GetExtraParamsBytes();
update.Flags = (byte)flags;
update.FullID = prim.ID;
update.Gain = prim.SoundGain;
update.ID = prim.LocalID;
update.JointAxisOrAnchor = prim.JointAxisOrAnchor;
update.JointPivot = prim.JointPivot;
update.JointType = (byte)prim.Joint;
update.Material = (byte)prim.PrimData.Material;
update.MediaURL = Utils.StringToBytes(prim.MediaURL);
update.NameValue = Utils.StringToBytes(NameValue.NameValuesToString(prim.NameValues));
update.ObjectData = objectData;
update.OwnerID = (prim.Properties != null ? prim.Properties.OwnerID : UUID.Zero);
update.ParentID = prim.ParentID;
update.PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
update.PathCurve = (byte)prim.PrimData.PathCurve;
update.PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
update.PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset);
update.PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions);
update.PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
update.PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY);
update.PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX);
update.PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY);
update.PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew);
update.PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX);
update.PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY);
update.PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist);
update.PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin);
update.PCode = (byte)prim.PrimData.PCode;
update.ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin);
update.ProfileCurve = (byte)prim.PrimData.ProfileCurve;
update.ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd);
update.ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow);
update.PSBlock = prim.ParticleSys.GetBytes();
update.TextColor = prim.TextColor.GetBytes(true);
update.TextureAnim = prim.TextureAnim.GetBytes();
update.TextureEntry = prim.Textures == null ? Utils.EmptyBytes : prim.Textures.GetBytes();
update.Radius = prim.SoundRadius;
update.Scale = prim.Scale;
update.Sound = prim.Sound;
update.State = prim.PrimData.State;
update.Text = Utils.StringToBytes(prim.Text);
update.UpdateFlags = (uint)flags;
switch (prim.PrimData.PCode)
{
case PCode.Grass:
case PCode.Tree:
case PCode.NewTree:
update.Data = new byte[1];
update.Data[0] = (byte)prim.TreeSpecies;
break;
default:
if (prim.ScratchPad != null)
{
update.Data = new byte[prim.ScratchPad.Length];
Buffer.BlockCopy(prim.ScratchPad, 0, update.Data, 0, update.Data.Length);
}
else
{
update.Data = new byte[0];
}
break;
}
return update;
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:78,代码来源:SimulationObject.cs
示例12: AgentAdd
public bool AgentAdd(object sender, Agent agent, PrimFlags creatorFlags)
{
// Sanity check, since this should have already been done
agent.Avatar.Prim.ID = agent.Info.ID;
// Check if the agent already exists in the scene
lock (sceneAgents)
{
if (sceneAgents.ContainsKey(agent.ID))
sceneAgents.Remove(agent.ID);
}
// Update the current region handle
agent.Avatar.Prim.RegionHandle = regionHandle;
// Avatars always have physics
agent.Avatar.Prim.Flags |= PrimFlags.Physics;
// Default avatar values
agent.Avatar.Prim.Position = new Vector3(128f, 128f, 25f);
agent.Avatar.Prim.Rotation = Quaternion.Identity;
agent.Avatar.Prim.Scale = new Vector3(0.45f, 0.6f, 1.9f);
agent.Avatar.Prim.PrimData.Material = Material.Flesh;
agent.Avatar.Prim.PrimData.PCode = PCode.Avatar;
agent.Avatar.Prim.Textures = new Primitive.TextureEntry(new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"));
// Set the avatar name
NameValue[] name = new NameValue[2];
name[0] = new NameValue("FirstName", NameValue.ValueType.String, NameValue.ClassType.ReadWrite,
NameValue.SendtoType.SimViewer, agent.Info.FirstName);
name[1] = new NameValue("LastName", NameValue.ValueType.String, NameValue.ClassType.ReadWrite,
NameValue.SendtoType.SimViewer, agent.Info.LastName);
agent.Avatar.Prim.NameValues = name;
// Give testers a provisionary balance of 1000L
agent.Info.Balance = 1000;
// Some default avatar prim properties
agent.Avatar.Prim.Properties = new Primitive.ObjectProperties();
agent.Avatar.Prim.Properties.CreationDate = Utils.UnixTimeToDateTime(agent.Info.CreationTime);
agent.Avatar.Prim.Properties.Name = agent.FullName;
agent.Avatar.Prim.Properties.ObjectID = agent.ID;
if (agent.Avatar.Prim.LocalID == 0)
{
// Assign a unique LocalID to this agent
agent.Avatar.Prim.LocalID = (uint)Interlocked.Increment(ref currentLocalID);
}
if (OnAgentAdd != null)
OnAgentAdd(sender, agent, creatorFlags);
// Add the agent to the scene dictionary
lock (sceneAgents) sceneAgents[agent.ID] = agent;
Logger.Log("Added agent " + agent.FullName + " to the scene", Helpers.LogLevel.Info);
return true;
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:59,代码来源:SceneManager.cs
示例13: ObjectAddOrUpdate
public void ObjectAddOrUpdate(object sender, SimulationObject obj, UUID ownerID, int scriptStartParam, PrimFlags creatorFlags, UpdateFlags updateFlags)
{
if (OnObjectAddOrUpdate != null)
{
OnObjectAddOrUpdate(sender, obj, ownerID, scriptStartParam, creatorFlags, updateFlags);
}
#region Initialize new objects
// Check if the object already exists in the scene
if (!sceneObjects.ContainsKey(obj.Prim.ID))
{
// Enable some default flags that all objects will have
obj.Prim.Flags |= server.Permissions.GetDefaultObjectFlags();
// Object did not exist before, so there's no way it could contain inventory
obj.Prim.Flags |= PrimFlags.InventoryEmpty;
// Fun Fact: Prim.OwnerID is only used by the LL viewer to mute sounds
obj.Prim.OwnerID = ownerID;
// Other than storing tree species, I have no idea what this does
obj.Prim.ScratchPad = Utils.EmptyBytes;
// Assign a unique LocalID to this object if no LocalID is set
if (obj.Prim.LocalID == 0)
obj.Prim.LocalID = (uint)Interlocked.Increment(ref currentLocalID);
// Assign a random ID to this object if no ID is set
if (obj.Prim.ID == UUID.Zero)
obj.Prim.ID = UUID.Random();
// Set the RegionHandle if no RegionHandle is set
if (obj.Prim.RegionHandle == 0)
obj.Prim.RegionHandle = regionHandle;
// Make sure this object has properties
if (obj.Prim.Properties == null)
{
obj.Prim.Properties = new Primitive.ObjectProperties();
obj.Prim.Properties.CreationDate = DateTime.Now;
obj.Prim.Properties.CreatorID = ownerID;
obj.Prim.Properties.Name = "New Object";
obj.Prim.Properties.ObjectID = obj.Prim.ID;
obj.Prim.Properties.OwnerID = ownerID;
obj.Prim.Properties.Permissions = server.Permissions.GetDefaultPermissions();
obj.Prim.Properties.SalePrice = 10;
}
// Set the default scale
if (obj.Prim.Scale == Vector3.Zero)
obj.Prim.Scale = new Vector3(0.5f, 0.5f, 0.5f);
// Set the collision plane
if (obj.Prim.CollisionPlane == Vector4.Zero)
obj.Prim.CollisionPlane = Vector4.UnitW;
// Set default textures if none are set
if (obj.Prim.Textures == null)
obj.Prim.Textures = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")); // Plywood
// Add the object to the scene dictionary
sceneObjects.Add(obj.Prim.LocalID, obj.Prim.ID, obj);
}
#endregion Initialize new objects
// Reset the prim CRC
obj.CRC = 0;
#region UpdateFlags to packet type conversion
bool canUseCompressed = true;
bool canUseImproved = true;
if ((updateFlags & UpdateFlags.FullUpdate) == UpdateFlags.FullUpdate || creatorFlags != PrimFlags.None)
{
canUseCompressed = false;
canUseImproved = false;
}
else
{
if ((updateFlags & UpdateFlags.Velocity) != 0 ||
(updateFlags & UpdateFlags.Acceleration) != 0 ||
(updateFlags & UpdateFlags.CollisionPlane) != 0 ||
(updateFlags & UpdateFlags.Joint) != 0)
{
canUseCompressed = false;
}
if ((updateFlags & UpdateFlags.PrimFlags) != 0 ||
(updateFlags & UpdateFlags.ParentID) != 0 ||
(updateFlags & UpdateFlags.Scale) != 0 ||
(updateFlags & UpdateFlags.PrimData) != 0 ||
(updateFlags & UpdateFlags.Text) != 0 ||
(updateFlags & UpdateFlags.NameValue) != 0 ||
(updateFlags & UpdateFlags.ExtraData) != 0 ||
(updateFlags & UpdateFlags.TextureAnim) != 0 ||
(updateFlags & UpdateFlags.Sound) != 0 ||
(updateFlags & UpdateFlags.Particles) != 0 ||
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:SceneManager.cs
示例14: SendObjectPacket
void SendObjectPacket(SimulationObject obj, bool canUseCompressed, bool canUseImproved, PrimFlags creatorFlags, UpdateFlags updateFlags)
{
if (!canUseImproved && !canUseCompressed)
{
#region ObjectUpdate
Logger.DebugLog("Sending ObjectUpdate");
if (sceneAgents.ContainsKey(obj.Prim.OwnerID))
{
// Send an update out to the creator
ObjectUpdatePacket updateToOwner = new ObjectUpdatePacket();
updateToOwner.RegionData.RegionHandle = regionHandle;
updateToOwner.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue);
updateToOwner.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
updateToOwner.ObjectData[0] = SimulationObject.BuildUpdateBlock(obj.Prim,
obj.Prim.Flags | creatorFlags | PrimFlags.ObjectYouOwner, obj.CRC);
udp.SendPacket(obj.Prim.OwnerID, updateToOwner, PacketCategory.State);
}
// Send an update out to everyone else
ObjectUpdatePacket updateToOthers = new ObjectUpdatePacket();
updateToOthers.RegionData.RegionHandle = regionHandle;
updateToOthers.RegionData.TimeDilation = UInt16.MaxValue;
updateToOthers.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
updateToOthers.ObjectData[0] = SimulationObject.BuildUpdateBlock(obj.Prim,
obj.Prim.Flags, obj.CRC);
ForEachAgent(
delegate(Agent recipient)
{
if (recipient.ID != obj.Prim.OwnerID)
udp.SendPacket(recipient.ID, updateToOthers, PacketCategory.State);
}
);
#endregion ObjectUpdate
}
else if (!canUseImproved)
{
#region ObjectUpdateCompressed
#region Size calculation and field serialization
CompressedFlags flags = 0;
int size = 84;
byte[] textBytes = null;
byte[] mediaURLBytes = null;
byte[] particleBytes = null;
byte[] extraParamBytes = null;
byte[] nameValueBytes = null;
byte[] textureBytes = null;
byte[] textureAnimBytes = null;
if ((updateFlags & UpdateFlags.AngularVelocity) != 0)
{
flags |= CompressedFlags.HasAngularVelocity;
size += 12;
}
if ((updateFlags & UpdateFlags.ParentID) != 0)
{
flags |= CompressedFlags.HasParent;
size += 4;
}
if ((updateFlags & UpdateFlags.ScratchPad) != 0)
{
switch (obj.Prim.PrimData.PCode)
{
case PCode.Grass:
case PCode.Tree:
case PCode.NewTree:
flags |= CompressedFlags.Tree;
size += 2; // Size byte plus one byte
break;
default:
flags |= CompressedFlags.ScratchPad;
size += 1 + obj.Prim.ScratchPad.Length; // Size byte plus bytes
break;
}
}
if ((updateFlags & UpdateFlags.Text) != 0)
{
flags |= CompressedFlags.HasText;
textBytes = Utils.StringToBytes(obj.Prim.Text);
size += textBytes.Length; // Null-terminated, no size byte
size += 4; // Text color
}
if ((updateFlags & UpdateFlags.MediaURL) != 0)
{
flags |= CompressedFlags.MediaURL;
mediaURLBytes = Utils.StringToBytes(obj.Prim.MediaURL);
size += mediaURLBytes.Length; // Null-terminated, no size byte
}
if ((updateFlags & UpdateFlags.Particles) != 0)
{
flags |= CompressedFlags.HasParticles;
particleBytes = obj.Prim.ParticleSys.GetBytes();
size += particleBytes.Length; // Should be exactly 86 bytes
}
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:SceneManager.cs
示例15: RemFlag
public bool RemFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((Flags & flag) != 0)
{
//MainConsole.Instance.Debug("Removing flag: " + ((PrimFlags)flag).ToString());
Flags &= ~flag;
object[] o = new object[2];
o[0] = this;
o[1] = flag;
m_parentGroup.Scene.AuroraEventManager.FireGenericEventHandler("ObjectRemovedFlag", o);
return true;
}
return false;
//MainConsole.Instance.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
//ScheduleFullUpdate();
}
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:17,代码来源:SceneObjectPart.cs
示例16: SetSOPFlags
private void SetSOPFlags(SceneObjectPart part, PrimFlags flags)
{
//Do not set part.Flags yet,
//part.Flags = flags;
// DebugLog.WarnFormat("[SYNC INFO PRIM] SetSOPFlags");
bool UsePhysics = (flags & PrimFlags.Physics) != 0;
bool IsTemporary = (flags & PrimFlags.TemporaryOnRez) != 0;
//bool IsVolumeDetect = part.VolumeDetectActive;
bool IsPhantom = (flags & PrimFlags.Phantom) != 0;
if (part.ParentGroup != null)
{
//part.ParentGroup.UpdatePrimFlagsBySync(part.LocalId, UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
part.ParentGroup.UpdatePrimFlags(part.LocalId, UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
//part.UpdatePrimFlagsBySync(UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
}
part.Flags = flags;
//DSL part.aggregateScriptEventSubscriptions();
part.ScheduleFullUpdate();
}
开发者ID:QuillLittlefeather,项目名称:DSG,代码行数:21,代码来源:SyncInfoPrim.cs
示例17: aggregateScriptEvents
public void aggregateScriptEvents()
{
AggregateScriptEvents = 0;
// Aggregate script events
lock (m_scriptEvents)
{
foreach (scriptEvents s in m_scriptEvents.Values)
{
AggregateScriptEvents |= s;
}
}
uint objectflagupdate = 0;
if (
((AggregateScriptEvents & scriptEvents.touch) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_end) != 0) ||
((AggregateScriptEvents & scriptEvents.touch_start) != 0)
)
{
objectflagupdate |= (uint) PrimFlags.Touch;
}
if ((AggregateScriptEvents & scriptEvents.money) != 0)
{
objectflagupdate |= (uint) PrimFlags.Money;
}
if (AllowedDrop)
{
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
}
// subscribe to physics updates.
//We subscribe by default now... so 'shouldn't' need this
if ((((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0)
) && PhysActor != null)
{
if (!m_hasSubscribedToCollisionEvent)
{
m_hasSubscribedToCollisionEvent = true;
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
}
}
else if (PhysActor != null)
{
if (m_hasSubscribedToCollisionEvent)
{
m_hasSubscribedToCollisionEvent = false;
PhysActor.OnCollisionUpdate -= PhysicsCollision;
}
}
if (m_parentGroup == null)
{
// MainConsole.Instance.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
ScheduleUpdate(PrimUpdateFlags.FullUpdate);
return;
}
LocalFlags = (PrimFlags) objectflagupdate;
if (m_parentGroup != null && m_parentGroup.RootPart == this)
{
m_parentGroup.aggregateScriptEvents();
}
else
{
// MainConsole.Instance.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
ScheduleUpdate(PrimUpdateFlags.PrimFlags);
}
}
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:81,代码来源:SceneObjectPart.cs
示例18: SetPrimFlags
public void SetPrimFlags(Primitive UnPhantom, PrimFlags fs)
{
client.Objects.SetFlags(GetSimulator(UnPhantom),UnPhantom.LocalID, ((fs & PrimFlags.Physics) != 0), //
((fs & PrimFlags.Temporary) != 0),
((fs & PrimFlags.Phantom) != 0),
((fs & PrimFlags.CastShadows) != 0));
}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:WorldObjects.cs
示例19: RemFlag
public void RemFlag(PrimFlags flag)
{
// PrimFlags prevflag = Flags;
if ((ObjectFlags & (uint) flag) != 0)
{
//m_log.Debug("Removing flag: " + ((PrimFlags)flag).ToString());
_flags &= ~flag;
if ((flag & PrimFlags.Scripted) != 0)
if(ParentGroup != null)
ParentGroup.RecalcScriptedStatus();
}
//m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString());
//ScheduleFullUpdate();
}
开发者ID:kf6kjg,项目名称:halcyon,代码行数:14,代码来源:SceneObjectPart.cs
示例20: HasFlag
public static bool HasFlag(this PrimFlags primFlags, PrimFlags flag)
{
return (primFlags & flag) == flag;
}
开发者ID:thoys,项目名称:simian,代码行数:4,代码来源:LLPrimitive.cs
注:本文中的PrimFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论