Visual3D Game EngineAPI Documentation for XNA, C#, VB, and .NET
Assembly: Visual3D.Engine (in Visual3D.Engine.dll) Version: 1.0.0.0 (1.0.0.0)
Manages texture resource and provide properties and methods
to obtain texture info and get/set it's content.
Namespace: Visual3D.Graphics3DAssembly: Visual3D.Engine (in Visual3D.Engine.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# | Visual Basic |
public class Texture : MediaAsset, ILinkedEntity, IOwned, IHasDescription
Public Class Texture _ Inherits MediaAsset _ Implements ILinkedEntity, IOwned, IHasDescription
Members
| All Members | Constructors | Fields | Properties | Methods | Events |
| Member | Description | |
|---|---|---|
| Texture(String) | Creates a texture which loads from a file. For manual texture
types use other constructor overloads. | |
| Texture(String, Int32) | Creates a texture which loads from a file. For manual texture
types use other constructor overloads. | |
| Texture(String, TextureType, Int32, Int32, SurfaceFormat) | Creates a manual texture. | |
| Texture(String, TextureType, Int32, Int32, SurfaceFormat, Int32) | Creates a manual texture. | |
| Texture(String, TextureType, Boolean, Int32, Int32, SurfaceFormat, Int32, Int32) | Creates a manual or loadable texture. | |
| AsBitmap()()()() | NOTE WARNING: Caller must ReleaseBitmapDataToPool() when done.
| |
| AssetID | (Inherited from Registered.) | |
| AssetInfo | (Inherited from Registered.) | |
| AssetOwner | Gets or sets the owner to which this asset belongs and is a member of. (Inherited from Asset.) | |
| AttachedToOwner(IComponentOwner) | (Inherited from EntityComponent.) | |
| BaseAsset | (Inherited from Registered.) | |
| BitmapFromFileWithGC(Function<(Of <<'(Bitmap>)>>)) | ||
| BitmapFromPool(Int32, Int32) | Allocate empty bitmap, from Pooled memory. Caller should ReleaseBitmapDataToPool when done using.
| |
| BitmapFromTexture(Texture) | Might save to temp file. Returns null if fails.
Caller should ReleaseBitmapDataToPool when done.
NOTE WARNING: Need ReleaseBitmapDataToPool() or Dispose() bitmap when done, to release hold on temp file, so file can be changed on next call!
| |
| BitmapFromTexture2D(Texture2D, Boolean, Boolean) | Caller should ReleaseBitmapDataToPool when done using.
| |
| BitmapToTexture2D(Texture2D, Bitmap) | "bm" must have PixelFormat.Format32bppArgb.
| |
| ByteDataFromTexture2D(Texture2D, Boolean, Boolean, Int32%) | "forceOpaque" sets all alpha fields to 255.
"isShortLived" is hint to pooled storage. Use "false" if not sure.
"stride" = # bytes per texture row.
Note that Buffer.Array is permitted to be larger than nBytes. Buffer.Count gives logical length (==nBytes).
| |
| ByteDataToTexture2D(Texture2D, Buffer<(Of <<'(Byte>)>>), Int32) | buffer must have same height as texture.
| |
| BytesPerPixel4 | ||
| CanUnload()()()() | (Overrides MediaAssetCanUnload()()()().) | |
| ComponentOwner | Owner of this component (contained in it's ".Components" container). (Inherited from EntityComponent.) | |
| Components | Components that are attached to this Entity. (Inherited from ComponentBase.) | |
| ComponentsForGlobalSceneFolders | (Inherited from ComponentBase.) | |
| Context | Defines the Owner of this component as well as the role (i.e. 'slot') that this component fulfills. (Inherited from ComponentBase.) | |
| CopyWithStride(array<Byte>[]()[][], Int32, Int32, array<Byte>[]()[][], Int32) | SIDE-EFFECT: dstData receives srcData, with stride conversion.
Both dstData and srcData must have same "height".
If srcStride lt dstStride, extra contents of each row are left untouched.
| |
| CreateIdentity()()()() | (Inherited from Registered.) | |
| CreateIdentityList()()()() | (Inherited from Registered.) | |
| CreateInstance(Boolean) | Creates an instance or non-inheriting duplicate of this asset. (Inherited from Asset.) | |
| CreateNewTexture2D(String, GraphicsDevice, Int32, Int32, Int32, TextureUsage, SurfaceFormat) | ||
| CreatePreviewImageFile(String) | ||
| CreatePreviewImageFile(AssetFile) | ||
| CreateService<(Of <<'(TService>)>>)()()()() | (Inherited from ComponentBase.) | |
| DefaultNumMipMaps | ||
| DefaultTextureFileName | ||
| DefaultTextureSize | ||
| DetachedFromOwner(IComponentOwner) | (Inherited from EntityComponent.) | |
| Dispose()()()() | (Inherited from ComponentBase.) | |
| Disposed | (Inherited from ComponentBase.) | |
| DisposeXnaTexture(String, Texture) | ||
| EnsureLoaded2DTexture()()()() | ||
| Format | Gets/sets color format of texture.
Setting this property to new value will recreate texture or reload texture from disk. | |
| GenerateElevationMapMipMaps(Texture%) | ||
| GenerateNormalMapMipMaps(Texture%) | ||
| GetAverageColor(array<Byte>[]()[][], Int32, Int32, Int32) | Average of R,G,B components of pixels in src. BGRA src.
| |
| GetAverageColor(array<Byte>[]()[][], Int32, Int32, Int32, Byte%, Byte%, Byte%) | Average of R,G,B components of pixels in src. BGRA src.
| |
| GetAverageColor(array<Byte>[]()[][], Int32, Int32, Int32, Int32, Int32, Byte%, Byte%, Byte%) | Averages R,G,B components of pixels in rectangle (xMin..xMax, yMin..yMax). BGRA src.
| |
| GetAverageColorLim(array<Byte>[]()[][], Int32, Int32, Int32, Int32, Int32, Byte%, Byte%, Byte%) | Example of efficient access to multiple pixels, without calling PixelByteIndex4 each access. BGRA src.
Averages R,G,B components of pixels in rectangle (xMin..xLim-1, yMin..yLim-1).
NOTE: "x/yLim" are one PAST the last pixel to be averaged.
| |
| GetBytesPerPixel(SurfaceFormat) | ||
| GetBytesPerPixel(SurfaceFormat, Boolean) | ||
| GetContent()()()() | (Overrides MediaAssetGetContent()()()().) | |
| GetContent(Boolean, Texture..::..CompressionKind) | ||
| GetData<(Of <<'(T>)>>)(array<T>[]()[][]) | (For 2D and 3D textures only). Copies texture data into an array at mipmap level 0. | |
| GetData<(Of <<'(T>)>>)(CubeMapFace, array<T>[]()[][]) | (For Cube textures only). Copies texture data into an array at mipmap level 0. | |
| GetData<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32) | (For 2D and 3D textures only). Copies texture data into an array at mipmap level 0, specifying a start offset. | |
| GetData<(Of <<'(T>)>>)(CubeMapFace, array<T>[]()[][], Int32, Int32) | (For Cube textures only). Copies texture data into an array at mipmap level 0, specifying a start offset. | |
| GetData<(Of <<'(T>)>>)(Int32, Nullable<(Of <<'(Rectangle>)>>), array<T>[]()[][], Int32, Int32) | (For 2D textures only). Copies texture data into an array, specifying the dimensions of the area
and the mipmap level where the data are be placed. | |
| GetData<(Of <<'(T>)>>)(CubeMapFace, Int32, Nullable<(Of <<'(Rectangle>)>>), array<T>[]()[][], Int32, Int32) | (For Cube textures only). Copies texture data into an array, specifying the dimensions of the area
and the mipmap level where the data are placed. | |
| GetData<(Of <<'(T>)>>)(Int32, Int32, Int32, Int32, Int32, Int32, Int32, array<T>[]()[][], Int32, Int32) | (For 3D textures only). Copies texture data into an array, specifying the dimensions of the volume
and the mipmap level where the data are placed. | |
| GetDataAlternate(Rectangle, Byte*) | Alternate way to read data from texture - uses Direct3D call instead of XNA. | |
| GetDataAlternate(Rectangle, array<Byte>[]()[][]) | Alternate way to read data from texture - uses Direct3D call instead of XNA. | |
| GetDataAlternate(Int32, Rectangle, Byte*) | Alternate way to read data from texture - uses Direct3D call instead of XNA. | |
| GetDataAlternate(Texture2D, String, SurfaceFormat, Int32, Rectangle, Byte*) | ||
| GetDescription()()()() | (Overrides MediaAssetGetDescription()()()().) | |
| GetFormatInfo()()()() | ||
| GetImageFromFile(String) | ||
| GetPixel(array<Byte>[]()[][], Int32, Int32, Int32, Byte%, Byte%, Byte%, Byte%) | TODO: Untested. BGRA src.
| |
| GetPixelValue(PixelPosition, Vector4%) | ||
| GetRealFilePath()()()() | ||
| GetRealFilePath(TextureAssetFile%) | ||
| GetService<(Of <<'(TService>)>>)()()()() | (Inherited from ComponentBase.) | |
| GetService<(Of <<'(TService>)>>)(TService%) | (Inherited from ComponentBase.) | |
| GetSizeInBytes(Int32, Int32, TextureType, Int32, Int32, SurfaceFormat) | Returns size of texture content with specified parameters, in bytes. | |
| GetTextureFromFileOrLibrary(String) | ||
| GetVideoDevice()()()() |
VideoDevice of current videostream
| |
| GetVideoType()()()() |
VideoType of current videostream
| |
| GetXnaTexture(Boolean) | ||
| GetXnaTexture2DFromFile(GraphicsDevice, String) | ||
| GetXnaTexture2DFromFile(GraphicsDevice, String, TextureCreationParameters) | ||
| GetXnaTexture2DFromFile(GraphicsDevice, String, Int32, Int32) | ||
| GetXnaTexture3DFromFile(GraphicsDevice, String) | ||
| GetXnaTextureForRenderer()()()() | ||
| GetXnaTextureFromFile(GraphicsDevice, String) | ||
| GetXnaTextureFromFile(GraphicsDevice, String, TextureCreationParameters) | ||
| GetXnaTextureFullyLoaded()()()() | ||
| GraphEventsTimeout |
Timeout for Graph Events, in milliseconds. (Default = 500)
| |
| Handle | (Inherited from Registered.) | |
| HasAlphaChannel | Returns true, if texture has format with alpha channel. | |
| HasComponents | (Inherited from ComponentBase.) | |
| HasHandle | (Inherited from Registered.) | |
| HasName | (Inherited from EntityComponent.) | |
| HasOwner<(Of <<'(TOwner>)>>)(IOwned) | (Inherited from EntityExtensions.) | |
| HasOwner<(Of <<'(TOwner>)>>)(IOwned, TOwner%) | (Inherited from EntityExtensions.) | |
| HasOwner<(Of <<'(TOwner>)>>)(IOwned, TOwner%, Boolean) | (Inherited from EntityExtensions.) | |
| HasPrototype | Gets if a prototype has been specified to inherit instance data from. (Inherited from Asset.) | |
| HasScope | (Inherited from Registered.) | |
| HasUniqueName | Gets if a UniqueName is specified to identify this asset with respect to its owner's other members. (Inherited from Registered.) | |
| Height | Gets/sets a height of texture in pixels.
Setting this property to new value will recreate texture or reload texture from disk. | |
| ID | (Inherited from Registered.) | |
| IDChanged | (Inherited from Registered.) | |
| Initialize()()()() | Initializes the asset so that it might be prepared for use.
By default, PrepareForUse() is called from this method as well. (Inherited from Asset.) | |
| IsCompressedFormat(SurfaceFormat) | Returns true, if surface format is compressed (one of DXT formats). | |
| IsDeserialized | Indicates if Instance was created by Deserialization. (Inherited from ComponentBase.) | |
| IsDisposed | Indicates if resource has been disposed. (Inherited from Asset.) | |
| IsDisposing | Indicates if resource is in process of Disposing but not fully disposed. (Inherited from Asset.) | |
| IsFormatLocked | ||
| IsInitialized | Gets if this entity is currently in an initialized (and non-disposed) state. (Inherited from Asset.) | |
| IsInUse | When true, won't be unloaded by ContentPagingService.
| |
| IsLoadingInProgress | ||
| IsManual | Gets flag indicating that XNA texture is created manually
instead of loading from file. Corresponds to isManual flag passed to Texture constructor. | |
| IsPrototype | (Inherited from Asset.) | |
| IsReadyForUse | Gets/sets if asset is ready to be used.
Can be set to 'true' in class constructor in order to skip Preparation logic. (Inherited from Asset.) | |
| IsSaved | Indicates if the component is to be Saved when the owning context is saved
(e.g. for components in your scene, this controls whether or not they are saved to the scene file when the scene is saved).
Typically objects are 'Saved', unless they are transient to be programmatically created each time. (Inherited from ComponentBase.) | |
| IsSavedOnCreatingInstance | (Inherited from Asset.) | |
| IsVideoTexture | ||
| LoadInBackgroundByDefault | ||
| LoadInBackgroundForRendering | ||
| LockFormat()()()() | ||
| LockFormat(SurfaceFormat) | ||
| MaxTexturePreviewSize | ||
| Name | (Inherited from EntityComponent.) | |
| NameID | (Inherited from EntityComponent.) | |
| NumLayers | Returns number of layers for 3D texture.
For 2D and 1D textures returns 1. For cube textures returns 6. | |
| NumMipLevels | Returns number of MIP levels in loaded texture. | |
| OnMemberwiseClone()()()() | (Inherited from ComponentBase.) | |
| OwnerActivated(IComponentOwner) | (Inherited from EntityComponent.) | |
| OwnerDeactivated(IComponentOwner) | (Inherited from EntityComponent.) | |
| OwnerOf<(Of <<'(TOwner>)>>)()()()() | (Inherited from Registered.) | |
| PauseVideoPlayback()()()() |
Pause the Video Playback.
| |
| PixelByteIndex4(Int32, Int32, Int32) | ||
| PrepareForUse()()()() | Attempts to prepare asset for use. To be sure, check "IsReadyForUse"
after calling this method to ensure it's really ready for use before using it. (Inherited from Asset.) | |
| Prototype | Gets or sets the prototype, if specified, from which this asset inherits instance data. (Inherited from Asset.) | |
| ReleaseBitmapDataToPool(Bitmap%) | Matches BitmapFromTexture2D's Memory.AllocateArrayPooledOversize.
Even if wasn't from pool, bm.Dispose() is still useful.
| |
| ReloadTexture()()()() | Reloads texture from disk or recreates manual texture, depending on IsManual flag. | |
| ReplaceTifWithPng(String) | TMS 2010-SEP-27: Visual3D does not read .tif successfully, for model textures.
Author must manually make corresponding .png file; changing here to refer to that.
| |
| ReplaceXnaTexture2D(String, String, TextureCreationParameters) | ||
| ResizeTexture2D(Texture, Int32, Int32, Int32) | "texture" must be 32-bit Color. "autoMipLevels"==0 to automatically generate default # mip levels.
Otherwise, typically pass in value from "texture._numMipLevels".
NOTE: Result texture is given same name as "texture".
| |
| RunVideoPlayback()()()() |
Run the Video Playback.
| |
| SaveDDSAlternate(String) | Alternate way to write data to texture - uses Direct3D call instead of XNA. | |
| SaveToSerializedFile(Texture..::..BuildParams) | Serializes texture object in file if serialized file doesn't exist or older then source and cached files or force option set to true | |
| SaveXna(String, ImageFileFormat) | ||
| SaveXnaTexture(Texture, String) | ||
| SaveXnaTexture(Texture, String, ImageFileFormat) | ||
| SaveXnaTexture(Texture, String, ImageFileFormat, Int64) | ||
| Scope | (Inherited from Registered.) | |
| SetData<(Of <<'(T>)>>)(array<T>[]()[][]) | (For 2D and 3D textures only). Copies array data to the texture at mipmap level 0. | |
| SetData<(Of <<'(T>)>>)(CubeMapFace, array<T>[]()[][]) | (For Cube textures only). Copies array data to the texture at mipmap level 0. | |
| SetData<(Of <<'(T>)>>)(Nullable<(Of <<'(Rectangle>)>>), array<T>[]()[][], Int32, Int32) | ||
| SetData<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32, SetDataOptions) | (For 2D and 3D textures only). Copies array data to the texture at mipmap level 0, specifying a start offset. | |
| SetData<(Of <<'(T>)>>)(CubeMapFace, array<T>[]()[][], Int32, Int32, SetDataOptions) | (For Cube textures only). Copies array data to the texture at mipmap level 0, specifying a start offset. | |
| SetData<(Of <<'(T>)>>)(Int32, Nullable<(Of <<'(Rectangle>)>>), array<T>[]()[][], Int32, Int32, SetDataOptions) | (For 2D textures only). Copies array data to the texture, specifying the dimensions of the area
and the mipmap level where the data is to be placed. | |
| SetData<(Of <<'(T>)>>)(CubeMapFace, Int32, Nullable<(Of <<'(Rectangle>)>>), array<T>[]()[][], Int32, Int32, SetDataOptions) | (For Cube textures only). Copies array data to the texture, specifying the dimensions of the area
and the mipmap level where the data is to be placed. | |
| SetData<(Of <<'(T>)>>)(Int32, Int32, Int32, Int32, Int32, Int32, Int32, array<T>[]()[][], Int32, Int32, SetDataOptions) | (For 3D textures only). Copies array data to the texture, specifying the dimensions of the volume
and the mipmap level where the data is to be placed. | |
| SetDataAlternate(Rectangle, Byte*) | Alternate way to write data to texture - uses Direct3D call instead of XNA. | |
| SetDataAlternate(Rectangle, array<Byte>[]()[][]) | Alternate way to write data to texture - uses Direct3D call instead of XNA. | |
| SetDataAlternate(Int32, Rectangle, Byte*) | Alternate way to write data to texture - uses Direct3D call instead of XNA. | |
| SetDataAlternate(Int32, Rectangle, array<Byte>[]()[][]) | Alternate way to write data to texture - uses Direct3D call instead of XNA. | |
| SetGenerateMipFilter(TextureFilter) | (ONLY applicable for Manual textures with numMipLevels=0 or less passed to constructor).
Assigns user-defined filter used to auto-generate MIP levels after texture creation
or each time when SetData is called. If set to None, the best supported filter (such as Gaussian)
will be picked up depending on current hardware capabilities. | |
| SetPixel(array<Byte>[]()[][], Int32, Int32, Int32, Byte, Byte, Byte, Byte) | SIDE-EFFECT: dst: 4 consecutive bytes are set. TODO: Untested. BGRA dst.
| |
| SetXnaTexture(Texture, AssetFile) | ||
| SizeInBytes | Returns size of texture content at MIP level 0, in bytes. | |
| SizeInBytesWithMipmaps | Returns total size of texture content including all MIP levels, in bytes. | |
| SourceFile | (Overrides Asset..::..SourceFile.) | |
| StopVideoPlayback()()()() |
Halt the Video Playback.
| |
| StorageModule | (Inherited from Registered.) | |
| TextureTrackingReport()()()() | ||
| ToString()()()() | (Inherited from ComponentBase.) | |
| TransparencyKeyColor | Gets/sets color to mask out in loaded texture. If non-TransparentBlack color is specified,
given color will be replaced with transparent black automatically during rendering.
Default is TransparentBlack. Setting this property to new value will recreate texture or reload texture from disk. | |
| Type | Returns texture type (1D, 2D, 3D or cube texture) | |
| UniqueName | (Inherited from Registered.) | |
| VideoAvgTimePerFrame |
The playback rate for video clips. (Default = 0.04 sec)
| |
| VideoIsLooping |
Should the video clip loop continuously? (Default = True)
| |
| VideoTextureEvent | ||
| Width | Gets/sets a width of texture in pixels.
Setting this property to new value will recreate texture or reload texture from disk. | |
| XnaTexture | Gets/sets direct reference to XNA Texture object. | |
| XnaTexture_NoAutoLoad | Does NOT auto-load texture (returns null).
| |
| XnaTexture2DFromFileWithGC(String) | ||
| XnaTexture2DFromFileWithGC(GraphicsDevice, String) |
Remarks
When loading a cubic texture, the image with the texture base name plus the "_rt", "_lf",
"_up", "_dn", "_fr", "_bk" suffixes will automaticaly be loaded to construct it.
Inheritance Hierarchy
System..::..Object
Visual3D.EntityModel..::..ComponentBase
Visual3D.EntityModel..::..EntityComponent
Visual3D..::..Registered
Visual3D..::..Asset
MediaAsset
Visual3D.Graphics3D..::..Texture
Visual3D.EntityModel..::..ComponentBase
Visual3D.EntityModel..::..EntityComponent
Visual3D..::..Registered
Visual3D..::..Asset
MediaAsset
Visual3D.Graphics3D..::..Texture