This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Texture Class

Interface for texture manipulation.

To use this class, include the UnigineTexture.h file.

Unigine::Texture Class

Members


virtual ~Texture ()

Virtual destructor.

static Ptr< Texture > create ()

Texture constructor.

Return value

Pointer to the created texture.

virtual int create (const ImagePtr & image, int flags) const =0

Create texture from image.

Arguments

  • const ImagePtr & image - Image pointer.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int create2D (int width, int height, int format, int flags) const =0

Create 2D texture.

Arguments

  • int width - Texture width.
  • int height - Texture height.
  • int format - Texture format.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int create3D (int width, int height, int depth, int format, int flags) const =0

Create 3D texture.

Arguments

  • int width - Texture width.
  • int height - Texture height.
  • int depth - Texture depth.
  • int format - Texture format.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int createCube (int width, int height, int format, int flags) const =0

Create Cube texture.

Arguments

  • int width - Texture width.
  • int height - Texture height.
  • int format - Texture format.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int create2DArray (int width, int height, int num_layers, int format, int flags) const =0

Create 2D Array texture.

Arguments

  • int width - Texture width.
  • int height - Texture height.
  • int num_layers - Texture layers.
  • int format - Texture format.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int load (const char * name, int flags) const =0

Load texture from file.

Arguments

  • const char * name - File name.
  • int flags - Texture flags.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int setImage (const ImagePtr & image) const =0

Set texture data.

Arguments

  • const ImagePtr & image - Image pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int getImage (const ImagePtr & image) const =0

Get texture data.

Arguments

  • const ImagePtr & image - Image pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual void clear () const =0

Clear texture.

virtual void destroy () const =0

Destroy texture.

virtual int getType () const =0

Get the texture type.

Return value

Texture type.

virtual const char * getTypeName () const =0

Get the texture type name.

Return value

Texture type name.

virtual int getFormat () const =0

Get the texture format.

Return value

Texture format.

virtual const char * getFormatName () const =0

Get the texture format name.

Return value

Texture format name.

virtual int getWidth () const =0

Return the texture width.

Return value

Texture width.

virtual int getHeight () const =0

Return the texture height.

Return value

Texture height.

virtual int getDepth () const =0

Return the texture depth.

Return value

Texture depth.

virtual int getNumMipmaps () const =0

Return the texture mipmap count.

Return value

Texture mipmap count.

virtual int getNumLayers () const =0

Return the texture layer count.

Return value

Texture layer count.

virtual void setFlags (int flags) const =0

Set texture flags.

Arguments

  • int flags - Texture flags.

virtual int isBilinear () const =0

Check texture filter.

Return value

Returns 1 if the texture filter is bilinear or trilinear.

virtual int isAnisotropy () const =0

Check texture anisotropy.

Return value

Returns 1 if the texture filter is anisotropy.

virtual int getMultisample () const =0

Return the multisample count.

Return value

Multisample count.

virtual int createMipmaps () const =0

Create mipmaps stack.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int copy2D () const =0

Copy 2D texture.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int copyCube () const =0

Copy Cube texture.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual void render2D () const =0

Render 2D texture.

virtual void render2DScreen () const =0

Render 2D Screen texture.

virtual void renderCube () const =0

Render Cube texture.

virtual void render2DArray () const =0

Render 2D Array texture.

virtual int isRenderFlipped () const =0

Check the texture orientation.

Return value

Returns 1 if the texture is flipped.

virtual void bindVertex (int unit) const =0

Bind vertex texture.

Arguments

  • int unit - Texture unit.

virtual void unbindVertex (int unit) const =0

Unbind vertex texture.

Arguments

  • int unit - Texture unit.

virtual void bindFragment (int unit) const =0

Bind fragment texture.

Arguments

  • int unit - Texture unit.

virtual void unbindFragment (int unit) const =0

Unbind fragment texture.

Arguments

  • int unit - Texture unit.

virtual void bindCompute (int unit) const =0

Bind compute texture.

Arguments

  • int unit - Texture unit.

virtual void unbindCompute (int unit) const =0

Unbind compute texture.

