本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectPart.UpdateTextureEntry方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectPart.UpdateTextureEntry方法的具体用法?C# SceneObjectPart.UpdateTextureEntry怎么用?C# SceneObjectPart.UpdateTextureEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectPart
的用法示例。
在下文中一共展示了SceneObjectPart.UpdateTextureEntry方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTexture
protected void SetTexture(SceneObjectPart part, string texture, int face)
{
UUID textureID = new UUID();
textureID = InventoryKey(texture, (int)AssetType.Texture);
if (textureID == UUID.Zero)
{
if (!UUID.TryParse(texture, out textureID))
return;
}
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.TextureID = textureID;
tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].TextureID = textureID;
}
}
tex.DefaultTexture.TextureID = textureID;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例2: RotateTexture
protected void RotateTexture(SceneObjectPart part, double rotation, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.Rotation = (float)rotation;
tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
if (face == ScriptBaseClass.ALL_SIDES)
{
for (int i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].Rotation = (float)rotation;
}
}
tex.DefaultTexture.Rotation = (float)rotation;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例3: SetFullBright
public void SetFullBright(SceneObjectPart part, int face, bool bright)
{
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Fullbright = bright;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].Fullbright = bright;
}
}
tex.DefaultTexture.Fullbright = bright;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例4: SetAlpha
protected void SetAlpha(SceneObjectPart part, double alpha, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
Color4 texcolor;
if (face >= 0 && face < GetNumberOfSides(part))
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (int i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.FaceTextures[i].RGBA = texcolor;
}
}
// In some cases, the default texture can be null, eg when every face
// has a unique texture
if (tex.DefaultTexture != null)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor;
}
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例5: SetTexGen
public void SetTexGen(SceneObjectPart part, int face,int style)
{
Primitive.TextureEntry tex = part.Shape.Textures;
MappingType textype;
textype = MappingType.Default;
if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR)
textype = MappingType.Planar;
if (face >= 0 && face < GetNumberOfSides(part))
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].TexMapType = textype;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].TexMapType = textype;
}
tex.DefaultTexture.TexMapType = textype;
}
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例6: SetShiny
public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
{
Shininess sval = new Shininess();
switch (shiny)
{
case 0:
sval = Shininess.None;
break;
case 1:
sval = Shininess.Low;
break;
case 2:
sval = Shininess.Medium;
break;
case 3:
sval = Shininess.High;
break;
default:
sval = Shininess.None;
break;
}
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Shiny = sval;
tex.FaceTextures[face].Bump = bump;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].Shiny = sval;
tex.FaceTextures[i].Bump = bump;;
}
tex.DefaultTexture.Shiny = sval;
tex.DefaultTexture.Bump = bump;
}
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例7: OffsetTexture
protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.OffsetU = (float)u;
texface.OffsetV = (float)v;
tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
if (face == ScriptBaseClass.ALL_SIDES)
{
for (int i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].OffsetU = (float)u;
tex.FaceTextures[i].OffsetV = (float)v;
}
}
tex.DefaultTexture.OffsetU = (float)u;
tex.DefaultTexture.OffsetV = (float)v;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例8: SetGlow
public void SetGlow(SceneObjectPart part, int face, float glow)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Glow = glow;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
tex.FaceTextures[i].Glow = glow;
}
tex.DefaultTexture.Glow = glow;
}
part.UpdateTextureEntry(tex.GetBytes());
return;
}
}
示例9: SetColor
protected void SetColor(SceneObjectPart part, LSL_Vector color, int face)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
Color4 texcolor;
if (face >= 0 && face < GetNumberOfSides(part))
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTextureEntry(tex.GetBytes());
return;
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (uint i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
tex.FaceTextures[i].RGBA = texcolor;
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor;
}
part.UpdateTextureEntry(tex.GetBytes());
return;
}
if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES;
m_host.SetFaceColorAlpha(face, color, null);
}
示例10: AssignSingleMaterial
//.........这里部分代码省略.........
return;
}
lock (m_knownMaterials)
{
UUID id = UUID.Zero;
// Record what we currently have
var currentMaterialIDs = getMaterialIDsFromTextureEntry(te);
// If there is a material being set see if we've seen it before.
// If not we'll add it to the region cache
if (matData != null)
{
RenderMaterial material = RenderMaterial.FromOSD(matData);
id = sop.Shape.RenderMaterials.AddMaterial(material);
if (m_knownMaterials.ContainsKey(id))
{
material = m_knownMaterials[id].material;
var entry = m_knownMaterials[id];
if (entry.partIds.Contains(sop.LocalId) == false)
entry.partIds.Add(sop.LocalId);
}
else
{
m_knownMaterials[id] = new RenderMaterialEntry(material, sop.LocalId);
}
m_log.DebugFormat("[RenderMaterials]: SOP {0}, Face {1}, Adding RenderMaterial {2}",
sop.LocalId, face, material.ToString());
}
// Set the Material ID in the sop texture entry. If there's a face defined
// use that else use the Default entry. ID can either be a material ID
// we set from the lookup above or Zero when we are clearing a material.
if (face < 0)
{
te.DefaultTexture.MaterialID = id;
}
else
{
var faceEntry = te.CreateFace((uint)face);
faceEntry.MaterialID = id;
}
// Get the updated list of Materials from the TextureEntry. We will
// Use that to rebuild the RenderMaterials for the part. We'll also get a list
// of entries that have been removed based on what we fetched initially so we
// can clean that up in our cache.
var newMaterialIDs = getMaterialIDsFromTextureEntry(te);
// If there was an update and the material id has changed, clean up the old value.
// Have to be careful here. It might still be in use in another slot. So we build
// a list of keys and walk the texture entries subtracting keys in use. Whatever
// is left are candidates to clean up.
foreach (var entry in newMaterialIDs)
{
if (currentMaterialIDs.Contains(entry))
{
currentMaterialIDs.Remove(entry);
}
if (sop.Shape.RenderMaterials.ContainsMaterial(entry) == false)
{
m_log.WarnFormat("[RenderMaterials]: SOP {0}, Face {1}, RenderMaterials {2} should be present but isn't!",
sop.LocalId, face, entry.ToString());
}
}
// currentMaterialsIDs contains orphans if any. Remove them from the sop.Shape and the cache (if needed)
foreach (var entry in currentMaterialIDs)
{
if (sop.Shape.RenderMaterials.ContainsMaterial(entry) == true)
{
m_log.DebugFormat("[RenderMaterials]: SOP {0}, Face {1}, Removing unused RenderMaterials {2} from shape.",
sop.LocalId, face, entry.ToString());
sop.Shape.RenderMaterials.RemoveMaterial(entry);
}
else
{
m_log.WarnFormat("[RenderMaterials]: SOP {0}, Face {1}, ORPHANED RenderMaterials {2} should be present but isn't!",
sop.LocalId, face, entry.ToString());
}
if (m_knownMaterials.ContainsKey(entry))
{
m_knownMaterials[entry].partIds.Remove(sop.LocalId);
if (m_knownMaterials[entry].partIds.Count <= 0)
{
m_log.DebugFormat("[RenderMaterials]: Removing unused RenderMaterials {0} from region cache.", entry.ToString());
m_knownMaterials.Remove(entry);
}
}
}
}
// Update the texture entry which will force an update to connected clients
sop.UpdateTextureEntry(te.GetBytes());
}