0

申し訳ありませんが、これは非常に基本的な質問かもしれません。サイズと座標が異なる複数の小さなテクスチャがあり、これにトランジションを適用したいと思います。したがって、これらすべてのテクスチャを大きなテクスチャに組み合わせて、画面サイズの1つのテクスチャを作成する必要があります。

4

3 に答える 3

1

あなたが探しているのはTextureAtlasと呼ばれています

リアルタイムコンピュータグラフィックスでは、テクスチャアトラスは大きな画像、つまり「アトラス」であり、それぞれが3Dオブジェクトの一部のテクスチャである多くの小さなサブ画像を含みます。

グーグル検索はあなたにそれらを生成するための要約とツールを提供します。

于 2011-09-05T10:54:53.643 に答える
0

これをリアルタイムで行う必要がない場合(つまり、ソーステクスチャが変更されない場合)は、お気に入りのグラフィックエディタ(mspaintなど)で行うだけです。


これをゲーム内で実行したい場合は、次の質問を参照してください:XNAのtexture2Dオブジェクトにバッファをレンダリングする

于 2011-09-05T07:09:25.600 に答える
0

タスクに合わせてこれを変更します。

    /// <summary>
    /// Line up the textures in list horizontally. Warning: All textures MUST BE one height and in strong order
    /// </summary>
    /// <param name="device">D3D device</param>
    /// <param name="textures">List of textures</param>
    /// <returns>Combined texture</returns>
    public static Texture LineUpTexturesHorizontally ( Device device, List < Texture > textures )
    {
        int dstWidth = textures.Select ( texture => texture.GetSurfaceLevel ( 0 ) ).Select ( surface => surface.Description.Width ).Sum ( );
        int dstHeight = textures [ 0 ].GetSurfaceLevel ( 0 ).Description.Height;
        Texture dstTexture = CreateTexture ( device, dstWidth, dstHeight, Color.Orange, TexMipLevels, true );
        Surface dstSurface = dstTexture.GetSurfaceLevel ( 0 );
        Point insPoint = new Point ( 0, 0 );
        for ( int i = 0; i < textures.Count; i++ )
        {
            PaletteEntry [ ] pal; // = new PaletteEntry[ 256 ];
            Texture srcTexture = textures [ i ];
            Surface srcSurface = srcTexture.GetSurfaceLevel ( 0 );
            int srcWidth = srcSurface.Description.Width;
            int srcHeight = srcSurface.Description.Height;
            Rectangle srcRectangle = new Rectangle ( 0, 0, srcWidth, srcHeight );
            Rectangle dstRectangle = new Rectangle ( insPoint, new Size ( srcWidth, srcHeight ) );
            SurfaceLoader.FromSurface ( dstSurface, out pal, dstRectangle, srcSurface, out pal, srcRectangle, Filter.None, 0 );
            insPoint.X += srcWidth;
        }
        return dstTexture;
    }
于 2018-09-30T16:13:24.260 に答える