Example #1
0
        private JobHandle StartParseJob()
        {
            // TODO: how do we get the size?

            /*
             * var parser = new BinaryParser(Bytes.ToArray());
             * parser.Position = 4;
             * Depth = parser.UInt16BE();
             * Width = parser.UInt16BE();
             * Height = parser.UInt16BE();
             *
             * if (Depth < 3)
             *  Depth = 1;
             * if (Depth >= 3)
             *  Depth = parser.UInt16BE();
             *
             * TextureFormat = TextureFormat.RGBA32;
             * if (Depth == 3)
             *  TextureFormat = TextureFormat.RGB24;
             * if (Depth == 1)
             *  TextureFormat = TextureFormat.Alpha8;
             */

            Data     = new NativeArray <byte>(Width * Height * Depth, Allocator.Persistent);
            ParseJob = new ParseJob_ {
                BytesNA = Bytes, DataNA = Data
            };
            return(ParseJob.Schedule());
        }
Example #2
0
        private JobHandle StartParseJob()
        {
            // TODO: this should be another job (maybe)
            var parser = new BinaryParser(Bytes.ToArray());

            parser.Position = 4;
            Depth           = parser.UInt16BE();
            Width           = parser.UInt16BE();
            Height          = parser.UInt16BE();

            if (Depth < 3)
            {
                Depth = 1;
            }
            if (Depth >= 3)
            {
                Depth = parser.UInt16BE();
            }

            TextureFormat = TextureFormat.RGBA32;
            if (Depth == 3)
            {
                TextureFormat = TextureFormat.RGB24;
            }
            if (Depth == 1)
            {
                TextureFormat = TextureFormat.Alpha8;
            }

            Data     = new NativeArray <byte>(Width * Height * Depth, Allocator.Persistent);
            ParseJob = new ParseJob_ {
                BytesNA = Bytes, DataNA = Data
            };
            return(ParseJob.Schedule());
        }
Example #3
0
        private JobHandle StartParseJob()
        {
            // TODO

            //Data = new NativeArray<byte>(Width * Height * Depth, Allocator.Persistent);
            ParseJob = new ParseJob_ {
                BytesNA = Bytes
            };
            return(ParseJob.Schedule());
        }
Example #4
0
        private JobHandle StartParseJob()
        {
            // TODO: this should be another job
            try
            {
                var          tiff  = Tiff.ClientOpen("AsyncTiffReader", "r", new System.IO.MemoryStream(Bytes.ToArray()), new TiffStream());
                FieldValue[] value = tiff.GetField(TiffTag.IMAGEWIDTH);
                Width         = value[0].ToInt();
                value         = tiff.GetField(TiffTag.IMAGELENGTH);
                Height        = value[0].ToInt();
                TextureFormat = TextureFormat.RFloat;
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            Data     = new NativeArray <byte>(Width * Height * sizeof(float), Allocator.Persistent);
            ParseJob = new ParseJob_ {
                BytesNA = Bytes, DataNA = Data
            };
            return(ParseJob.Schedule());
        }