本文整理汇总了C#中System.Entity.GetSubEntity方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetSubEntity方法的具体用法?C# Entity.GetSubEntity怎么用?C# Entity.GetSubEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.GetSubEntity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateEntityKey
/// <summary>
///
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public static string GenerateEntityKey(Entity entity)
{
string entityKey = string.Empty;
entityKey = entity.Mesh.Name;
for (int i = 0; i < entity.SubEntityCount; i++)
entityKey += "-" + entity.GetSubEntity(i).Name;
return entityKey;
}
示例2: setEntityOpacity
public static void setEntityOpacity(Entity ent, float val)
{
for (uint x = 0; x < ent.NumSubEntities; x++)
{
Mogre.MaterialPtr mat = ent.GetSubEntity(x).GetMaterial();
Technique t = mat.GetTechnique(0); // we are only bothering the fade with the first technique.
//t.SetSceneBlending(SceneBlendFactor.SBF_DEST_ALPHA, SceneBlendFactor.SBF_ONE_MINUS_DEST_COLOUR); //sweet color invert effect
t.SetSceneBlending(SceneBlendFactor.SBF_DEST_ALPHA, SceneBlendFactor.SBF_SOURCE_ALPHA); //works
t.SetDepthWriteEnabled(false);
t.SetSelfIllumination(ColourValue.Green);
t.SetAmbient(ColourValue.Green);
// iterate through passes and textureUnitStates, setting their opacity.
for (ushort p = 0; p < t.NumPasses; p++)
{
for (ushort s = 0; s < t.GetPass(p).NumTextureUnitStates; s++)
{
t.GetPass(p).GetTextureUnitState(s).SetAlphaOperation(LayerBlendOperationEx.LBX_MODULATE, LayerBlendSource.LBS_MANUAL, LayerBlendSource.LBS_CURRENT, val);
}
}
mat.Dispose();
}
}
示例3: AddEntity
/// <summary>
///
/// </summary>
/// <param name="ent"></param>
/// <param name="position"></param>
/// <param name="orientation"></param>
/// <param name="scale"></param>
/// <param name="color"></param>
public void AddEntity(Entity ent, Vector3 position, Quaternion orientation, Vector3 scale, ColorEx color) {
Mesh mesh = ent.Mesh;
if (mesh.SharedVertexData != null)
throw new Exception("Shared vertex data not allowed");
//For each subentity
for (int i = 0; i < ent.SubEntityCount; i++) {
//get the subentity
SubEntity subEntity = ent.GetSubEntity(i);
SubMesh subMesh = subEntity.SubMesh;
//Generate a format string that uniquely identifies this material & vertex/index format
if (subMesh.vertexData == null)
throw new Exception("Submesh vertex data not found!");
string formatStr = GetFormatString(subEntity);
//If a batch using an identical format exists...
SubBatch batch = null;
if (!mSubBatches.TryGetValue(formatStr, out batch)) {
batch = new SubBatch(this, subEntity);
mSubBatches.Add(formatStr, batch);
}
//Now add the submesh to the compatible batch
batch.AddSubEntity(subEntity, position, orientation, scale, color);
}//end for
//Update bounding box
Matrix4 mat = Matrix4.FromMatrix3(orientation.ToRotationMatrix());
mat.Scale = scale;
AxisAlignedBox entBounds = ent.BoundingBox;
entBounds.Transform(mat);
if (mBoundsUndefinded) {
mBounds.Minimum = entBounds.Minimum + position;
mBounds.Maximum = entBounds.Maximum + position;
mBoundsUndefinded = false;
}
else {
Vector3 min = mBounds.Minimum;
Vector3 max = mBounds.Maximum;
min.Floor(entBounds.Minimum + position);
max.Ceil(entBounds.Maximum + position);
mBounds.Minimum = min;
mBounds.Maximum = max;
}
}
示例4: SetParameters
public void SetParameters(Entity ent, Vector4 translationScale, Vector4 color)
{
ent.GetSubEntity(0).SetCustomParameter(TransXYscaleXY, translationScale);
ent.GetSubEntity(0).SetCustomParameter(ColorAndHeightScale, color);
}
示例5: FillData
public void FillData(string _filename, ref Entity _entity)
{
filename = _filename;
entity = _entity;
components = new List<ModelComponent>();
ModelComponent m;
Pass p;
String foundPath = "";
FileInfoListPtr fileInfos;
FileInfoList.Iterator it;
Mesh.Const_SubMeshNameMap map = entity.GetMesh().GetSubMeshNameMap();
for (uint i = 0; i < map.Count; i++)
{
for (Mesh.Const_SubMeshNameMap.ConstIterator start = map.Begin();
start != map.End(); start++)
{
if (start.Value == i)
{
// Name
m = new ModelComponent(start.Key);
// SubEntity
m.SubEntity = entity.GetSubEntity(start.Key);
// Type (Button, Joystick, Body?)
if(start.Key.Contains("Button") ||
start.Key.Contains("Plunger") ||
start.Key.Contains("Cylinder"))
m.Type = FragmentType.BUTTON;
else if(start.Key.Contains("Balltop") ||
start.Key.Contains("Shaft") ||
start.Key.Contains("Dust"))
m.Type = FragmentType.JOYSTICK;
else
m.Type = FragmentType.MODEL;
//m.Parent =;
// Texture
p = m.SubEntity.GetMaterial().GetBestTechnique().GetPass(0);
if(p.NumTextureUnitStates > 0)
{
// Set the texture
m.Texture = TextureManager.Singleton.GetByName(p.GetTextureUnitState(0).TextureName);
// Get a bitmap version to display
foundPath = m.Texture.Name;
fileInfos = ResourceGroupManager.Singleton.FindResourceFileInfo("General", foundPath );
it = fileInfos.Begin();
if(it != fileInfos.End())
foundPath = it.Value.archive.Name + "/" + foundPath;
else
foundPath = "";
m.TextureImage = new Bitmap(foundPath);
}
else
{
m.Texture = null;
// TODO: Put in a no texture image
m.TextureImage = null;
}
// Color
m.Color = Color.White;
components.Add(m);
break;
}
}
}
}