Поделиться через


Texture - класс

Обновлен: Ноябрь 2007

Управляет текстурными ресурсами.

Пространство имен:  Microsoft.WindowsMobile.DirectX.Direct3D
Сборка:  Microsoft.WindowsMobile.DirectX (в Microsoft.WindowsMobile.DirectX.dll)

Синтаксис

'Декларация
Public Class Texture _
    Inherits BaseTexture _
    Implements IDisposable
'Применение
Dim instance As Texture
public class Texture : BaseTexture, IDisposable
public ref class Texture : public BaseTexture, 
    IDisposable
public class Texture extends BaseTexture implements IDisposable

Заметки

Этот объект наследует свойства объекта BaseTexture.

Примеры

Следующий пример кода показывает, как используется текстура.

' This code example is taken from the
' Direct3D Mobile Texture Sample included with the
' .NET Compact Framework samples.

' Called whenever the rendering device is reset.
Friend Sub OnResetDevice(ByVal sender As Object, ByVal e As EventArgs)
    Dim dev As Device = CType(sender, Device)
    ' Turn off culling, so we see the front and back of the triangle.
    dev.RenderState.CullMode = Cull.None
    ' Turn off D3D lighting.
    dev.RenderState.Lighting = False
    ' Turn on the ZBuffer.
    dev.RenderState.ZBufferEnable = True
    ' Turn on perspective correction for textures.
    ' This provides a more accurate visual at the cost
    ' of a small performance overhead.
    dev.RenderState.TexturePerspective = True
    ' Now create the texture.
    texture = TextureLoader.FromStream(dev, _
      [Assembly].GetExecutingAssembly().GetManifestResourceStream("Texture.Content.Banana.bmp"))

End Sub

// This code example is taken from the
// Direct3D Mobile Texture Sample included with the
// .NET Compact Framework samples.

// Called whenever the rendering device is reset.
void OnResetDevice(object sender, EventArgs e)
{
    Device dev = (Device)sender;
    // Turn off culling, so we see the front and back of the triangle
    dev.RenderState.CullMode = Cull.None;
    // Turn off D3D lighting
    dev.RenderState.Lighting = false;
    // Turn on the ZBuffer
    dev.RenderState.ZBufferEnable = true;
    // Turn on perspective correction for textures
    // This provides a more accurate visual at the cost
    // of a small performance overhead
    dev.RenderState.TexturePerspective = true;
    // Now create our texture

    texture = TextureLoader.FromStream(dev,
        Assembly.GetExecutingAssembly().GetManifestResourceStream(
        "Texture.Content.Banana.bmp"));
}

Иерархия наследования

System.Object
  Microsoft.WindowsMobile.DirectX.Direct3D.Resource
    Microsoft.WindowsMobile.DirectX.Direct3D.BaseTexture
      Microsoft.WindowsMobile.DirectX.Direct3D.Texture

Потокобезопасность

Любые открытые члены этого типа, объявленные как static (Shared в Visual Basic), являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.

Платформы

Windows CE, Windows Mobile for Smartphone, Windows Mobile для карманных ПК

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Compact Framework

Поддерживается в версиях: 3.5, 2.0

См. также

Ссылки

Texture - члены

Microsoft.WindowsMobile.DirectX.Direct3D - пространство имен

Другие ресурсы

Мобильное программирование Direct3D в .NET Compact Framework