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


C# PrimitiveBaseShape.GetMeshKey方法代码示例

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


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

示例1: CreateMesh

        public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
        {
            Mesh mesh = null;
            ulong key = primShape.GetMeshKey(size, lod);

            if (size.X < 0.01f) size.X = 0.01f;
            if (size.Y < 0.01f) size.Y = 0.01f;
            if (size.Z < 0.01f) size.Z = 0.01f;

            if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh &&
                size.Z < minSizeForComplexMesh)
                mesh = CreateBoundingBoxMesh(size, key);
            else
                mesh = CreateMeshFromPrimMesher(primName, primShape, size, lod, key);

            return mesh;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:17,代码来源:Meshmerizer.cs

示例2: ComputeShapeKey

        // Create a hash of all the shape parameters to be used as a key for this particular shape.
        public static System.UInt64 ComputeShapeKey(OMV.Vector3 size, PrimitiveBaseShape pbs, out float retLod)
        {
            // level of detail based on size and type of the object
            float lod = BSParam.MeshLOD;
            if (pbs.SculptEntry) lod = BSParam.SculptLOD;

            // Mega prims usually get more detail because one can interact with shape approximations at this size.
            float maxAxis = Math.Max(size.X, Math.Max(size.Y, size.Z));
            if (maxAxis > BSParam.MeshMegaPrimThreshold) lod = BSParam.MeshMegaPrimLOD;
            retLod = lod;
            return pbs.GetMeshKey(size, lod);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:13,代码来源:BSShapes.cs

示例3: CreateMesh

        public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
        {
            Mesh mesh;
            ulong key = primShape.GetMeshKey(size, lod);

            // If this mesh has been created already, return it instead of creating another copy
            lock (m_uniqueMeshes)
            {
                if (m_uniqueMeshes.TryGetValue(key, out mesh))
                    return mesh;
            }

            // set miniumm sizes
            if (size.X < 0.01f) size.X = 0.01f;
            if (size.Y < 0.01f) size.Y = 0.01f;
            if (size.Z < 0.01f) size.Z = 0.01f;

            if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
                mesh = CreateBoundingBoxMesh(size, key);
            else
                mesh = CreateMeshFromPrimMesher(primName, primShape, size, lod, key);

            // cache newly created mesh's
            lock (m_uniqueMeshes)
            {
                m_uniqueMeshes.Add(key, mesh);
            }

            return mesh;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:30,代码来源:Meshmerizer.cs

示例4: CreateMesh

        // Main mesh creation entry point
        public IMesh CreateMesh (string primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
        {
#if SPAM
            MainConsole.Instance.DebugFormat("[Mesh]: Creating mesh for {0}", primName);
#endif
            Mesh mesh;
            ulong key = 0;

            // If caching and this mesh has been created already, return it instead of creating another copy
            if (shouldCache) {
                key = primShape.GetMeshKey (size, lod);
                lock (m_uniqueMeshes) {
                    if (m_uniqueMeshes.TryGetValue (key, out mesh))
                        return mesh;
                }
            }

            // set miniumm sizes
            if (size.X < 0.01f) size.X = 0.01f;
            if (size.Y < 0.01f) size.Y = 0.01f;
            if (size.Z < 0.01f) size.Z = 0.01f;

            mesh = CreateMeshFromPrimMesher (primName, primShape, size, lod, key);

            if (mesh != null) {
                if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
                    mesh = CreateBoundingBoxMesh (size, key);
#if SPAM
                    MainConsole.Instance.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + 
                            minSizeForComplexMesh.ToString() + " - creating simple bounding box");
                    //mesh.DumpRaw(baseDir, primName, "Z extruded");
#endif


                // cache newly created mesh?
                if (shouldCache) {
                    lock (m_uniqueMeshes) {
                        m_uniqueMeshes.Add (key, mesh);
                    }
                }
            }
            return mesh;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:44,代码来源:Meshmerizer.cs

示例5: CreateMesh

        // Main mesh creation entry point
        public IMesh CreateMesh(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
        {
#if SPAM
            MainConsole.Instance.DebugFormat("[Mesh]: Creating mesh for {0}", primName);
#endif
            Mesh mesh;
            ulong key = primShape.GetMeshKey(size, lod);

            // If caching and this mesh has been created already, return it instead of creating another copy
            if (shouldCache)
            {
                lock (m_uniqueMeshes)
                {
                    if (m_uniqueMeshes.TryGetValue(key, out mesh))
                        return mesh;
                }
            }
            // set miniumm sizes
            if (size.X < 0.01f) size.X = 0.01f;
            if (size.Y < 0.01f) size.Y = 0.01f;
            if (size.Z < 0.01f) size.Z = 0.01f;

            if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
                mesh = CreateBoundingBoxMesh(size, key);
            else
                mesh = CreateMeshFromPrimMesher(primName, primShape, size, lod, key);

            // cache newly created mesh?
            if (shouldCache)
            {
                lock (m_uniqueMeshes)
                {
                    m_uniqueMeshes.Add(key, mesh);
                }
            }
            return mesh;
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:38,代码来源:Meshmerizer.cs


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