Exemplo n.º 1
0
        /// <summary>
        /// Read the contents of a create message for a <c>MeshSet</c>.
        /// </summary>
        /// <param name="reader">Stream to read from</param>
        /// <returns>True on success.</returns>
        /// <remarks>
        /// Reads additional data for the cloud and the cloud mesh ID. The cloud mesh is represented
        /// by a <see cref="PlaceholderMesh"/> as real mesh data cannot be resolved here.
        /// </remarks>
        public override bool ReadCreate(PacketBuffer packet, BinaryReader reader)
        {
            if (!base.ReadCreate(packet, reader))
            {
                return(false);
            }

            uint cloudID    = reader.ReadUInt32();
            uint indexCount = reader.ReadUInt32();

            PointCloud = new PlaceholderMesh(cloudID);
            _indices   = (indexCount > 0) ? new uint[indexCount] : null;

            if (packet.Header.VersionMajor != 0 || packet.Header.VersionMajor == 0 && packet.Header.VersionMinor >= 2)
            {
                PointScale = reader.ReadSingle();
            }
            else
            {
                // Legacy support
                byte pointSize = reader.ReadByte();
                PointScale = (float)pointSize;
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read the contents of a create message for a <c>MeshSet</c>.
        /// </summary>
        /// <param name="reader">Stream to read from</param>
        /// <returns>True on success.</returns>
        /// <remarks>
        /// Reads additional data for the cloud and the cloud mesh ID. The cloud mesh is represented
        /// by a <see cref="PlaceholderMesh"/> as real mesh data cannot be resolved here.
        /// </remarks>
        public override bool ReadCreate(BinaryReader reader)
        {
            if (!base.ReadCreate(reader))
            {
                return(false);
            }

            uint cloudID    = reader.ReadUInt32();
            uint indexCount = reader.ReadUInt32();
            byte pointSize  = reader.ReadByte();

            PointCloud = new PlaceholderMesh(cloudID);
            _indices   = (indexCount > 0) ? new uint[indexCount] : null;
            PointSize  = pointSize;

            return(true);
        }