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


C# IEntity.ModuleInterfaceTypeNames方法代码示例

本文整理汇总了C#中IEntity.ModuleInterfaceTypeNames方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.ModuleInterfaceTypeNames方法的具体用法?C# IEntity.ModuleInterfaceTypeNames怎么用?C# IEntity.ModuleInterfaceTypeNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntity的用法示例。


在下文中一共展示了IEntity.ModuleInterfaceTypeNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAvatarTextures

        /// <summary>
        /// Create the textures for the avatar. If this is an LLEntityAvatar, extract the
        /// texture info from the avatar description and blindly create textures for the
        /// parts of the body in the order of the faces that were generated above.
        /// </summary>
        /// <param name="ent">The entity of the avatar being decorated</param>
        /// <param name="forceUpdateFlag">'true' if to force a redraw. If doing the initial
        /// creation, a redraw update is not necessary.</param>
        public bool CreateAvatarTextures(IEntity ent, bool forceUpdateFlag)
        {
            IEntityAvatar ientav;
            LLEntityAvatar entav;
            if (ent.TryGet<IEntityAvatar>(out ientav)) {
            if (ientav is LLEntityAvatar) {
                entav = (LLEntityAvatar)ientav;
                OMV.Avatar av = entav.Avatar;
                if (av != null && av.Textures != null) {
                    OMV.Primitive.TextureEntry texEnt = av.Textures;
                    OMV.Primitive.TextureEntryFace[] texFaces = texEnt.FaceTextures;

                    const int genCount = 7;
                    float[] textureParams = new float[1 + ((int)Ogr.CreateMaterialParam.maxParam) * genCount];
                    string[] materialNames = new string[genCount];
                    string[] textureOgreNames = new string[genCount];
                    textureParams[0] = (float)Ogr.CreateMaterialParam.maxParam;

                    int[] texIndexes = {
                        (int)OMV.AvatarTextureIndex.HeadBaked,
                        (int)OMV.AvatarTextureIndex.UpperBaked,
                        (int)OMV.AvatarTextureIndex.LowerBaked,
                        (int)OMV.AvatarTextureIndex.EyesBaked,
                        (int)OMV.AvatarTextureIndex.HairBaked,
                        // (int)OMV.AvatarTextureIndex.SkirtBaked
                    };

                    int pBase = 1;
                    int jj = 0;
                    string textureOgreName;
                    foreach (int baker in texIndexes) {
                        CreateMaterialParameters(texFaces[baker],
                            ent, null, pBase, ref textureParams, jj, out textureOgreName);
                        materialNames[jj] = EntityNameOgre.ConvertToOgreMaterialNameX(ent.Name, jj);
                        textureOgreNames[jj] = textureOgreName;
                        // m_log.Log(LogLevel.DRENDERDETAIL, "CreateAvatarTextures: mat={0}, tex={1}",
                        //             materialNames[jj], textureOgreName);

                        /*
                        // The textures for the baked avatar textures are processed specially
                        // Here we request they be loaded (if not already available) so we can specify their type
                        EntityNameOgre textureEnt = EntityNameOgre.ConvertOgreResourceToEntityName(textureOgreName);
                        System.Drawing.Bitmap textureBitmap = ent.AssetContext.GetTexture(textureEnt);
                        if (textureBitmap == null) {
                            // texture is not immediately available. Ask for it in a special way
                            ent.AssetContext.DoTextureLoad(textureEnt, AssetContextBase.AssetType.BakedTexture,
                                delegate(string name, bool trans) { return; });
                        }
                         */

                        pBase += (int)textureParams[0];
                        jj++;
                    }

                    m_log.Log(LogLevel.DRENDERDETAIL, "CreateAvatarTextures: materials for {0}", ent.Name);
                    Ogr.CreateMaterialResource7BF(0f, materialNames[0],
                        materialNames[0], materialNames[1], materialNames[2], materialNames[3],
                        materialNames[4], materialNames[5], materialNames[6],
                        textureOgreNames[0], textureOgreNames[1], textureOgreNames[2], textureOgreNames[3],
                        textureOgreNames[4], textureOgreNames[5], textureOgreNames[6],
                        textureParams
                    );
                }
                else {
                    // the avatar is not initialized yet. Try again later.
                    return false;
                }
            }
            else {
                m_log.Log(LogLevel.DBADERROR, "CreateAvatarTexture: REQUEST BUT NOT LLAVATAR");
            }
            }
            else {
            string modNames = "";
            foreach (string mod in ent.ModuleInterfaceTypeNames()) modNames += " " + mod;
            m_log.Log(LogLevel.DBADERROR, "CreateAvatarTexture: REQUEST FOR TEXTURES FOR NON LL ENTITY. Mod={0}", modNames);
            }
            return true;
        }
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:87,代码来源:RendererOgreLL.cs


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