Arguments

  • int unit - Texture unit.

virtual int getGLTarget () const =0

Return OpenGL texture target.

virtual int getGLTextureID () const =0

Return OpenGL texture identifier.

virtual void * getD3D9Texture () const =0

Return Direct3D9 texture.

virtual void * getD3D9Surface2D () const =0

Return Direct3D9 surface 2D.

virtual void * getD3D9SurfaceCube () const =0

Return Direct3D9 surface Cube.

virtual void * getD3D11Texture () const =0

Return Direct3D11 texture.

virtual void * getD3D11ShaderResourceView () const =0

Return Direct3D11 render target view.

virtual void * getD3D11UnorderedAccessView () const =0

Return Direct3D11 render target view.

virtual void * getD3D11RenderTargetView () const =0

Return Direct3D11 render target view.

virtual void * getD3D11DepthStencilView () const =0

Return Direct3D11 depth stencil view.

virtual void * getD3D11RenderTargetView () const =0

Return Direct3D11 render target view.

virtual void * getD3D11DepthStencilView () const =0

Return Direct3D11 depth stencil view.

Unigine::Texture::anonymous_90 Enumeration

TEXTURE_2D = 0
TEXTURE_3D
TEXTURE_CUBE
TEXTURE_2D_ARRAY

Unigine::Texture::anonymous_91 Enumeration

FORMAT_R8 = 0
FORMAT_RG8
FORMAT_RGB8
FORMAT_RGBA8
FORMAT_R16
FORMAT_RG16
FORMAT_RGB16
FORMAT_RGBA16
FORMAT_R16F
FORMAT_RG16F
FORMAT_RGB16F
FORMAT_RGBA16F
FORMAT_R32F
FORMAT_RG32F
FORMAT_RGB32F
FORMAT_RGBA32F
FORMAT_R5G6B5
FORMAT_RGBA4
FORMAT_RGB5A1
FORMAT_RGB10A2
FORMAT_RG11B10F
FORMAT_DXT1
FORMAT_DXT3
FORMAT_DXT5
FORMAT_ATI1
FORMAT_ATI2
FORMAT_ETC1
FORMAT_ETC2
FORMAT_ETC5
FORMAT_EAC1
FORMAT_EAC2
FORMAT_ATC1
FORMAT_ATC3
FORMAT_ATC5
FORMAT_PVR4
FORMAT_D16
FORMAT_D24
FORMAT_D24S8
FORMAT_D32F
FORMAT_D32FS8

Unigine::Texture::anonymous_92 Enumeration

FORMAT_SRGB = 1 << 0
FORMAT_SIGNED = 1 << 1
FORMAT_COMPRESSED_DXT = 1 << 2
FORMAT_COMPRESSED_ATI = 1 << 3
FORMAT_COMPRESSED_3DC = 1 << 4
FORMAT_COMPRESSED_ATC = 1 << 5
FORMAT_COMPRESSED_ETC = 1 << 6
FORMAT_COMPRESSED_PVR = 1 << 7
WRAP_CLAMP = 1 << 8
WRAP_BORDER = 1 << 9
FILTER_POINT = 1 << 10
FILTER_LINEAR = 1 << 11
FILTER_BILINEAR = 1 << 12
FILTER_TRILINEAR = 1 << 13
ANISOTROPY_1 = 1 << 14
ANISOTROPY_2 = 1 << 15
ANISOTROPY_4 = 1 << 16
ANISOTROPY_8 = 1 << 17
ANISOTROPY_16 = 1 << 18
MULTISAMPLE_2 = 1 << 19
MULTISAMPLE_4 = 1 << 20
MULTISAMPLE_8 = 1 << 21
MULTISAMPLE_16 = 1 << 22
USAGE_IMMUTABLE = 1 << 23
USAGE_MANAGED = 1 << 24
USAGE_DYNAMIC = 1 << 25
USAGE_STAGING = 1 << 26
USAGE_RENDER = 1 << 27
USAGE_COMPUTE = 1 << 28
DEFAULT_FLAGS = (FILTER_LINEAR)
Last update: 2017-07-03
Build: ()