本文整理汇总了C#中ObjectShapePacket.ObjectDataBlock类的典型用法代码示例。如果您正苦于以下问题:C# ObjectShapePacket.ObjectDataBlock类的具体用法?C# ObjectShapePacket.ObjectDataBlock怎么用?C# ObjectShapePacket.ObjectDataBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectShapePacket.ObjectDataBlock类属于命名空间,在下文中一共展示了ObjectShapePacket.ObjectDataBlock类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPrimitiveShapeParams
// Prim type sculpt.
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId;
if (!UUID.TryParse(map, out sculptId))
{
sculptId = InventoryKey(map, (int)AssetType.Texture);
}
if (sculptId == UUID.Zero)
return;
shapeBlock.PathCurve = pathcurve;
shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
{
// default
type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}
示例2: UpdatePrimShape
/// <summary>
/// </summary>
/// <param name="LocalID"></param>
/// <param name="shapeBlock"></param>
/// <param name="agentID"></param>
protected internal void UpdatePrimShape(UUID agentID, uint LocalID, UpdateShapeArgs shapeBlock)
{
ISceneChildEntity part;
if (TryGetPart(LocalID, out part))
{
if (m_parentScene.Permissions.CanEditObject(part.UUID, agentID))
{
ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock
{
ObjectLocalID = shapeBlock.ObjectLocalID,
PathBegin = shapeBlock.PathBegin,
PathCurve = shapeBlock.PathCurve,
PathEnd = shapeBlock.PathEnd,
PathRadiusOffset = shapeBlock.PathRadiusOffset,
PathRevolutions = shapeBlock.PathRevolutions,
PathScaleX = shapeBlock.PathScaleX,
PathScaleY = shapeBlock.PathScaleY,
PathShearX = shapeBlock.PathShearX,
PathShearY = shapeBlock.PathShearY,
PathSkew = shapeBlock.PathSkew,
PathTaperX = shapeBlock.PathTaperX,
PathTaperY = shapeBlock.PathTaperY,
PathTwist = shapeBlock.PathTwist,
PathTwistBegin = shapeBlock.PathTwistBegin,
ProfileBegin = shapeBlock.ProfileBegin,
ProfileCurve = shapeBlock.ProfileCurve,
ProfileEnd = shapeBlock.ProfileEnd,
ProfileHollow = shapeBlock.ProfileHollow
};
((SceneObjectPart) part).UpdateShape(shapeData);
}
}
}
示例3: SetPrimitiveBlockShapeParams
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_TRIANGLE)
{
holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
}
shapeBlock.ProfileCurve = (byte)holeshape;
if (cut.x < 0f)
{
cut.x = 0f;
}
if (cut.x > 1f)
{
cut.x = 1f;
}
if (cut.y < 0f)
{
cut.y = 0f;
}
if (cut.y > 1f)
{
cut.y = 1f;
}
if (cut.y - cut.x < 0.05f)
{
cut.x = cut.y - 0.05f;
if (cut.x < 0.0f)
{
cut.x = 0.0f;
cut.y = 0.05f;
}
}
shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
if (hollow < 0f)
{
hollow = 0f;
}
if (hollow > 0.95)
{
hollow = 0.95f;
}
shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
if (twist.x < -1.0f)
{
twist.x = -1.0f;
}
if (twist.x > 1.0f)
{
twist.x = 1.0f;
}
if (twist.y < -1.0f)
{
twist.y = -1.0f;
}
if (twist.y > 1.0f)
{
twist.y = 1.0f;
}
shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
shapeBlock.PathTwist = (sbyte)(100 * twist.y);
shapeBlock.ObjectLocalID = part.LocalId;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SculptEntry = false;
return shapeBlock;
}
示例4: SetPrimitiveBlockShapeParams
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
{
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_TRIANGLE)
{
holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
}
shapeBlock.PathCurve = pathcurve;
shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
if (cut.x < 0f)
{
cut.x = 0f;
}
if (cut.x > 1f)
{
cut.x = 1f;
}
if (cut.y < 0f)
{
cut.y = 0f;
}
if (cut.y > 1f)
{
cut.y = 1f;
}
if (cut.y - cut.x < 0.05f)
{
cut.x = cut.y - 0.05f;
if (cut.x < 0.0f)
{
cut.x = 0.0f;
cut.y = 0.05f;
}
}
shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
if (hollow < 0f)
{
hollow = 0f;
}
// If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
// Box or Tube) and the hole shape is a square, hollow is limited to
// a max of 70%. The viewer performs its own check on this value but
// we need to do it here also so llGetPrimitiveParams can have access
// to the correct value.
if (profileshape != (byte)ProfileCurve.Square &&
holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
{
if (hollow > 0.70f)
{
hollow = 0.70f;
}
}
// Otherwise, hollow is limited to 95%.
else
{
if (hollow > 0.95f)
{
hollow = 0.95f;
}
}
shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
if (twist.x < -1.0f)
{
twist.x = -1.0f;
}
if (twist.x > 1.0f)
{
twist.x = 1.0f;
}
if (twist.y < -1.0f)
{
twist.y = -1.0f;
}
if (twist.y > 1.0f)
{
twist.y = 1.0f;
}
// A fairly large precision error occurs for some calculations,
// if a float or double is directly cast to a byte or sbyte
// variable, in both .Net and Mono. In .Net, coding
// "(sbyte)(float)(some expression)" corrects the precision
// errors. But this does not work for Mono. This longer coding
// form of creating a tempoary float variable from the
// expression first, then casting that variable to a byte or
// sbyte, works for both .Net and Mono. These types of
// assignments occur in SetPrimtiveBlockShapeParams and
// SetPrimitiveShapeParams in support of llSetPrimitiveParams.
tempFloat = (float)(100.0d * twist.x);
shapeBlock.PathTwistBegin = (sbyte)tempFloat;
tempFloat = (float)(100.0d * twist.y);
shapeBlock.PathTwist = (sbyte)tempFloat;
shapeBlock.ObjectLocalID = part.LocalId;
//.........这里部分代码省略.........
示例5: SetPrimitiveSculpted
void SetPrimitiveSculpted(UUID map, byte type)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
ISceneChildEntity part = GetSOP();
UUID sculptId = map;
shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptProperties(type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}
示例6: UpdatePrimShape
/// <summary>
///
/// </summary>
/// <param name="primLocalID"></param>
/// <param name="shapeBlock"></param>
protected internal void UpdatePrimShape(UUID agentID, uint primLocalID, UpdateShapeArgs shapeBlock)
{
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID))
{
ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
shapeData.PathBegin = shapeBlock.PathBegin;
shapeData.PathCurve = shapeBlock.PathCurve;
shapeData.PathEnd = shapeBlock.PathEnd;
shapeData.PathRadiusOffset = shapeBlock.PathRadiusOffset;
shapeData.PathRevolutions = shapeBlock.PathRevolutions;
shapeData.PathScaleX = shapeBlock.PathScaleX;
shapeData.PathScaleY = shapeBlock.PathScaleY;
shapeData.PathShearX = shapeBlock.PathShearX;
shapeData.PathShearY = shapeBlock.PathShearY;
shapeData.PathSkew = shapeBlock.PathSkew;
shapeData.PathTaperX = shapeBlock.PathTaperX;
shapeData.PathTaperY = shapeBlock.PathTaperY;
shapeData.PathTwist = shapeBlock.PathTwist;
shapeData.PathTwistBegin = shapeBlock.PathTwistBegin;
shapeData.ProfileBegin = shapeBlock.ProfileBegin;
shapeData.ProfileCurve = shapeBlock.ProfileCurve;
shapeData.ProfileEnd = shapeBlock.ProfileEnd;
shapeData.ProfileHollow = shapeBlock.ProfileHollow;
group.UpdateShape(shapeData, primLocalID);
}
}
}
示例7: SetPrimitiveShapeParams
protected void SetPrimitiveShapeParams (ISceneChildEntity part, string map, int type)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId;
if (!UUID.TryParse(map, out sculptId))
{
sculptId = InventoryKey(map, (int)AssetType.Texture);
}
if (sculptId == UUID.Zero)
return;
shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
int onlytype = (type & 7);//Removes the sculpt flags according to libOMV
if (onlytype != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER &&
onlytype != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
onlytype != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE &&
onlytype != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS &&
onlytype != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_MESH)
{
// default
type |= (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}
示例8: SetPrimitiveBlockShapeParams
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(ISceneChildEntity part, int holeshape,
LSL_Vector cut, float hollow,
LSL_Vector twist)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
if (holeshape != (int) ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int) ScriptBaseClass.PRIM_HOLE_CIRCLE &&
holeshape != (int) ScriptBaseClass.PRIM_HOLE_SQUARE &&
holeshape != (int) ScriptBaseClass.PRIM_HOLE_TRIANGLE)
{
holeshape = ScriptBaseClass.PRIM_HOLE_DEFAULT;
}
shapeBlock.ProfileCurve = (byte) holeshape;
if (cut.x < 0f)
{
cut.x = 0f;
}
if (cut.x > 1f)
{
cut.x = 1f;
}
if (cut.y < 0f)
{
cut.y = 0f;
}
if (cut.y > 1f)
{
cut.y = 1f;
}
if (cut.y - cut.x < 0.05f)
{
cut.x = cut.y - 0.05f;
if (cut.x < 0.0f)
{
cut.x = 0.0f;
cut.y = 0.05f;
}
}
shapeBlock.ProfileBegin = (ushort) (50000*cut.x);
shapeBlock.ProfileEnd = (ushort) (50000*(1 - cut.y));
if (hollow < 0f)
{
hollow = 0f;
}
if (hollow > 0.95)
{
hollow = 0.95f;
}
shapeBlock.ProfileHollow = (ushort) (50000*hollow);
if (twist.x < -1.0f)
{
twist.x = -1.0f;
}
if (twist.x > 1.0f)
{
twist.x = 1.0f;
}
if (twist.y < -1.0f)
{
twist.y = -1.0f;
}
if (twist.y > 1.0f)
{
twist.y = 1.0f;
}
// A fairly large precision error occurs for some calculations,
// if a float or double is directly cast to a byte or sbyte
// variable, in both .Net and Mono. In .Net, coding
// "(sbyte)(float)(some expression)" corrects the precision
// errors. But this does not work for Mono. This longer coding
// form of creating a tempoary float variable from the
// expression first, then casting that variable to a byte or
// sbyte, works for both .Net and Mono. These types of
// assignments occur in SetPrimtiveBlockShapeParams and
// SetPrimitiveShapeParams in support of llSetPrimitiveParams.
float tempFloat = (float) (100.0d*twist.x);
shapeBlock.PathTwistBegin = (sbyte) tempFloat;
tempFloat = (float) (100.0d*twist.y);
shapeBlock.PathTwist = (sbyte) tempFloat;
shapeBlock.ObjectLocalID = part.LocalId;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SculptEntry = false;
return shapeBlock;
}
示例9: SetPrimitiveShapeParams
protected void SetPrimitiveShapeParams(ISceneChildEntity part, string map, int type)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId = KeyOrName(map, AssetType.Texture, true);
if (sculptId == UUID.Zero)
return;
shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
int onlytype = (type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR));
//Removes the sculpt flags according to libOMV
if (onlytype != (int) ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER &&
onlytype != (int) ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
onlytype != (int) ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE &&
onlytype != (int) ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS &&
onlytype != (int) ScriptBaseClass.PRIM_SCULPT_TYPE_MESH)
{
// default
type |= ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
bool changedTextureID = part.Shape.SculptTexture != sculptId;
part.Shape.SetSculptProperties((byte) type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock, changedTextureID);
}