コード例 #1
0
ファイル: pb_Object.cs プロジェクト: itubeasts/I-eaT-U
	/**
	 *	\brief Duplicates and returns the passed pb_Object.
	 *	@param pb The pb_Object to duplicate.
	 *	\returns A unique copy of the passed pb_Object.
	 */
	public static pb_Object InitWithObject(pb_Object pb)
	{
		Vector3[] v = new Vector3[pb.vertexCount];
		System.Array.Copy(pb.vertices, v, pb.vertexCount);
		
		Vector2[] u = new Vector2[pb.vertexCount];
		System.Array.Copy(pb.uv, u, pb.vertexCount);

		Color[] c = new Color[pb.vertexCount];
		System.Array.Copy(pb.colors, c, pb.vertexCount);

		pb_Face[] f = new pb_Face[pb.faces.Length];
		
		for(int i = 0; i < f.Length; i++)
			f[i] = new pb_Face(pb.faces[i]);

		pb_Object p = CreateInstanceWithElements(v, u, c, f, pb.GetSharedIndices(), pb.GetSharedIndicesUV());

		p.gameObject.name = pb.gameObject.name + "-clone";

		return p;
	}
コード例 #2
0
ファイル: pb_Object.cs プロジェクト: itubeasts/I-eaT-U
    /**
     *	\brief Duplicates and returns the passed pb_Object.
     *	@param pb The pb_Object to duplicate.
     *	\returns A unique copy of the passed pb_Object.
     */
    public static pb_Object InitWithObject(pb_Object pb)
    {
        Vector3[] v = new Vector3[pb.vertexCount];
        System.Array.Copy(pb.vertices, v, pb.vertexCount);

        Vector2[] u = new Vector2[pb.vertexCount];
        System.Array.Copy(pb.uv, u, pb.vertexCount);

        Color[] c = new Color[pb.vertexCount];
        System.Array.Copy(pb.colors, c, pb.vertexCount);

        pb_Face[] f = new pb_Face[pb.faces.Length];

        for (int i = 0; i < f.Length; i++)
        {
            f[i] = new pb_Face(pb.faces[i]);
        }

        pb_Object p = CreateInstanceWithElements(v, u, c, f, pb.GetSharedIndices(), pb.GetSharedIndicesUV());

        p.gameObject.name = pb.gameObject.name + "-clone";

        return(p);
    }