Esempio n. 1
0
                    public void Duplicate(PartsColor original)
                    {
                        Bound     = original.Bound;
                        Operation = original.Operation;
#if ATTRIBUTE_DUPLICATE_DEEP
                        /* MEMO: Deep copy */
                        int countVertex = original.VertexColor.Length;
                        if ((null == VertexColor) || (VertexColor.Length != countVertex))
                        {
                            VertexColor = new Color[countVertex];
                        }
                        for (int i = 0; i < countVertex; i++)
                        {
                            VertexColor[i] = original.VertexColor[i];
                        }

                        if ((null == RateAlpha) || (RateAlpha.Length != countVertex))
                        {
                            RateAlpha = new float[countVertex];
                        }
                        for (int i = 0; i < countVertex; i++)
                        {
                            RateAlpha[i] = original.RateAlpha[i];
                        }
#else
                        /* MEMO: Shallow copy */
                        VertexColor = original.VertexColor;
                        RateAlpha   = original.RateAlpha;
#endif
                    }
Esempio n. 2
0
 public void CleanUp()
 {
     Bound       = Library_SpriteStudio6.KindBoundBlend.NON;
     Operation   = Library_SpriteStudio6.KindOperationBlend.MIX;
     VertexColor = null;
     RateAlpha   = null;
 }
Esempio n. 3
0
    /* ********************************************************* */
    //! Replace Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShader
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	material
     *      New material<br>
     *      null == Remove material (however can't be removed that Project has)
     * @param	flagGlobal
     *      true == Replace material that Project(DataProject) has.<br>
     *      false == Replace material that only this Animation-Object has.
     * @retval	Return-Value
     *      Originally set material<br>
     *      null == Not exist or Error
     *
     * Search and replace material with the specified content among materials currently held.<br>
     * Material to be replaced is identified by "indexCellMap", "operationBlend", "masking", and "shader".<br>
     * If the material cannot be found, this function will return error.<br>
     * <br>
     * Note that changes the material to "material" for drawing, which is determined by "indexCellMap", "operationBlend", "masking", and "nameShader".<br>
     * "indexCellMap", "operationBlend", "masking", and "nameShader" are not parameters of the material to be changed, but keys to identify the material used in the original animation.<br>
     */
    public UnityEngine.Material MaterialReplace(int indexCellMap,
                                                Library_SpriteStudio6.KindOperationBlend operationBlend,
                                                Library_SpriteStudio6.KindMasking masking,
                                                string nameShader,
                                                UnityEngine.Material material,
                                                bool flagGlobal = false
                                                )
    {
        if (null == DataAnimation)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (false == flagGlobal)
        {
            if (true == TextureCheckOverride(indexCellMap))
            {                   /* Texture Overrided */
                return(CacheMaterial.MaterialReplaceAnimation(indexCellMap,
                                                              operationBlend,
                                                              masking,
                                                              nameShader,
                                                              material
                                                              )
                       );
            }

            return(null);
        }

        if (null == material)
        {
            /* MEMO: Prohibited to remove material that Project has. */
            return(null);
        }
        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }
        Script_SpriteStudio6_DataProject dataProject = DataAnimation.DataProject;

        if (null == dataProject)
        {
            return(null);
        }

        /* MEMO: The texture used in calculating hashcode to identify  material must be it stored in the project. */
        return(dataProject.MaterialReplaceAnimation(indexCellMap,
                                                    operationBlend,
                                                    masking,
                                                    nameShader,
                                                    material
                                                    )
               );
    }
Esempio n. 4
0
 /* ----------------------------------------------- Functions */
 #region Functions
 public PartsColor(Library_SpriteStudio6.KindBoundBlend bound,
                   Library_SpriteStudio6.KindOperationBlend operation,
                   Color[] vertexColor,
                   float[] rateAlpha
                   )
 {
     Bound       = bound;
     Operation   = operation;
     VertexColor = vertexColor;
     RateAlpha   = rateAlpha;
 }
