Related Discussions
...

con gli sprite o le mesh, quando carico una texture creo le mipmap e le assegno alla texture.
Come faccio con spine ad usare le mipmap con xna? non ho accesso alle texture
saluti
Cristian

Non lo esponiamo direttamente a quanto pare. Non sono sicuro di come generare mips in fase di esecuzione in XNA. Puoi provare a modificare il codice di caricamento della trama qui per generare anche i livelli della mappa mip:
spine-runtimes/Util.cs at 3.8

We don't expose that directly it seems. I'm unsure how to generate mips at runtime in XNA. You could try modifying the texture loading code here to also generate mip map levels:
spine-runtimes/Util.cs at 3.8

2 年 后

grazie Mario, verifico


Mario :

We don't expose that directly it seems. I'm unsure how to generate mips at runtime in XNA. You could try modifying the texture loading code here to also generate mip map levels:
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/src/Util.cs#L76

I have spend time to test, but although the filter name is read from atlas file, then it is not applied anywhere. May be because I use FNA/Monogame.
ok it's not very important, if I see the need I will implement the code and publish it


ok after 2 year I'm using mipmap 😃
it easy, after create a texture with mipmap I substiture in the Atlas

atlas.Pages(0).rendererObject(0)=texture_with_mipmap

for create mipmap I use this code

Function CreateMipMap( texture As Texture2D) as Texture2D
           Dim newTexture As Texture2D = New Texture2D(Game1.graphics.GraphicsDevice, texture.Width, texture.Height, True, SurfaceFormat.Color)

       For i As Integer = 0 To newTexture.LevelCount - 1
           Dim temptext As Texture2D
           Using fileIn As IO.Stream = TitleContainer.OpenStream(texture.Name)
               temptext = Texture2D.FromStream(graphics.GraphicsDevice, fileIn, texture.Width / CInt(Math.Pow(2, i)), texture.Height / CInt(Math.Pow(2, i)), False)
               Dim size As Integer = (texture.Width / CInt(Math.Pow(2, i))) * (texture.Height / CInt(Math.Pow(2, i)))
               Dim data As Color()
               data = New Color(size - 1) {}
               temptext.GetData(data, 0, size)
               newTexture.SetData(i, Nothing, data, 0, size)
           End Using
       Next
       return newTexture

   End Sub

update

Function CreateMipMap( texture As Texture2D,texturepath as string) as Texture2D
           Dim newTexture As Texture2D = New Texture2D(Game1.graphics.GraphicsDevice, texture.Width, texture.Height, True, SurfaceFormat.Color)

       For i As Integer = 0 To newTexture.LevelCount - 1
            fileIn.Position = 0
           Dim temptext As Texture2D
           Using fileIn As IO.Stream = TitleContainer.OpenStream(texturepath)
               temptext = Texture2D.FromStream(graphics.GraphicsDevice, fileIn, texture.Width / CInt(Math.Pow(2, i)), texture.Height / CInt(Math.Pow(2, i)), False)
               Dim size As Integer = (texture.Width / CInt(Math.Pow(2, i))) * (texture.Height / CInt(Math.Pow(2, i)))
               Dim data As Color()
               data = New Color(size - 1) {}
               temptext.GetData(data, 0, size)
               newTexture.SetData(i, Nothing, data, 0, size)
           End Using
       Next
       return newTexture

   End Sub