Exemplo n.º 1
0
        public virtual bool HandleDirtyUpdate(UMAData data)
        {
            umaData = data;
            if (umaData.isMeshDirty)
            {
                if (!umaData.isTextureDirty)
                {
                    UpdateUMAMesh(false);
                }
                umaData.isMeshDirty = false;
            }
            if (umaData.isTextureDirty)
            {
                if( activeGeneratorCoroutine == null )
                {
                    activeGeneratorCoroutine = umaGeneratorCoroutine;
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    if (usePRO)
                    {
                        textureProcessCoroutine = new TextureProcessPROCoroutine();
                        textureProcessCoroutine.Prepare(data, this);
                    }
                    else
                    {
                        textureProcessCoroutine = new TextureProcessIndieCoroutine();
                    }
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine);
                }

                if (umaGeneratorCoroutine.Work())
                {
                    activeGeneratorCoroutine = null;
                    UpdateUMAMesh(true);
                    umaData.isTextureDirty = false;
                }
                else
                {
                    return false;
                }
            }
            else if (umaData.isShapeDirty)
            {
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;

                UMAReady();
                return true;

            }
            else
            {
                UMAReady();
                return true;
            }
            return false;
        }
Exemplo n.º 2
0
        protected override void Start()
        {
            backUpTexture = umaGenerator.umaData.backUpTextures();
            umaGenerator.umaData.cleanTextures();

            materialDefinitionList = new List<UMAData.MaterialDefinition>();

            //Update atlas area can be handled here
            UMAData.MaterialDefinition tempMaterialDefinition = new UMAData.MaterialDefinition();

            SlotData[] slots = umaGenerator.umaData.umaRecipe.slotDataList;
            for(int i = 0; i < slots.Length; i++){
                if(slots[i] != null){
                    tempMaterialDefinition = new UMAData.MaterialDefinition();
                    tempMaterialDefinition.baseTexture = slots[i].GetOverlay(0).textureList;
                    tempMaterialDefinition.baseColor = slots[i].GetOverlay(0).color;
                    tempMaterialDefinition.materialSample = slots[i].materialSample;
                    tempMaterialDefinition.overlays = new UMAData.textureData[slots[i].OverlayCount -1];
                    tempMaterialDefinition.overlayColors = new Color32[tempMaterialDefinition.overlays.Length];
                    tempMaterialDefinition.rects = new Rect[tempMaterialDefinition.overlays.Length];
                    tempMaterialDefinition.channelMask = new Color32[tempMaterialDefinition.overlays.Length+1][];
                    tempMaterialDefinition.channelAdditiveMask = new Color32[tempMaterialDefinition.overlays.Length+1][];
                    tempMaterialDefinition.channelMask[0] = slots[i].GetOverlay(0).channelMask;
                    tempMaterialDefinition.channelAdditiveMask[0] = slots[i].GetOverlay(0).channelAdditiveMask;
                    tempMaterialDefinition.slotData = slots[i];

                    for(int overlayID = 0; overlayID < slots[i].OverlayCount-1; overlayID++){
                        tempMaterialDefinition.overlays[overlayID] = new UMAData.textureData();
                        tempMaterialDefinition.rects[overlayID] = slots[i].GetOverlay(overlayID+1).rect;
                        tempMaterialDefinition.overlays[overlayID].textureList = slots[i].GetOverlay(overlayID+1).textureList;
                        tempMaterialDefinition.overlayColors[overlayID] = slots[i].GetOverlay(overlayID+1).color;
                        tempMaterialDefinition.channelMask[overlayID+1] = slots[i].GetOverlay(overlayID + 1).channelMask;
                        tempMaterialDefinition.channelAdditiveMask[overlayID+1] = slots[i].GetOverlay(overlayID + 1).channelAdditiveMask;
                    }

                    materialDefinitionList.Add(tempMaterialDefinition);
                }
            }

            if(umaGenerator.usePRO){
                textureProcessPROCoroutine = new TextureProcessPROCoroutine();
            }else{
                textureProcessIndieCoroutine = new TextureProcessIndieCoroutine();
            }

            packTexture = new MaxRectsBinPack(umaGenerator.atlasResolution,umaGenerator.atlasResolution,false);
        }
Exemplo n.º 3
0
        public virtual bool HandleDirtyUpdate(UMAData data)
        {
            if (umaData != data)
            {
                umaData = data;
                if (!umaData.Validate())
                {
                    return(true);
                }
            }

            if (umaData.isMeshDirty)
            {
                if (!umaData.isTextureDirty)
                {
                    UpdateUMAMesh(false);
                }
                umaData.isMeshDirty = false;
            }
            if (umaData.isTextureDirty)
            {
                if (activeGeneratorCoroutine == null)
                {
                    activeGeneratorCoroutine = umaGeneratorCoroutine;
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    if (usePRO)
                    {
                        textureProcessCoroutine = new TextureProcessPROCoroutine();
                        textureProcessCoroutine.Prepare(data, this);
                    }
                    else
                    {
                        textureProcessCoroutine = new TextureProcessIndieCoroutine();
                    }
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine);
                }

                if (umaGeneratorCoroutine.Work())
                {
                    activeGeneratorCoroutine = null;
                    UpdateUMAMesh(true);
                    umaData.isTextureDirty = false;
                }
                else
                {
                    return(false);
                }
            }
            else if (umaData.isShapeDirty)
            {
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;

                UMAReady();
                return(true);
            }
            else
            {
                UMAReady();
                return(true);
            }
            return(false);
        }