本文整理汇总了C#中ISceneObject类的典型用法代码示例。如果您正苦于以下问题:C# ISceneObject类的具体用法?C# ISceneObject怎么用?C# ISceneObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISceneObject类属于命名空间,在下文中一共展示了ISceneObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddObject
public override void AddObject(ISceneObject obj)
{
Assert.Fatal(obj is ISceneObject2D, "Only ISceneContainerObject objects can be added to this SceneGraph");
ISceneObject2D o = (ISceneObject2D)obj;
_container.CheckSceneObjectBins(o);
}
示例2: IncomingCreateObject
/// <summary>
/// Called when objects or attachments cross the border, or teleport, between regions.
/// </summary>
/// <param name="sog"></param>
/// <returns></returns>
public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
{
//m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
// ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
SceneObjectGroup newObject;
try
{
newObject = (SceneObjectGroup)sog;
}
catch (Exception e)
{
m_log.WarnFormat("[INTERREGION]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
return false;
}
// If the user is banned, we won't let any of their objects
// enter. Period.
//
if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID))
{
m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID);
return false;
}
if (newPosition != Vector3.Zero)
newObject.RootPart.GroupPosition = newPosition;
if (!AddSceneObject(newObject))
{
m_log.DebugFormat(
"[INTERREGION]: Problem adding scene object {0} in {1} ", newObject.UUID, RegionInfo.RegionName);
return false;
}
if (!newObject.IsAttachment)
{
// FIXME: It would be better to never add the scene object at all rather than add it and then delete
// it
if (!Permissions.CanObjectEntry(newObject.UUID, true, newObject.AbsolutePosition))
{
// Deny non attachments based on parcel settings
//
m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings");
DeleteSceneObject(newObject, false);
return false;
}
// For attachments, we need to wait until the agent is root
// before we restart the scripts, or else some functions won't work.
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts();
}
// Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject);
return true;
}
示例3: CreateObject
/**
* Object-related communications
*/
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
{
if (destination == null)
return false;
// Try local first
if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
{
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
return true;
}
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionID))
return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
return false;
}
示例4: EntityPropertyCollection
public EntityPropertyCollection(ISceneObject owner, DynamicPropertyCollectionType collectionType)
: base(owner, collectionType)
{
}
示例5: CreateObject
public bool CreateObject(GridRegion destination, ISceneObject sog)
{
// Try local first
if (m_localBackend != null && m_localBackend.CreateObject(destination, sog))
{
//MainConsole.Instance.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
return true;
}
// else do the remote thing
bool successful = false;
if (m_localBackend == null || !m_localBackend.IsLocalRegion(destination.RegionHandle))
{
string uri = MakeUri(destination, false) + sog.UUID + "/";
//MainConsole.Instance.Debug(" >>> DoCreateObjectCall <<< " + uri);
OSDMap args = new OSDMap(7);
args["sog"] = OSD.FromString(sog.ToXml2());
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
// Add the input general arguments
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
OSDMap result = WebUtils.PostToService(uri, args, true, false);
if (bool.TryParse(result["_RawResult"], out successful))
return successful;
}
return successful;
}
示例6: HavokNavMeshGlobalSettings
protected HavokNavMeshGlobalSettings(SerializationInfo info, StreamingContext context)
{
// Nav Mesh Generation Settings
m_parent = (ISceneObject)info.GetValue("Parent", typeof(ISceneObject));
m_name = info.GetString("Name");
m_characterHeight = info.GetSingle("CharacterHeight");
m_maxWalkableSlopeDeg = info.GetSingle("MaxWalkableSlope");
m_minRegionArea = info.GetSingle("MinRegionArea");
m_minDistanceToSeedPoints = info.GetSingle("MinDistanceToSeedPoints");
m_borderPreservationTolerance = info.GetSingle("BorderPreservationTolerance");
m_minCharacterWidth = info.GetSingle("MinCharacterWidth");
m_characterWidthUsage = (eCharacterWidthUsage)info.GetValue("CharacterWidthUsage", typeof(eCharacterWidthUsage));
if (m_characterWidthUsage > eCharacterWidthUsage.BlockEdges)
{
m_characterWidthUsage = eCharacterWidthUsage.BlockEdges;
}
m_restrictToGeometryFromSameZoneOnly = info.GetBoolean("RestrictToZoneGeometry");
if (SerializationHelper.HasElement(info, "TerrainLOD"))
m_terrainLOD = (eTerrainLOD)info.GetValue("TerrainLOD", typeof(eTerrainLOD));
// Nav Mesh Generation Settings (Advanced)
m_quantizationGridSize = info.GetSingle("QuantizationGridSize");
m_degenerateAreaThreshold = info.GetSingle("DegenerateAreaThreshold");
m_degenerateWidthThreshold = info.GetSingle("DegenerateWidthThreshold");
m_convexThreshold = info.GetSingle("ConvexThreshold");
m_maxNumEdgesPerFace = info.GetInt32("MaxNumEdgesPerFace");
m_weldInputVertices = info.GetBoolean("WeldInputVertices");
m_weldThreshold = info.GetSingle("WeldThreshold");
if (SerializationHelper.HasElement(info, "VertexSelectionMethod"))
m_vertexSelectionMethod = (eVertexSelectionMethod)info.GetValue("VertexSelectionMethod", typeof(eVertexSelectionMethod));
if (SerializationHelper.HasElement(info, "AreaFraction"))
m_areaFraction = info.GetSingle("AreaFraction");
if (SerializationHelper.HasElement(info, "VertexFraction"))
m_vertexFraction = info.GetSingle("VertexFraction");
// Nav Mesh Edge Matching Settings
m_edgeConnectionIterations = info.GetInt32("EdgeConnectionIterations");
m_edgeMatchingMetric = (eEdgeMatchingMetric)info.GetValue("EdgeMatchingMetric", typeof(eEdgeMatchingMetric));
m_maxStepHeight = info.GetSingle("MaxStepHeight");
m_maxSeparation = info.GetSingle("MaxSeparation");
m_maxOverhang = info.GetSingle("MaxOverhang");
m_planarAlignmentAngleDeg = info.GetSingle("PlanarAlignmentAngle");
m_verticalAlignmentAngleDeg = info.GetSingle("VerticalAlignmentAngle");
m_minEdgeOverlap = info.GetSingle("MinEdgeOverlap");
// Nav Mesh Simplification Settings
m_enableSimplification = info.GetBoolean("EnableSimplification");
m_maxBorderSimplifyArea = info.GetSingle("MaxBorderSimplifyArea");
m_maxConcaveBorderSimplifyArea = info.GetSingle("MaxConcaveBorderSimplifyArea");
m_useHeightPartitioning = info.GetBoolean("UseHeightPartitioning");
m_maxPartitionHeightError = info.GetSingle("MaxPartitionHeightError");
// Nav Mesh Simplification Settings (Advanced)
m_minCorridorWidth = info.GetSingle("MinCorridorWidth");
m_maxCorridorWidth = info.GetSingle("MaxCorridorWidth");
m_holeReplacementArea = info.GetSingle("HoleReplacementArea");
m_maxLoopShrinkFraction = info.GetSingle("MaxLoopShrinkFraction");
m_maxBorderHeightError = info.GetSingle("MaxBorderHeightError");
m_maxBorderDistanceError = info.GetSingle("MaxBorderDistanceError");
m_maxPartitionSize = info.GetInt32("MaxPartitionSize");
m_useConservativeHeightPartitioning = info.GetBoolean("UseConservativeHeightPartitioning");
m_hertelMehlhornHeightError = info.GetSingle("HertelMehlhornHeightError");
m_planarityThresholdDeg = info.GetSingle("PlanarityThreshold");
m_nonconvexityThreshold = info.GetSingle("NonconvexityThreshold");
m_boundaryEdgeFilterThreshold = info.GetSingle("BoundaryEdgeFilterThreshold");
m_maxSharedVertexHorizontalError = info.GetSingle("MaxSharedVertexHorizontalError");
m_maxSharedVertexVerticalError = info.GetSingle("MaxSharedVertexVerticalError");
m_maxBoundaryVertexHorizontalError = info.GetSingle("MaxBoundaryVertexHorizontalError");
m_maxBoundaryVertexVerticalError = info.GetSingle("MaxBoundaryVertexVerticalError");
m_mergeLongestEdgesFirst = info.GetBoolean("MergeLongestEdgesFirst");
// Nav Mesh Split Generation Settings
m_numTilesX = info.GetInt32("NumTilesX");
m_numTilesY = info.GetInt32("NumTilesY");
m_splitGenerationMethod = (eSplitGenerationMethod)info.GetValue("SplitGenerationMethod", typeof(eSplitGenerationMethod));
m_shelverType = (eShelverType)info.GetValue("ShelverType", typeof(eShelverType));
// Nav Mesh Link Settings
if (SerializationHelper.HasElement(info, "LinkEdgeMatchTolerance"))
m_linkEdgeMatchTolerance = info.GetSingle("LinkEdgeMatchTolerance");
if (SerializationHelper.HasElement(info, "LinkMaxStepHeight"))
m_linkMaxStepHeight = info.GetSingle("LinkMaxStepHeight");
if (SerializationHelper.HasElement(info, "LinkMaxSeparation"))
m_linkMaxSeparation = info.GetSingle("LinkMaxSeparation");
if (SerializationHelper.HasElement(info, "LinkMaxOverhang"))
m_linkMaxOverhang = info.GetSingle("LinkMaxOverhang");
if (SerializationHelper.HasElement(info, "LinkPlanarAlignmentAngle"))
m_linkPlanarAlignmentAngle = info.GetSingle("LinkPlanarAlignmentAngle");
if (SerializationHelper.HasElement(info, "LinkVerticalAlignmentAngle"))
m_linkVerticalAlignmentAngle = info.GetSingle("LinkVerticalAlignmentAngle");
if (SerializationHelper.HasElement(info, "LinkMinEdgeOverlap"))
//.........这里部分代码省略.........
示例7: HavokNavMeshGlobalSettingsDictionary
public HavokNavMeshGlobalSettingsDictionary(ISceneObject parent)
{
m_parent = parent;
m_settingsDictionary = new Dictionary<string, HavokNavMeshGlobalSettings>();
}
示例8: IncomingCreateObject
/// <summary>
/// Called when objects or attachments cross the border, or teleport, between regions.
/// </summary>
/// <param name="sog"></param>
/// <returns></returns>
public virtual bool IncomingCreateObject(UUID regionID, ISceneObject sog)
{
Scene scene = GetScene(regionID);
if (scene == null)
return false;
//m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject;
try
{
newObject = (SceneObjectGroup)sog;
}
catch (Exception e)
{
m_log.WarnFormat("[EntityTransferModule]: Problem casting object: {0}", e.Message);
return false;
}
if (!AddSceneObject(scene, newObject))
{
m_log.WarnFormat("[EntityTransferModule]: Problem adding scene object {0} in {1} ", sog.UUID, scene.RegionInfo.RegionName);
return false;
}
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, 1, UUID.Zero);
newObject.RootPart.ParentGroup.ResumeScripts();
if (newObject.RootPart.SitTargetAvatar.Count != 0)
{
lock (newObject.RootPart.SitTargetAvatar)
{
foreach (UUID avID in newObject.RootPart.SitTargetAvatar)
{
ScenePresence SP = scene.GetScenePresence(avID);
while (SP == null)
{
Thread.Sleep(20);
}
SP.AbsolutePosition = newObject.AbsolutePosition;
SP.CrossSittingAgent(SP.ControllingClient, newObject.RootPart.UUID);
}
}
}
return true;
}
示例9: CreateObject
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
{
string uri
= "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
//m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
ObjectCreateRequest.Method = "POST";
ObjectCreateRequest.ContentType = "application/json";
ObjectCreateRequest.Timeout = 10000;
OSDMap args = new OSDMap(2);
args["sog"] = OSD.FromString(sog.ToXml2());
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
string state = sog.GetStateSnapshot();
if (state.Length > 0)
args["state"] = OSD.FromString(state);
// Add the input general arguments
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
Encoding str = Util.UTF8;
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of CreateObject: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
os = ObjectCreateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
return false;
}
finally
{
if (os != null)
os.Close();
}
// Let's wait for the response
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
StreamReader sr = null;
try
{
WebResponse webResponse = ObjectCreateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
return false;
}
sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
return false;
}
finally
{
if (sr != null)
sr.Close();
}
return true;
}
示例10: IncomingCreateObject
/// <summary>
/// Called when objects or attachments cross the border, or teleport, between regions.
/// </summary>
/// <param name="sog"></param>
/// <returns></returns>
public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
{
//m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
// ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
SceneObjectGroup newObject;
try
{
newObject = (SceneObjectGroup)sog;
}
catch (Exception e)
{
m_log.WarnFormat("[SCENE]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
return false;
}
if (newPosition != Vector3.Zero)
newObject.RootPart.GroupPosition = newPosition;
if (!AddSceneObject(newObject))
{
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false;
}
// For attachments, we need to wait until the agent is root
// before we restart the scripts, or else some functions won't work.
if (!newObject.IsAttachment)
{
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts();
}
// Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject);
return true;
}
示例11: DoCreateObjectCall
public bool DoCreateObjectCall(GridRegion region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
{
ulong regionHandle = GetRegionHandle(region.RegionHandle);
string uri
= "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort
+ "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/";
//m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri);
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
ObjectCreateRequest.Method = "POST";
ObjectCreateRequest.ContentType = "application/json";
ObjectCreateRequest.Timeout = 10000;
OSDMap args = new OSDMap(2);
args["sog"] = OSD.FromString(sogXml2);
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
if (allowScriptCrossing)
{
string state = sog.GetStateSnapshot();
if (state.Length > 0)
args["state"] = OSD.FromString(state);
}
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
Encoding str = Util.UTF8;
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
os = ObjectCreateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
}
//catch (WebException ex)
catch
{
// m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message);
return false;
}
finally
{
if (os != null)
os.Close();
}
// Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
StreamReader sr = null;
try
{
WebResponse webResponse = ObjectCreateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post");
}
sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
//m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message);
// ignore, really
}
finally
{
if (sr != null)
sr.Close();
}
return true;
}
示例12: ReceiveSceneObjectChange
/// <summary>
/// Receives the scene object change.
/// </summary>
/// <param name="iSceneObject">I scene object.</param>
public void ReceiveSceneObjectChange(ISceneObject<string> iSceneObject) {
// Debug.Log ("Receive Change : " + iSceneObject.Key);
foreach (SceneObject sceneObject in _sceneObjects) {
if(sceneObject.Key == iSceneObject.Key) {
sceneObject.ReceiveData(iSceneObject);
}
}
}
示例13: CreateObject
// subclasses can override this
protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog)
{
return m_SimulationService.CreateObject(destination, newPosition, sog, false);
}
示例14: UpdateObject
public override void UpdateObject(ISceneObject obj)
{
Assert.Fatal(obj is ISceneObject2D, "Only ISceneContainerObject objects can be removed from this SceneGraph");
ISceneObject2D o = (ISceneObject2D)obj;
_container.CheckSceneObjectBins(o);
}
示例15: CreateObject
public static bool CreateObject(RegionInfo region, ISceneObject sog)
{
string reason = string.Empty;
bool success = region_comms.DoCreateObjectCall(region, sog, sog.ToXml2(), true);
Console.WriteLine("[GridSurfer]: posted object to " + region.ExternalHostName + ":" + region.HttpPort + " -- " + success);
return success;
}