本文整理汇总了C#中ISceneChildEntity.GetRotationOffset方法的典型用法代码示例。如果您正苦于以下问题:C# ISceneChildEntity.GetRotationOffset方法的具体用法?C# ISceneChildEntity.GetRotationOffset怎么用?C# ISceneChildEntity.GetRotationOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneChildEntity
的用法示例。
在下文中一共展示了ISceneChildEntity.GetRotationOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UndoState
public UndoState (ISceneChildEntity part)
{
if (part != null) {
if (part.UUID == part.ParentEntity.UUID) {
Position = part.ParentEntity.AbsolutePosition;
Rotation = part.GetRotationOffset ();
Scale = part.Shape.Scale;
} else {
Position = part.OffsetPosition;
Rotation = part.GetRotationOffset ();
Scale = part.Shape.Scale;
}
}
}
示例2: Compare
public bool Compare (ISceneChildEntity part)
{
if (part != null) {
if (part.UUID == part.ParentEntity.UUID) {
if (Position == part.AbsolutePosition && Rotation == part.GetRotationOffset () &&
Scale == part.Shape.Scale)
return true;
return false;
}
if (Position == part.OffsetPosition && Rotation == part.GetRotationOffset () &&
Scale == part.Shape.Scale)
return true;
return false;
}
return false;
}
示例3: CreatePrim
void CreatePrim (WarpRenderer renderer, ISceneChildEntity prim)
{
try {
if ((PCode)prim.Shape.PCode != PCode.Prim)
return;
if (prim.Scale.LengthSquared () < MIN_PRIM_SIZE * MIN_PRIM_SIZE)
return;
Primitive omvPrim = prim.Shape.ToOmvPrimitive (prim.OffsetPosition, prim.GetRotationOffset ());
FacetedMesh renderMesh = null;
// Are we dealing with a sculptie or mesh?
if (omvPrim.Sculpt != null && omvPrim.Sculpt.SculptTexture != UUID.Zero) {
// Try fetching the asset
byte [] sculptAsset = m_scene.AssetService.GetData (omvPrim.Sculpt.SculptTexture.ToString ());
if (sculptAsset != null) {
// Is it a mesh?
if (omvPrim.Sculpt.Type == SculptType.Mesh) {
AssetMesh meshAsset = new AssetMesh (omvPrim.Sculpt.SculptTexture, sculptAsset);
FacetedMesh.TryDecodeFromAsset (omvPrim, meshAsset, DetailLevel.Highest, out renderMesh);
meshAsset = null;
} else // It's sculptie
{
Image sculpt = m_imgDecoder.DecodeToImage (sculptAsset);
if (sculpt != null) {
renderMesh = m_primMesher.GenerateFacetedSculptMesh (omvPrim, (Bitmap)sculpt,
DetailLevel.Medium);
sculpt.Dispose ();
}
}
sculptAsset = null;
} else {
// missing sculpt data... replace with something
renderMesh = m_primMesher.GenerateFacetedMesh (omvPrim, DetailLevel.Medium);
}
} else // Prim
{
renderMesh = m_primMesher.GenerateFacetedMesh (omvPrim, DetailLevel.Medium);
}
if (renderMesh == null)
return;
warp_Vector primPos = ConvertVector (prim.GetWorldPosition ());
warp_Quaternion primRot = ConvertQuaternion (prim.GetRotationOffset ());
warp_Matrix m = warp_Matrix.quaternionMatrix (primRot);
if (prim.ParentID != 0) {
ISceneEntity group = m_scene.GetGroupByPrim (prim.LocalId);
if (group != null)
m.transform (warp_Matrix.quaternionMatrix (ConvertQuaternion (group.RootChild.GetRotationOffset ())));
}
warp_Vector primScale = ConvertVector (prim.Scale);
string primID = prim.UUID.ToString ();
// Create the prim faces
for (int i = 0; i < renderMesh.Faces.Count; i++) {
Face renderFace = renderMesh.Faces [i];
string meshName = primID + "-Face-" + i;
warp_Object faceObj = new warp_Object (renderFace.Vertices.Count, renderFace.Indices.Count / 3);
foreach (Vertex v in renderFace.Vertices) {
warp_Vector pos = ConvertVector (v.Position);
warp_Vector norm = ConvertVector (v.Normal);
if (prim.Shape.SculptTexture == UUID.Zero)
norm = norm.reverse ();
warp_Vertex vert = new warp_Vertex (pos, norm, v.TexCoord.X, v.TexCoord.Y);
faceObj.addVertex (vert);
}
for (int j = 0; j < renderFace.Indices.Count;) {
faceObj.addTriangle (
renderFace.Indices [j++],
renderFace.Indices [j++],
renderFace.Indices [j++]);
}
Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace ((uint)i);
string materialName;
Color4 faceColor = GetFaceColor (teFace);
if (m_texturePrims && (prim.Scale.LengthSquared () > m_texturePrimSize)) {
materialName = GetOrCreateMaterial (renderer, faceColor, teFace.TextureID);
} else {
materialName = GetOrCreateMaterial (renderer, faceColor);
}
faceObj.transform (m);
faceObj.setPos (primPos);
faceObj.scaleSelf (primScale.x, primScale.y, primScale.z);
renderer.Scene.addObject (meshName, faceObj);
//.........这里部分代码省略.........
示例4: GetLinkPrimitiveParams
//.........这里部分代码省略.........
{
if (remain < 1)
return res;
face = rules.GetLSLIntegerItem(idx++);
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < GetNumberOfSides(part); face++)
{
MappingType texgen = tex.GetFace((uint) face).TexMapType;
// Convert MappingType to PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR etc.
res.Add(new LSL_Integer((uint) texgen >> 1));
}
}
else
{
if (face >= 0 && face < GetNumberOfSides(part))
{
MappingType texgen = tex.GetFace((uint) face).TexMapType;
res.Add(new LSL_Integer((uint) texgen >> 1));
}
}
}
else if (code == (int) ScriptBaseClass.PRIM_POINT_LIGHT)
{
PrimitiveBaseShape shape = part.Shape;
res.Add(shape.LightEntry ? new LSL_Integer(1) : new LSL_Integer(0));
res.Add(new LSL_Vector(shape.LightColorR, // color
shape.LightColorG,
shape.LightColorB));
res.Add(new LSL_Float(shape.LightIntensity)); // intensity
res.Add(new LSL_Float(shape.LightRadius)); // radius
res.Add(new LSL_Float(shape.LightFalloff)); // falloff
}
else if (code == (int) ScriptBaseClass.PRIM_GLOW)
{
if (remain < 1)
return res;
face = rules.GetLSLIntegerItem(idx++);
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < GetNumberOfSides(part); face++)
{
Primitive.TextureEntryFace texface = tex.GetFace((uint) face);
res.Add(new LSL_Float(texface.Glow));
}
}
else
{
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.GetFace((uint) face);
res.Add(new LSL_Float(texface.Glow));
}
}
}
else if (code == (int) ScriptBaseClass.PRIM_TEXT)
{
Color4 textColor = part.GetTextColor();
res.Add(new LSL_String(part.Text));
res.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
res.Add(new LSL_Float(textColor.A));
}
else if (code == (int) ScriptBaseClass.PRIM_ROT_LOCAL)
{
Quaternion rtmp = part.GetRotationOffset();
res.Add(new LSL_Rotation(rtmp.X, rtmp.Y, rtmp.Z, rtmp.W));
}
else if (code == (int) ScriptBaseClass.PRIM_OMEGA)
{
Vector3 axis = part.OmegaAxis;
LSL_Float spinRate = part.OmegaSpinRate;
LSL_Float gain = part.OmegaGain;
res.Add(axis);
res.Add(spinRate);
res.Add(gain);
}
else if (code == (int) ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE)
{
res.Add(new LSL_Integer(part.PhysicsType));
}
else if (code == (int) ScriptBaseClass.PRIM_LINK_TARGET)
{
if (remain < 1)
continue;
LSL_Integer nextLink = rules.GetLSLIntegerItem(idx++);
List<ISceneChildEntity> entities = GetLinkParts(nextLink);
if (entities.Count > 0)
part = entities[0];
}
}
return res;
}