Пример #1
0
        public void Assign(QueuedSubMesh qsm)
        {
            queuedSubMeshes.Add(qsm);
            // update lod distances
            Mesh   mesh      = qsm.submesh.Parent;
            ushort lodLevels = (ushort)(mesh.IsLodManual ? 1 : mesh.LodLevelCount);

            if (qsm.geometryLodList.Count != lodLevels)
            {
                string msg = string.Format("QueuedSubMesh '{0}' lod count of {1} does not match parent count of {2}",
                                           qsm.submesh.Name, qsm.geometryLodList.Count, lodLevels);
                throw new AxiomException(msg);
            }

            while (lodSquaredDistances.Count < lodLevels)
            {
                lodSquaredDistances.Add(0.0f);
            }
            // Make sure LOD levels are max of all at the requested level
            for (ushort lod = 1; lod < lodLevels; ++lod)
            {
                MeshLodUsage meshLod = qsm.submesh.Parent.GetLodLevel(lod);
                lodSquaredDistances[lod] = Math.Max((float)lodSquaredDistances[lod], meshLod.fromSquaredDepth);
            }

            // update bounds
            // Transform world bounds relative to our center
            AxisAlignedBox localBounds = new AxisAlignedBox(qsm.worldBounds.Minimum - center, qsm.worldBounds.Maximum - center);

            aabb.Merge(localBounds);
            foreach (Vector3 corner in localBounds.Corners)
            {
                boundingRadius = Math.Max(boundingRadius, corner.Length);
            }
        }
Пример #2
0
 public void _setLodUsage(ushort level, MeshLodUsage usage)
 {
     OgrePINVOKE.Mesh__setLodUsage(swigCPtr, level, MeshLodUsage.getCPtr(usage));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #3
0
        public MeshLodUsage getLodLevel(ushort index)
        {
            MeshLodUsage ret = new MeshLodUsage(OgrePINVOKE.Mesh_getLodLevel(swigCPtr, index), false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #4
0
        // Just reads, does not save anything!
        protected virtual void ReadMeshLodUsageManual( BinaryReader reader, int lodNum, ref MeshLodUsage usage )
        {
            MeshChunkID cid = ReadChunk(reader);

            if ( cid != MeshChunkID.MeshLODManual)
            {
                // log missing manual meshlod
            }
            ReadString(reader); // usage.manualName =
        }
Пример #5
0
 // Just reads, does not save anything!
 protected virtual void ReadMeshLodUsageGenerated( BinaryReader reader, int lodNum, ref MeshLodUsage usage )
 {
     MeshChunkID cid;
     for (int i = 0; i < mesh.subMeshList.Count; i++)
     {
         cid = ReadChunk( reader );
         if ( cid != MeshChunkID.MeshLODGenerated )
         {
             // log no generated lod
         }
         // SubMesh sm = mesh.GetSubMesh( i );
         // IndexData indexData = new IndexData();
         // sm.lodFaceList[ lodNum - 1 ] = indexData;
         int tempindexcount = ReadInt(reader); // indexData.indexCount
         bool is32bit = ReadBool( reader );
         if ( is32bit )
         {
             int[] barray = new int[tempindexcount];
             ReadInts(reader, tempindexcount, barray);
         }
         else
         {
             short[] barray = new short[tempindexcount];
             ReadShorts(reader, tempindexcount, barray);
         }
     }
 }
Пример #6
0
        // Just reads, does not save anything!
        protected virtual void ReadMeshLodInfo( BinaryReader reader )
        {
            MeshChunkID cid;

            mesh.numLods = ReadShort(reader);
            mesh.isLodManual = ReadBool(reader);
            for (int i = 1;i < mesh.numLods;i++)
            {
                cid = ReadChunk( reader );
                if (cid != MeshChunkID.MeshLODUsage)
                {
                    // log no meshlodusage
                }

                MeshLodUsage usage = new MeshLodUsage();
                ReadFloat(reader); // usage.fromSquaredDepth =

                if(mesh.isLodManual)
                    ReadMeshLodUsageManual( reader, i, ref usage );
                else
                    ReadMeshLodUsageGenerated( reader, i, ref usage );

                // removed: mesh.lodUsageList.Add( usage );
            }
        }
Пример #7
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(MeshLodUsage obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }