本文整理汇总了C#中PrimitiveBaseShape类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveBaseShape类的具体用法?C# PrimitiveBaseShape怎么用?C# PrimitiveBaseShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveBaseShape类属于命名空间,在下文中一共展示了PrimitiveBaseShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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")
{
// MainConsole.Instance.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
_position = pos;
_size = size;
Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
_orientation = rotation;
_buoyancy = 0f;
RawVelocity = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
BaseShape = pbs;
_isPhysical = pisPhysical;
_isVolumeDetect = false;
// We keep a handle to the vehicle actor so we can set vehicle parameters later.
VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName);
PhysicalActors.Add(VehicleActorName, VehicleActor);
_mass = CalculateMass();
// DetailLog("{0},BSPrim.constructor,call", LocalID);
// do the actual object creation at taint time
PhysicsScene.TaintedObject("BSPrim.create", delegate()
{
// Make sure the object is being created with some sanity.
ExtremeSanityCheck(true /* inTaintTime */);
CreateGeomAndObject(true);
CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody);
});
}
示例2: CreateMesh
public IMesh CreateMesh (string primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
{
// Remove the reference to the encoded JPEG2000 data so it can be GCed
primShape.SculptData = Utils.EmptyBytes;
return null;
}
示例3: BSPrimLinkable
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, int material, float friction,
float restitution, float gravityMultiplier, float density)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
// Default linkset implementation for this prim
LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation;
Linkset = BSLinkset.Factory(PhysicsScene, this);
if (Linkset != null)
Linkset.Refresh(this);
}
示例4: BSPrimLinkable
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, int material, float friction,
float restitution, float gravityMultiplier, float density)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
Linkset = BSLinkset.Factory(PhysicsScene, this);
PhysicsScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
{
base.SetMaterial(material);
base.Friction = friction;
base.Restitution = restitution;
base.GravityMultiplier = gravityMultiplier;
base.Density = density;
Linkset.Refresh(this);
});
}
示例5: AddTree
public ISceneEntity AddTree(
UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
{
PrimitiveBaseShape treeShape = new PrimitiveBaseShape
{
PathCurve = 16,
PathEnd = 49900,
PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree,
Scale = scale,
State = (byte) treeType
};
return m_scene.SceneGraph.AddNewPrim(uuid, groupID, position, rotation, treeShape);
}
示例6: CreateEntity
public ISceneEntity CreateEntity(
ISceneEntity baseEntity, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
if (Array.IndexOf(creationCapabilities, (PCode) shape.PCode) < 0)
{
MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
return null;
}
ISceneChildEntity rootPart = baseEntity.GetChildPart(baseEntity.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.SceneGraph.AddPrimToScene(baseEntity);
baseEntity.SetGroup(groupID, ownerID, true);
baseEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
return baseEntity;
}
示例7: AddNewPrim
/// <summary>
/// Create a New SceneObjectGroup/Part by raycasting
/// </summary>
/// <param name="ownerID"></param>
/// <param name="groupID"></param>
/// <param name="pos"></param>
/// <param name="rot"></param>
/// <param name="shape"></param>
public virtual ISceneEntity AddNewPrim(
UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
{
SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape, m_DefaultObjectName,
m_parentScene);
// If an entity creator has been registered for this prim type then use that
if (m_entityCreators.ContainsKey((PCode) shape.PCode))
{
sceneObject =
(SceneObjectGroup)
m_entityCreators[(PCode) shape.PCode].CreateEntity(sceneObject, ownerID, groupID, pos, rot, shape);
}
else
{
// Otherwise, use this default creation code;
sceneObject.SetGroup(groupID, ownerID, false);
AddPrimToScene(sceneObject);
sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
}
return sceneObject;
}
示例8: BSPrimDisplaced
public BSPrimDisplaced(uint localID, String primName, BSScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
ClearDisplacement();
}
示例9: SceneObjectGroup
/// <summary>
/// Constructor. This object is added to the scene later via AttachToScene()
/// </summary>
public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape, string name,
IScene scene) : this(scene)
{
SceneObjectPart part = new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero, name, scene);
SetRootPart(part);
//This has to be set, otherwise it will break things like rezzing objects in an area where crossing is disabled, but rez isn't
m_lastSignificantPosition = pos;
m_ValidgrpOOB = false;
}
示例10: hasCutHollowDimpleProfileCut
// Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
static void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut,
out bool hasHollow,
out bool hasDimple, out bool hasProfileCut)
{
if (primType == (int) PrimType.Box
||
primType == (int) PrimType.Cylinder
||
primType == (int) PrimType.Prism)
hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
else
hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
hasHollow = shape.ProfileHollow > 0;
hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
hasProfileCut = hasDimple; // is it the same thing?
}
示例11: CreateMesh
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{
Mesh mesh = null;
ulong key = primShape.GetMeshKey(size, lod);
if (size.X < 0.01f) size.X = 0.01f;
if (size.Y < 0.01f) size.Y = 0.01f;
if (size.Z < 0.01f) size.Z = 0.01f;
if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh &&
size.Z < minSizeForComplexMesh)
mesh = CreateBoundingBoxMesh(size, key);
else
mesh = CreateMeshFromPrimMesher(primName, primShape, size, lod, key);
return mesh;
}
示例12: WriteShape
private void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary<string, object> options)
{
if (shp != null)
{
writer.WriteStartElement("Shape");
writer.WriteElementString("ProfileCurve", shp.ProfileCurve.ToString());
writer.WriteStartElement("TextureEntry");
byte[] te;
if (shp.TextureEntry != null)
te = shp.TextureEntry;
else
te = Utils.EmptyBytes;
writer.WriteBase64(te, 0, te.Length);
writer.WriteEndElement(); // TextureEntry
writer.WriteStartElement("ExtraParams");
byte[] ep;
if (shp.ExtraParams != null)
ep = shp.ExtraParams;
else
ep = Utils.EmptyBytes;
writer.WriteBase64(ep, 0, ep.Length);
writer.WriteEndElement(); // ExtraParams
writer.WriteElementString("PathBegin", shp.PathBegin.ToString());
writer.WriteElementString("PathCurve", shp.PathCurve.ToString());
writer.WriteElementString("PathEnd", shp.PathEnd.ToString());
writer.WriteElementString("PathRadiusOffset", shp.PathRadiusOffset.ToString());
writer.WriteElementString("PathRevolutions", shp.PathRevolutions.ToString());
writer.WriteElementString("PathScaleX", shp.PathScaleX.ToString());
writer.WriteElementString("PathScaleY", shp.PathScaleY.ToString());
writer.WriteElementString("PathShearX", shp.PathShearX.ToString());
writer.WriteElementString("PathShearY", shp.PathShearY.ToString());
writer.WriteElementString("PathSkew", shp.PathSkew.ToString());
writer.WriteElementString("PathTaperX", shp.PathTaperX.ToString());
writer.WriteElementString("PathTaperY", shp.PathTaperY.ToString());
writer.WriteElementString("PathTwist", shp.PathTwist.ToString());
writer.WriteElementString("PathTwistBegin", shp.PathTwistBegin.ToString());
writer.WriteElementString("PCode", shp.PCode.ToString());
writer.WriteElementString("ProfileBegin", shp.ProfileBegin.ToString());
writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
writer.WriteElementString("State", shp.State.ToString());
writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString());
writer.WriteElementString("HollowShape", shp.HollowShape.ToString());
WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
writer.WriteElementString("SculptType", shp.SculptType.ToString());
writer.WriteStartElement("SculptData");
byte[] sd;
//if (shp.SculptData != null)
sd = shp.ExtraParams;
//else
// sd = Utils.EmptyBytes;
if (sd != null) writer.WriteBase64(sd, 0, sd.Length);
writer.WriteEndElement(); // SculptData
writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString());
writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString());
writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString());
writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString());
writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString());
writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString());
writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString());
writer.WriteElementString("LightColorR", shp.LightColorR.ToString());
writer.WriteElementString("LightColorG", shp.LightColorG.ToString());
writer.WriteElementString("LightColorB", shp.LightColorB.ToString());
writer.WriteElementString("LightColorA", shp.LightColorA.ToString());
writer.WriteElementString("LightRadius", shp.LightRadius.ToString());
writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString());
writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString());
writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString());
writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower());
writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower());
writer.WriteElementString("SculptEntry", shp.SculptEntry.ToString().ToLower());
if (shp.Media != null)
writer.WriteElementString("Media", shp.Media.ToXml());
writer.WriteEndElement(); // Shape
}
}
示例13: ProcessShpMedia
private void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("Media", String.Empty);
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
}
示例14: ProcessShpSculptEntry
private void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty);
}
示例15: ProcessShpLightIntensity
private void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty);
}