本文整理汇总了C#中OpenSim.Framework.PrimitiveBaseShape类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveBaseShape类的具体用法?C# PrimitiveBaseShape怎么用?C# PrimitiveBaseShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveBaseShape类属于OpenSim.Framework命名空间,在下文中一共展示了PrimitiveBaseShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMesh
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{
// Remove the reference to the encoded JPEG2000 data so it can be GCed
primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
return null;
}
示例2: BSPrim
public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(parent_scene, localID, primName, "BSPrim")
{
// m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
_physicsActorType = (int)ActorTypes.Prim;
RawPosition = pos;
_size = size;
Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
RawOrientation = rotation;
_buoyancy = 0f;
RawVelocity = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
BaseShape = pbs;
_isPhysical = pisPhysical;
_isVolumeDetect = false;
_mass = CalculateMass();
DetailLog("{0},BSPrim.constructor,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(pbs));
// DetailLog("{0},BSPrim.constructor,call", LocalID);
// do the actual object creation at taint time
PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate()
{
// Make sure the object is being created with some sanity.
ExtremeSanityCheck(true /* inTaintTime */);
CreateGeomAndObject(true);
CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);
IsInitialized = true;
});
}
示例3: AddPrimShape
public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{
PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical);
if (ret != null) ret.LocalID = localID;
return ret;
}
示例4: CreateMesh
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, out List<List<Vector3>> hulls, out List<Vector3> boundHull)
{
// Remove the reference to the encoded JPEG2000 data so it can be GCed
primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
hulls = null;
boundHull = new List<Vector3>();
return null;
}
示例5: BasicPhysicsPrim
// private PrimitiveBaseShape _shape;
public BasicPhysicsPrim(
string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
{
Name = name;
LocalID = localId;
Position = position;
Size = size;
Orientation = orientation;
Shape = shape;
}
示例6: AddPrimShape
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
prim.IsPhysical = isPhysical;
_prims.Add(prim);
return prim;
}
示例7: FindBestShape
public static ShapeType FindBestShape(PrimitiveBaseShape baseShape, bool isDynamic)
{
if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.None)
{
return ShapeType.Null;
}
if (CanUseLowDetailShape(baseShape, isDynamic))
{
return ShapeType.PrimitiveBox;
}
if (CanUsePhysXPrimitive(baseShape))
{
if (baseShape.ProfileShape == ProfileShape.Square)
{
//best fix is a box
return ShapeType.PrimitiveBox;
}
else
{
//best fit is a sphere
return ShapeType.PrimitiveSphere;
}
}
if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.Prim)
{
if (isDynamic)
{
if (NeedsPlainConvexWorkaround(baseShape, isDynamic))
{
return ShapeType.SingleConvex;
}
else
{
//for dynamics, the best fit for a mesh shape is a collection of hulls
return ShapeType.DecomposedConvexHulls;
}
}
else
{
return ShapeType.TriMesh;
}
}
else if (baseShape.PreferredPhysicsShape == OpenMetaverse.PhysicsShapeType.ConvexHull)
{
return ShapeType.SingleConvex;
}
else
{
// throw new InvalidOperationException(String.Format("Preferred physics shape {0} is not meshable", baseShape.PreferredPhysicsShape));
return ShapeType.Null;
}
}
示例8: BSPrimLinkable
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
Linkset = BSLinkset.Factory(PhysScene, this);
PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
{
Linkset.Refresh(this);
});
}
示例9: BSPrimLinkable
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
// Default linkset implementation for this prim
LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation;
Linkset = BSLinkset.Factory(PhysScene, this);
Linkset.Refresh(this);
}
示例10: AddTree
public ISceneEntity AddTree (
UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
{
PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
treeShape.PathCurve = 16;
treeShape.PathEnd = 49900;
treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
treeShape.Scale = scale;
treeShape.State = (byte)treeType;
return m_scene.SceneGraph.AddNewPrim(uuid, groupID, position, rotation, treeShape);
}
示例11: CreateEntity
public SceneObjectGroup CreateEntity(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
{
m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
return null;
}
SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
// if grass or tree, make phantom
//rootPart.TrimPermissions();
rootPart.AddFlag(PrimFlags.Phantom);
if (rootPart.Shape.PCode != (byte)PCode.Grass)
AdaptTree(ref shape);
m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
return sceneObject;
}
示例12: SculptTextureCallback
public void SculptTextureCallback(UUID textureID, AssetBase texture)
{
if (m_shape.SculptEntry)
{
// commented out for sculpt map caching test - null could mean a cached sculpt map has been found
//if (texture != null)
{
if (texture != null)
m_shape.SculptData = texture.Data;
if (PhysActor != null)
{
// Tricks physics engine into thinking we've changed the part shape.
PrimitiveBaseShape m_newshape = m_shape.Copy();
PhysActor.Shape = m_newshape;
m_shape = m_newshape;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
}
}
示例13: SceneObjectPart
/// <summary>
/// Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjectGroup
/// </summary>
/// <param name="ownerID"></param>
/// <param name="shape"></param>
/// <param name="position"></param>
/// <param name="rotationOffset"></param>
/// <param name="offsetPosition"></param>
public SceneObjectPart(
UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Quaternion rotationOffset, Vector3 offsetPosition)
{
m_name = "Primitive";
Rezzed = DateTime.UtcNow;
_creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
_ownerID = ownerID;
_creatorID = _ownerID;
_lastOwnerID = UUID.Zero;
UUID = UUID.Random();
Shape = shape;
// Todo: Add More Object Parameter from above!
_ownershipCost = 0;
_objectSaleType = 0;
_salePrice = 0;
_category = 0;
_lastOwnerID = _creatorID;
// End Todo: ///
GroupPosition = groupPosition;
OffsetPosition = offsetPosition;
RotationOffset = rotationOffset;
Velocity = Vector3.Zero;
AngularVelocity = Vector3.Zero;
Acceleration = Vector3.Zero;
m_TextureAnimation = Utils.EmptyBytes;
m_particleSystem = Utils.EmptyBytes;
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
_flags = 0;
_flags |= PrimFlags.CreateSelected;
TrimPermissions();
//m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
m_inventory = new SceneObjectPartInventory(this);
}
示例14: T013_DatabasePersistency
public void T013_DatabasePersistency()
{
// Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
// The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
// The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
UUID creator,uuid = new UUID();
creator = UUID.Random();
uint iserial = (uint)random.Next();
TaskInventoryDictionary dic = new TaskInventoryDictionary();
uint objf = (uint) random.Next();
uuid = prim4;
uint localid = localID+1;
localID = localID + 1;
string name = "Adam West";
byte material = (byte) random.Next(127);
ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next();
int pin = random.Next();
Byte[] partsys = new byte[8];
Byte[] textani = new byte[8];
random.NextBytes(textani);
random.NextBytes(partsys);
DateTime expires = new DateTime(2008, 12, 20);
DateTime rezzed = new DateTime(2009, 07, 15);
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
string description = name;
Color color = Color.FromArgb(255, 165, 50, 100);
string text = "All Your Base Are Belong to Us";
string sitname = "SitName";
string touchname = "TouchName";
int linknum = random.Next();
byte clickaction = (byte) random.Next(127);
PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
pbshap = PrimitiveBaseShape.Default;
pbshap.PathBegin = ushort.MaxValue;
pbshap.PathEnd = ushort.MaxValue;
pbshap.ProfileBegin = ushort.MaxValue;
pbshap.ProfileEnd = ushort.MaxValue;
pbshap.ProfileHollow = ushort.MaxValue;
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
byte updatef = (byte) random.Next(127);
RegionInfo regionInfo = new RegionInfo();
regionInfo.RegionID = region3;
regionInfo.RegionLocX = 0;
regionInfo.RegionLocY = 0;
Scene scene = new Scene(regionInfo);
SceneObjectPart sop = new SceneObjectPart();
sop.RegionHandle = regionh;
sop.UUID = uuid;
sop.LocalId = localid;
sop.Shape = pbshap;
sop.GroupPosition = groupos;
sop.RotationOffset = rotoff;
sop.CreatorID = creator;
sop.InventorySerial = iserial;
sop.TaskInventory = dic;
sop.ObjectFlags = objf;
sop.Name = name;
sop.Material = material;
sop.ScriptAccessPin = pin;
sop.TextureAnimation = textani;
sop.ParticleSystem = partsys;
sop.Expires = expires;
sop.Rezzed = rezzed;
sop.OffsetPosition = offset;
sop.Velocity = velocity;
sop.AngularVelocity = angvelo;
sop.Acceleration = accel;
sop.Description = description;
sop.Color = color;
sop.Text = text;
sop.SitName = sitname;
sop.TouchName = touchname;
sop.LinkNum = linknum;
sop.ClickAction = clickaction;
sop.Scale = scale;
sop.UpdateFlag = updatef;
//Tests if local part accepted the parameters:
Assert.That(regionh,Is.EqualTo(sop.RegionHandle), "Assert.That(regionh,Is.EqualTo(sop.RegionHandle))");
Assert.That(localid,Is.EqualTo(sop.LocalId), "Assert.That(localid,Is.EqualTo(sop.LocalId))");
Assert.That(groupos,Is.EqualTo(sop.GroupPosition), "Assert.That(groupos,Is.EqualTo(sop.GroupPosition))");
Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))");
Assert.That(rotoff,Is.EqualTo(sop.RotationOffset), "Assert.That(rotoff,Is.EqualTo(sop.RotationOffset))");
Assert.That(uuid,Is.EqualTo(sop.UUID), "Assert.That(uuid,Is.EqualTo(sop.UUID))");
Assert.That(creator,Is.EqualTo(sop.CreatorID), "Assert.That(creator,Is.EqualTo(sop.CreatorID))");
// Modified in-class
// Assert.That(iserial,Is.EqualTo(sop.InventorySerial), "Assert.That(iserial,Is.EqualTo(sop.InventorySerial))");
Assert.That(dic,Is.EqualTo(sop.TaskInventory), "Assert.That(dic,Is.EqualTo(sop.TaskInventory))");
Assert.That(objf,Is.EqualTo(sop.ObjectFlags), "Assert.That(objf,Is.EqualTo(sop.ObjectFlags))");
Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))");
Assert.That(material,Is.EqualTo(sop.Material), "Assert.That(material,Is.EqualTo(sop.Material))");
Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin))");
//.........这里部分代码省略.........
示例15: SceneObjectPart
/// <summary>
/// Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjectGroup
/// </summary>
/// <param name="ownerID"></param>
/// <param name="shape"></param>
/// <param name="position"></param>
/// <param name="rotationOffset"></param>
/// <param name="offsetPosition"></param>
public SceneObjectPart(
UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Quaternion rotationOffset, Vector3 offsetPosition) : this()
{
m_name = "Primitive";
CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
LastOwnerID = CreatorID = OwnerID = ownerID;
UUID = UUID.Random();
Shape = shape;
OwnershipCost = 0;
ObjectSaleType = 0;
SalePrice = 0;
Category = 0;
GroupPosition = groupPosition;
OffsetPosition = offsetPosition;
RotationOffset = rotationOffset;
Velocity = Vector3.Zero;
AngularVelocity = Vector3.Zero;
Acceleration = Vector3.Zero;
Flags = 0;
CreateSelected = true;
TrimPermissions();
}