当前位置: 首页>>代码示例>>C#>>正文


C# Entity.GetSubEntity方法代码示例

本文整理汇总了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;
        }
开发者ID:andyhebear,项目名称:mogrelibrarys,代码行数:14,代码来源:ImpostorBatch.cs

示例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();
     }
 }
开发者ID:andyhebear,项目名称:extramegablob,代码行数:22,代码来源:Helpers.cs

示例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;
            }
        }
开发者ID:andyhebear,项目名称:mogrelibrarys,代码行数:54,代码来源:BatchedGeometry.cs

示例4: SetParameters

 public void SetParameters(Entity ent, Vector4 translationScale, Vector4 color)
 {
     ent.GetSubEntity(0).SetCustomParameter(TransXYscaleXY, translationScale);
     ent.GetSubEntity(0).SetCustomParameter(ColorAndHeightScale, color);
 }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:5,代码来源:TerrainBlock2.cs

示例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;
              }
            }
              }
        }
开发者ID:aczarno,项目名称:StickMagik,代码行数:72,代码来源:ArcadeStickData.cs


注:本文中的System.Entity.GetSubEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。