Esempio n. 5
0
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShader
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	shader
     *      Shader applied<br>
     *      null == Default(Standard) shader
     * @param	flagCreateNew
     *      true == If not exist, create.
     *      false == If not exist, return null.
     * @retval	Return-Value
     *      Instance of Material
     *      null == Not exist or Error
     *
     * Search material with the specified content among materials currently held.<br>
     * Materials (held by Animation-Object) are affected by currently playback state
     *      since materials are dynamically generated.<br>
     * Materials will not be created until Play-Cursor reachs actually using material,
     *      and once it is created, those will be retained until Animation-Object is destroyed.<br>
     */
    public UnityEngine.Material MaterialGet(int indexCellMap,
                                            Library_SpriteStudio6.KindOperationBlend operationBlend,
                                            Library_SpriteStudio6.KindMasking masking,
                                            string nameShader,
                                            UnityEngine.Shader shader,
                                            bool flagCreateNew
                                            )
    {
        if (null == DataAnimation)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (true == TextureCheckOverride(indexCellMap))
        {               /* Texture Overrided */
            return(CacheMaterial.MaterialGetAnimation(indexCellMap,
                                                      operationBlend,
                                                      masking,
                                                      nameShader,
                                                      shader,
                                                      TableTexture,
                                                      flagCreateNew
                                                      )
                   );
        }

        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }

        Script_SpriteStudio6_DataProject dataProject = DataAnimation.DataProject;

        if (null == dataProject)
        {
            return(null);
        }
        return(dataProject.MaterialGetAnimation(indexCellMap,
                                                operationBlend,
                                                masking,
                                                nameShader,
                                                shader,
                                                flagCreateNew
                                                )
               );
    }
        /* ********************************************************* */
        //! Get Material-Table's index

        /*!
         * @param	indexCellMap
         *      index of CellMap
         * @param	operationBlend
         *      Kind of Blending
         * @param	masking
         *      Kind of Masking
         * @retval	Return-Value
         *      index of Material-Table
         *
         * Get material's index in Material-Table.<br>
         * Caution that this function does not check upper-limit of "indexCellMap".
         */
        public static int IndexGetTable(int indexCellMap,
                                        Library_SpriteStudio6.KindOperationBlend operationBlend,
                                        Library_SpriteStudio6.KindMasking masking
                                        )
        {
            if ((0 > indexCellMap) ||
                (Library_SpriteStudio6.KindOperationBlend.INITIATOR > operationBlend) || (Library_SpriteStudio6.KindOperationBlend.TERMINATOR <= operationBlend) ||
                (Library_SpriteStudio6.KindMasking.THROUGH > masking) || (Library_SpriteStudio6.KindMasking.TERMINATOR <= masking)
                )
            {
                return(-1);
            }

            return((((indexCellMap * (int)Library_SpriteStudio6.KindMasking.TERMINATOR) + (int)masking) * (int)Library_SpriteStudio6.KindOperationBlend.TERMINATOR_TABLEMATERIAL) + ((int)operationBlend - (int)Library_SpriteStudio6.KindOperationBlend.INITIATOR));
        }
Esempio n. 7
0
                    public void BootUp(int countVertex)
                    {
                        Bound     = Library_SpriteStudio6.KindBoundBlend.NON;
                        Operation = Library_SpriteStudio6.KindOperationBlend.MIX;

                        VertexColor = new Color[countVertex];
                        for (int i = 0; i < countVertex; i++)
                        {
                            VertexColor[i] = ColorClear;
                        }

                        RateAlpha = new float[countVertex];
                        for (int i = 0; i < countVertex; i++)
                        {
                            RateAlpha[i] = 1.0f;
                        }
                    }
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get Material

    /*!
     * @param	indexCellMap
     *      Serial-number of using CellMap
     * @param	operationBlend
     *      Blend Operation for the target
     * @retval	Return-Value
     *      Material
     *
     * Get specified material in TableMaterial.
     */
    public UnityEngine.Material MaterialGet(int indexCellMap,
                                            Library_SpriteStudio6.KindOperationBlend operationBlend,
                                            Library_SpriteStudio6.KindMasking masking
                                            )
    {
        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }

        int indexMaterial = Material.IndexGetTable(indexCellMap, operationBlend, masking);

        if (0 > indexMaterial)
        {
            return(null);
        }

        return(TableMaterial[indexMaterial]);
    }
Esempio n. 9
0
    /* ********************************************************* */
    //! Replace Material (for "Animation")

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blending Operation
     * @param	masking
     *      Masking type
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	material
     *      New material
     * @retval	Return-Value
     *      Originally set material<br>
     *      false == Failure (Error)
     *
     * Replaces already defined material for purpose identified by
     *      "shader", "texture", "operaTionBlend" ​and "masking"
     *      with "materialNew".<br>
     * <br>
     * If target material cannot be found, this function will fail.
     */
    internal UnityEngine.Material MaterialReplaceAnimation(int indexCellMap,
                                                           Library_SpriteStudio6.KindOperationBlend operationBlend,
                                                           Library_SpriteStudio6.KindMasking masking,
                                                           string nameShader,
                                                           UnityEngine.Material material
                                                           )
    {
        if (null == CacheMaterialAnimation)
        {
            return(null);
        }

        return(CacheMaterialAnimation.MaterialReplaceAnimation(indexCellMap,
                                                               operationBlend,
                                                               masking,
                                                               nameShader,
                                                               material
                                                               )
               );
    }
Esempio n. 10
0
    /* ********************************************************* */
    //! Get Material (for "Animation")

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blending Operation
     * @param	nameShader
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	shader
     *      Shader
     * @param	masking
     *      Masking type
     * @param	flagCreateNew
     *      true == If not exist, create.
     *      false == If not exist, return null.
     * @retval	Return-Value
     *      Instance of Material
     *      null == Not exist or Error
     *
     * Get specified-spec material (for "Animation").<br>
     * <br>
     * If existing, return that has already created (Will not create
     *      multiple of same material).<br>
     * If not existing, material will be created and returned.<br>
     */
    internal UnityEngine.Material MaterialGetAnimation(int indexCellMap,
                                                       Library_SpriteStudio6.KindOperationBlend operationBlend,
                                                       Library_SpriteStudio6.KindMasking masking,
                                                       string nameShader,
                                                       Shader shader,
                                                       bool flagCreateNew
                                                       )
    {
        if (null == CacheMaterialAnimation)
        {
            return(null);
        }

        return(CacheMaterialAnimation.MaterialGetAnimation(indexCellMap,
                                                           operationBlend,
                                                           masking,
                                                           nameShader,
                                                           shader,
                                                           TableTexture,
                                                           flagCreateNew
                                                           )
               );
    }