コード例 #1
0
        public void StartLoad(EntityManager man, Entity e, ref Image2D image, ref Image2DSTB imgSTB, ref Image2DLoadFromFile fspec, ref Image2DSTBLoading loading)
        {
            // if there are async still loading, but set to new file stop job
            if (loading.internalId != 0)
            {
                ImageIOSTBNativeCalls.AbortLoad(loading.internalId);
            }

            image.status           = ImageStatus.Loading;
            image.hasAlpha         = false;
            image.imagePixelSize.x = 0;
            image.imagePixelSize.y = 0;

            var fnImage = man.GetBufferAsString <Image2DLoadFromFileImageFile>(e);

            if (man.HasComponent <Image2DLoadFromFileImageFile>(e) && fnImage.Length <= 0)
            {
                Debug.LogFormat("The file one entity {1} contains an empty Image2DLoadFromFileImageFile string.", e);
            }
            var fnMask = man.GetBufferAsString <Image2DLoadFromFileMaskFile>(e);

            if (man.HasComponent <Image2DLoadFromFileMaskFile>(e) && fnMask.Length <= 0)
            {
                Debug.LogFormat("The file one entity {1} contains an empty Image2DLoadFromFileMaskFile string.", e);
            }

            loading.internalId = ImageIOSTBNativeCalls.StartLoad(fnImage, fnMask);
        }
コード例 #2
0
ファイル: Image2DIOSTB.cs プロジェクト: isaveu/SimpleUIDemo
        public void StartLoad(EntityManager man, Entity e, ref Image2D image, ref Image2DSTB imgSTB, ref Image2DLoadFromFile fspec, ref Image2DSTBLoading loading)
        {
            // if there are async still loading, but set to new file stop job
            if (loading.internalId != 0)
            {
                ImageIOSTBNativeCalls.AbortLoad(loading.internalId);
            }

            image.status           = ImageStatus.Loading;
            image.imagePixelHeight = 0;
            image.imagePixelWidth  = 0;

            string fnImage = "", fnMask = "";

            if (man.HasComponent <Image2DLoadFromFileGuids>(e))
            {
                var guids = man.GetComponentData <Image2DLoadFromFileGuids>(e);
                // TODO -- call an asset service to actually get some kind of stream from a guid
                if (!guids.imageAsset.Equals(Guid.Empty))
                {
                    fnImage = "Data/" + guids.imageAsset.ToString("N");
                }
                if (!guids.maskAsset.Equals(Guid.Empty))
                {
                    fnMask = "Data/" + guids.maskAsset.ToString("N");
                }
            }
            else
            {
                fnImage = man.GetBufferAsString <Image2DLoadFromFileImageFile>(e);
                if (man.HasComponent <Image2DLoadFromFileImageFile>(e) && fnImage.Length <= 0)
                {
                    Debug.LogFormat("The file one entity {1} contains an empty Image2DLoadFromFileImageFile string.", e);
                }
                fnMask = man.GetBufferAsString <Image2DLoadFromFileMaskFile>(e);
                if (man.HasComponent <Image2DLoadFromFileMaskFile>(e) && fnMask.Length <= 0)
                {
                    Debug.LogFormat("The file one entity {1} contains an empty Image2DLoadFromFileMaskFile string.", e);
                }
            }

            loading.internalId = ImageIOSTBNativeCalls.StartLoad(fnImage, fnMask);
        }