/// <summary>
        /// スプライトの登録(さらに指定スプライトを切り取り&4頂点の色設定ができる)
        /// </summary>
        /// <param name="spDrawing"></param>
        /// <returns>通常、エラーが発生しなかった場合は 0 を返すようにプログラムする。</returns>
        internal int RegistrationDrawingCommand(MCDrawAlphanumericSprite drawSprite)
        {
            //-----------------------------------------------------
            // プライオリティー
            //-----------------------------------------------------
            //
            if (drawSprite.DrawCommandPriority.D2No == MCDrawCommandPriority.D2NO_MAX)
            {
                drawSprite.D2No = m_autoPpriorityNo++;
            }

            drawSprite.D2RenderType = GetSpriteRenderIdx();

            drawSprite.Build();

            //
            m_drawSprites.Add(drawSprite);

            return(App.BatchDrawingMgr.RegisterDrawingCommand(drawSprite));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="spriteDraw"></param>
        /// <param name="pos"></param>
        /// <returns></returns>
        unsafe public int VertexUpdate(MCDrawAlphanumericSprite spriteDraw, out MCVector3 pos)
        {
            int hr = 0;

            pos = new MCVector3();
            int  divNo, tmpNo;
            byte uC;
            MCAlphanumericSprite spSprite = spriteDraw.Sprite;


            float startU, startV, endU, endV;
            float factorU, factorV;
            float startX, startY, fEndX, fEndY;

            float fW         = (spSprite.div.DivW_U * spSprite.Width);
            float fH         = (spSprite.div.DivH_V * spSprite.Height);
            float fCW        = fW * spSprite.charWidth;
            float fLH        = fH * spSprite.lineHeight;
            float deltaHalfW = (float)System.Math.Floor((fCW - fW) * 0.5f);
            float deltaHalfH = (float)System.Math.Floor((fLH - fH) * 0.5f);

            startX = deltaHalfW; // -0.5f;
            startY = deltaHalfH; // +0.5f;

            m_drawTriangleNum  = spriteDraw.Text.Length <= m_maxLength ? spriteDraw.Text.Length : m_maxLength;
            m_drawTriangleNum *= 2;

            // 配置による位置決め
            if ((spriteDraw.AlignFlags & (int)MC_ANC_ALIGN.USE_ALIGN) != 0)
            {
                List <float> vLineWidth = new List <float>();
                float        charWidth = 0, lineH = fH + deltaHalfH * 2.0f;
                float        rectX, rectY, rectWidht, rectHeight;

                rectX      = spriteDraw.Position.X;
                rectY      = spriteDraw.Position.Y;
                rectWidht  = spriteDraw.Box.X;
                rectHeight = spriteDraw.Box.X;

                pos.X = spriteDraw.Position.X + spriteDraw.Anchor.X;
                pos.Y = spriteDraw.Position.Y + spriteDraw.Anchor.Y;

                // 事前に文字の幅高さを計算
                for (int i = 0; i < m_maxLength && i < spriteDraw.Text.Length; ++i)
                {
                    uC = (byte)char.GetNumericValue(spriteDraw.Text[0]);

                    if (uC == 0x0A)
                    {
                        // 改行
                        vLineWidth.Add(charWidth);
                        charWidth = 0;
                        lineH    += fH + deltaHalfH * 2.0f;
                    }
                    else
                    {
                        charWidth += fW + deltaHalfW * 2.0f;
                    }
                }
                vLineWidth.Add(charWidth);

                // 縦軸
                if ((spriteDraw.AlignFlags & (int)MC_ANC_ALIGN.MIDDLE) != 0)
                {   // 縦:中央揃え
                    startY += spriteDraw.Angle.Y - (rectHeight - lineH) * 0.5f;
                }
                else if ((spriteDraw.AlignFlags & (int)MC_ANC_ALIGN.BOTTOM) != 0)
                {   // 下揃え
                    startY += spriteDraw.Angle.Y - (rectHeight - lineH);
                }
                else //if( spriteDraw.AlignFlags & MC_ANC.TOP )
                {   //上揃え
                    startY += spriteDraw.Angle.Y;
                }
                DataStream MappedResource;
                var        box = App.ImmediateContext.MapSubresource(
                    m_vertexBuffer,
                    MapMode.WriteDiscard,
                    SharpDX.Direct3D11.MapFlags.None,
                    out MappedResource);


                MC_VERTEX_PCTx *pV = (MC_VERTEX_PCTx *)MappedResource.DataPointer;

                for (int i = 0; i < m_allVertex; ++i)
                {
                    pV[i].Init();
                }

                bool bLnInit  = false;
                int  nNewLine = 0;
                for (int i = 0; i < m_maxLength && i < spriteDraw.Text.Length; ++i)
                {
                    var pTmp = &pV[i * 4];
                    uC = (byte)char.GetNumericValue(spriteDraw.Text[i]);

                    if (uC <= 0x1F || uC >= 0x7F)
                    {
                        divNo = 0;
                    }
                    else
                    {
                        divNo = m_aAncTable[(int)spSprite.useFlgsANC - 1][uC - 0x20];
                    }

                    if (!bLnInit)
                    {
                        if ((spriteDraw.AlignFlags & (int)MC_ANC_ALIGN.CENTER) != 0)
                        {   // 横:中央揃え
                            startX += (rectWidht - vLineWidth[nNewLine]) * 0.5f - spriteDraw.Angle.X;
                        }
                        else if ((spriteDraw.AlignFlags & (int)MC_ANC_ALIGN.RIGHT) != 0)
                        {   // 右寄り
                            startX += rectWidht - vLineWidth[nNewLine] - spriteDraw.Angle.X;
                        }
                        else //if( spriteDraw.AlignFlags & MC_ANC.LEFT )
                        {   //左寄り
                            startX -= spriteDraw.Angle.X;
                        }
                        bLnInit = true;
                    }
                    if (spSprite.div.Col == 0)
                    {
                        factorV = (1.0f / spSprite.div.Row);

                        startU = 0.0f;
                        startV = factorV * divNo;
                        endU   = 1.0f;
                        endV   = startV + factorV;
                    }
                    else if (spSprite.div.Row == 0)
                    {
                        factorU = (1.0f / spSprite.div.Col);

                        startU = factorU * divNo;
                        startV = 0.0f;
                        endU   = startU + factorU;
                        endV   = 1.0f;
                    }
                    else
                    {
                        tmpNo  = divNo % spSprite.div.Col;
                        startU = spSprite.div.DivW_U * tmpNo;
                        tmpNo  = divNo / spSprite.div.Col;
                        startV = spSprite.div.DivH_V * tmpNo;
                        endU   = startU + spSprite.div.DivW_U;
                        endV   = startV + spSprite.div.DivH_V;
                    }
                    // texturer uv
                    pTmp[0].u = startU; pTmp[0].v = startV;
                    pTmp[1].u = startU; pTmp[1].v = endV;
                    pTmp[2].u = endU; pTmp[2].v = startV;
                    pTmp[3].u = endU; pTmp[3].v = endV;
                    //
                    pTmp[0].c = spriteDraw.Color;
                    pTmp[1].c = spriteDraw.Color;
                    pTmp[2].c = spriteDraw.Color;
                    pTmp[3].c = spriteDraw.Color;
                    //
                    fEndX = startX + fW;
                    fEndY = startY - fH;

                    // 位置
                    pTmp[0].p.X = startX; pTmp[0].p.Y = startY; pTmp[0].p.Z = 0.0f;
                    pTmp[1].p.X = startX; pTmp[1].p.Y = fEndY; pTmp[1].p.Z = 0.0f;
                    pTmp[2].p.X = fEndX; pTmp[2].p.Y = startY; pTmp[2].p.Z = 0.0f;
                    pTmp[3].p.X = fEndX; pTmp[3].p.Y = fEndY; pTmp[3].p.Z = 0.0f;
                    if (uC == 0x0A)
                    {
                        startX  = deltaHalfW;// - 0.5f;
                        startY -= fH + deltaHalfH * 2.0f;
                        bLnInit = false;
                        ++nNewLine;
                    }
                    else
                    {
                        startX += fW + deltaHalfW * 2.0f;
                    }
                }
                App.ImmediateContext.UnmapSubresource(m_vertexBuffer, 0);
            }
            else
            {
                //-----------------------------------------------------
                // 通常
                //-----------------------------------------------------
                pos.X = spriteDraw.Position.X + spriteDraw.Anchor.X;
                pos.Y = spriteDraw.Position.Y + spriteDraw.Anchor.Y;

                DataStream MappedResource;
                var        box = App.ImmediateContext.MapSubresource(
                    m_vertexBuffer,
                    MapMode.WriteDiscard,
                    SharpDX.Direct3D11.MapFlags.None,
                    out MappedResource);


                MC_VERTEX_PCTx *pV = (MC_VERTEX_PCTx *)MappedResource.DataPointer;

                for (int i = 0; i < m_allVertex; ++i)
                {
                    pV[i].Init();
                }

                for (int i = 0; i < m_maxLength && i < spriteDraw.Text.Length; ++i)
                {
                    var pTmp = &pV[i * 4];
                    uC = (byte)spriteDraw.Text[i];

                    if (uC <= 0x1F || uC >= 0x7F)
                    {
                        divNo = 0;
                    }
                    else
                    {
                        divNo = m_aAncTable[(int)spSprite.useFlgsANC - 1][uC - 0x20];
                    }
                    //if( divNo == 0xFFFF )continue;
                    // UV
                    if (spSprite.div.Col == 0)
                    {
                        factorV = (1.0f / spSprite.div.Row);

                        startU = 0.0f;
                        startV = factorV * divNo;
                        endU   = 1.0f;
                        endV   = startV + factorV;
                    }
                    else if (spSprite.div.Row == 0)
                    {
                        factorU = (1.0f / spSprite.div.Col);

                        startU = factorU * divNo;
                        startV = 0.0f;
                        endU   = startU + factorU;
                        endV   = 1.0f;
                    }
                    else
                    {
                        tmpNo  = divNo % spSprite.div.Col;
                        startU = spSprite.div.DivW_U * tmpNo;
                        tmpNo  = divNo / spSprite.div.Col;
                        startV = spSprite.div.DivH_V * tmpNo;
                        endU   = startU + spSprite.div.DivW_U;
                        endV   = startV + spSprite.div.DivH_V;
                    }
                    // texturer uv
                    pTmp[0].u = startU; pTmp[0].v = startV;
                    pTmp[1].u = startU; pTmp[1].v = endV;
                    pTmp[2].u = endU;   pTmp[2].v = startV;
                    pTmp[3].u = endU;   pTmp[3].v = endV;
                    //
                    pTmp[0].c = spriteDraw.Color;
                    pTmp[1].c = spriteDraw.Color;
                    pTmp[2].c = spriteDraw.Color;
                    pTmp[3].c = spriteDraw.Color;
                    //
                    fEndX = startX + fW;
                    fEndY = startY - fH;

                    // 位置
                    pTmp[0].p.X = startX; pTmp[0].p.Y = startY; pTmp[0].p.Z = 0.0f;
                    pTmp[1].p.X = startX; pTmp[1].p.Y = fEndY;  pTmp[1].p.Z = 0.0f;
                    pTmp[2].p.X = fEndX;  pTmp[2].p.Y = startY; pTmp[2].p.Z = 0.0f;
                    pTmp[3].p.X = fEndX;  pTmp[3].p.Y = fEndY;  pTmp[3].p.Z = 0.0f;
                    if (uC == 0x0A)
                    {
                        // 改行
                        startX  = deltaHalfW;// - 0.5f;
                        startY -= fH + deltaHalfH * 2.0f;
                    }
                    else
                    {
                        startX += fW + deltaHalfW * 2.0f;
                    }
                }
                App.ImmediateContext.UnmapSubresource(m_vertexBuffer, 0);
            }

            return(hr);
        }