All Functions Modules Pages
texture 3D

Functions

TEXTURE3D texture3d.load (STRING path, NUMBER load)
 Loads an image as 3D texture (in RAM or VRAM). More...
 
TEXTURE3D texture3d.new (NUMBER width, NUMBER height, NUMBER load)
 Makes an empty texture. More...
 
NIL texture3d.setcustom (MODEL3D Model, NUMBER object, NUMBER texture, TEXTURE3D texture3d)
 Replaces the model's texture with another previously made or loaded. More...
 
NIL texture3d.quality (TEXTURE3D texture, NUMBER quality)
 Sets the texture quality. More...
 
NIL texture3d.quality (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER quality)
 Sets the texture quality of an specific texture inside a 3D model. More...
 
NIL texture3d.position (TEXTURE3D texture, NUMBER posx, NUMBER posy)
 Changes the position of a texture drawn in 2D with texture3d.draw(). More...
 
NIL texture3d.scaling (TEXTURE3D texture, NUMBER scalx, NUMBER scaly)
 Changes the size of a texture drawn in 2D with texture3d.draw(). More...
 
NIL texture3d.envmap (TEXTURE3D texture, NUMBER mapx, NUMBER mapy, NUMBER maprot)
 Changes the position and rotation of a texture in environmental mode (env_map). More...
 
NIL texture3d.envmap (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER mapx, NUMBER mapy, NUMBER maprot)
 Changes the position and rotation of a texture inside a 3D model in environmental mode (env_map). More...
 
NIL texture3d.setmulti (MODEL3D Model, NUMBER object, NUMBER texture, TEXTURE3D texture3d)
 Applies a semi transparent texture over another inside a 3D model. More...
 
NIL texture3d.mapping (TEXTURE3D texture3d, NUMBER mapping, NUMBER l0, NUMBER l1)
 Sets the texture mapping mode. More...
 
NIL texture3d.mapping (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER mapping, NUMBER l0, NUMBER l1)
 Sets the mapping mode of a texture inside a 3D model. More...
 
NIL texture3d.setframes (TEXTURE3D texture3d, NUMBER frames)
 Defines the number of frames of an animated texture (the frames are aligned vertically). More...
 
NIL texture3d.setframes (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER frames)
 Defines the number of frames of an animated texture inside a 3D model (the frames are aligned vertically). More...
 
NIL texture3d.frame (TEXTURE3D texture3d, NUMBER frame)
 Sets the frame to show of an animated texture. More...
 
NIL texture3d.frame (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER frame)
 Sets the frame to show of an animated texture. More...
 
NIL texture3d.trans (TEXTURE3D texture3d, NUMBER u, NUMBER v)
 Modifies the mapping coordinates of a texture. More...
 
NIL texture3d.trans (MODEL3D Model, NUMBER object, NUMBER texture, NUMBER u, NUMBER v)
 Modifies the mapping coordinates of a texture inside a 3D model. More...
 
NIL texture3d.render (TEXTURE3D texture3d)
 Captures the image seen by the camera and saves it in a texture. More...
 
NIL texture3d.render (MODEL3D Model, NUMBER object, NUMBER texture)
 Captures the image seen by the camera and saves it in a texture inside a 3D model. More...
 
NIL texture3d.draw (TEXTURE3D texture3d)
 Draws a 3D texture in 2D mode (using amg.mode2d()). More...
 
NIL texture3d.filter (MODEL3D Model, NUMBER filter)
 Change texture filter. More...
 
NIL texture3d.filter (MODEL3D Model, NUMBER object, NUMBER filter)
 Change texture filter. More...
 
NIL texture3d.allocshared (NUMBER w, NUMBER h)
 Reserves VRAM space for shared textures. More...
 
NIL texture3d.freeshared ()
 Frees the allocated space in VRAM for shared textures. More...
 
NIL texture3d.tovram (TEXTURE3D texture3d)
 Moves a texture to VRAM. More...
 
NIL texture3d.tovram (MODEL3D Model, NUMBER object, NUMBER texture)
 Moves a texture inside a 3D model to VRAM. More...
 
NIL texture3d.finish ()
 Ends the image capture of texture3d.render(). More...
 

Detailed Description

Using 3D textures.

Function Documentation

TEXTURE3D texture3d.load ( STRING  path,
NUMBER  load 
)

Loads an image as 3D texture (in RAM or VRAM).

Parameters
pathPath to the texture file.
loadTexture location, one of these constants:
  • __RAM
  • __VRAM
Note
The textures are always square images (same width as height), unless the texture is animated, in this case the texture is sorted in square frames aligned vertically.
Returns
A texture3d object, ready to use.
TEXTURE3D texture3d.new ( NUMBER  width,
NUMBER  height,
NUMBER  load 
)

Makes an empty texture.

Parameters
widthTexture width.
heightTexture height.
loadTexture location, one of these constants:
  • __RAM
  • __VRAM
Note
The textures are always square images (same width as height), except if the texture is animated, in this case the texture is sorted in square frames aligned vertically.
Returns
A texture3d object, ready to use.
NIL texture3d.setcustom ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
TEXTURE3D  texture3d 
)

Replaces the model's texture with another previously made or loaded.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
texture3dThe new texture for the object.
Returns
Nothing.
NIL texture3d.quality ( TEXTURE3D  texture,
NUMBER  quality 
)

Sets the texture quality.

Parameters
textureA 3D texture.
qualityThe texture quality:. Can be one of these constants:
  • __8888
  • __4444
  • __5551
  • __5650
Returns
Nothing.
NIL texture3d.quality ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  quality 
)

Sets the texture quality of an specific texture inside a 3D model.

Parameters
ModelA 3D model.
objectThe object inside the 3D model.
textureThe object texture.
qualityThe texture quality. Can be one of these constants:
  • __8888
  • __4444
  • __5551
  • __5650
Returns
Nothing.
NIL texture3d.position ( TEXTURE3D  texture,
NUMBER  posx,
NUMBER  posy 
)

Changes the position of a texture drawn in 2D with texture3d.draw().

Parameters
textureA texture.
posxThe mapping X position (0 by default).
posyThe mapping Y position (0 by default).
Returns
Nothing.
NIL texture3d.scaling ( TEXTURE3D  texture,
NUMBER  scalx,
NUMBER  scaly 
)

Changes the size of a texture drawn in 2D with texture3d.draw().

Parameters
textureA texture.
scalxX size (1 by default).
scalyY size (1 by default).
Returns
Nothing.
NIL texture3d.envmap ( TEXTURE3D  texture,
NUMBER  mapx,
NUMBER  mapy,
NUMBER  maprot 
)

Changes the position and rotation of a texture in environmental mode (env_map).

Parameters
textureA texture.
mapxX position (0 by default).
mapyY position (0 by default).
maprotRotation (0 by default).
Returns
Nothing.
NIL texture3d.envmap ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  mapx,
NUMBER  mapy,
NUMBER  maprot 
)

Changes the position and rotation of a texture inside a 3D model in environmental mode (env_map).

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
mapxX position (0 by default).
mapyY position (0 by default).
maprotRotation (0 by default).
Returns
Nothing.
NIL texture3d.setmulti ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
TEXTURE3D  texture3d 
)

Applies a semi transparent texture over another inside a 3D model.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
texture3dThe applied texture.
Returns
Nothing.
NIL texture3d.mapping ( TEXTURE3D  texture3d,
NUMBER  mapping,
NUMBER  l0,
NUMBER  l1 
)

Sets the texture mapping mode.

Parameters
texture3dA 3D texture.
mappingMapping mode, one of these constants:
  • __ENV (environmental, simulate reflections).
  • __COORDS (default mode).
l0The lights to use as columns for the ambiental mapping matrix.
l1The sencond light to use (the matrix size is 2x3).
Returns
Nothing.
NIL texture3d.mapping ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  mapping,
NUMBER  l0,
NUMBER  l1 
)

Sets the mapping mode of a texture inside a 3D model.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
mappingMapping mode, one of these constants:
  • __ENV (environmental, simulate reflections).
  • __COORDS (default mode).
l0The lights to use as columns for the ambiental mapping matrix.
l1The sencond light to use (the matrix size is 2x3).
Returns
Nothing.
NIL texture3d.setframes ( TEXTURE3D  texture3d,
NUMBER  frames 
)

Defines the number of frames of an animated texture (the frames are aligned vertically).

Parameters
texture3dA 3D texture.
framesNumber of frames.
Returns
Nothing.
NIL texture3d.setframes ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  frames 
)

Defines the number of frames of an animated texture inside a 3D model (the frames are aligned vertically).

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
framesNumber of frames
Returns
Nothing.
NIL texture3d.frame ( TEXTURE3D  texture3d,
NUMBER  frame 
)

Sets the frame to show of an animated texture.

Parameters
texture3dA 3D texture.
frameThe frame to show.
Returns
Nothing.
NIL texture3d.frame ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  frame 
)

Sets the frame to show of an animated texture.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
frameThe frame to show.
Returns
Nothing.
NIL texture3d.trans ( TEXTURE3D  texture3d,
NUMBER  u,
NUMBER  v 
)

Modifies the mapping coordinates of a texture.

Parameters
texture3dA 3D texture.
uMapping U position.
vMapping V position.
Returns
Nothing.
NIL texture3d.trans ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture,
NUMBER  u,
NUMBER  v 
)

Modifies the mapping coordinates of a texture inside a 3D model.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
uMapping U position.
vMapping V position.
Returns
Nothing.
NIL texture3d.render ( TEXTURE3D  texture3d)

Captures the image seen by the camera and saves it in a texture.

Parameters
texture3dA 3D texture.
Note
This function should be used before amg.update().
3D texture must be loaded to VRAM with texture3d.load().
Returns
Nothing.
NIL texture3d.render ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture 
)

Captures the image seen by the camera and saves it in a texture inside a 3D model.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureThe object texture.
Note
This function should be used before amg.update().
Texture must be transferred to VRAM texture3d.tovram(), before using it.
Returns
Nothing.
NIL texture3d.draw ( TEXTURE3D  texture3d)

Draws a 3D texture in 2D mode (using amg.mode2d()).

Parameters
texture3dA 3D texture.
Returns
Nothing.
NIL texture3d.filter ( MODEL3D  Model,
NUMBER  filter 
)

Change texture filter.

Parameters
ModelThe 3D model.
filterFilter for the texture. It can be one of the following constants:
  • __NEAR (No filter, pixelated).
  • __LINEAR (Linear filter, smooth).
Returns
Nothing.
NIL texture3d.filter ( MODEL3D  Model,
NUMBER  object,
NUMBER  filter 
)

Change texture filter.

Parameters
ModelThe 3D model.
objectThe object inside the 3D model.
filterFilter for the texture. It can be one of the following constants:
  • __NEAR (No filter, pixelated).
  • __LINEAR (Linear filter, smooth).
Returns
Nothing.
NIL texture3d.allocshared ( NUMBER  w,
NUMBER  h 
)

Reserves VRAM space for shared textures.

Parameters
wTexture width.
hTexture height.
Note
You can use this function to reserve VRAM space to transfer RAM textures (slower to show) to VRAM (faster), improving performance.
Returns
Nothing.
NIL texture3d.freeshared ( )

Frees the allocated space in VRAM for shared textures.

Returns
Nothing.
NIL texture3d.tovram ( TEXTURE3D  texture3d)

Moves a texture to VRAM.

Parameters
texture3dA 3D texture.
Returns
Nothing.
NIL texture3d.tovram ( MODEL3D  Model,
NUMBER  object,
NUMBER  texture 
)

Moves a texture inside a 3D model to VRAM.

Parameters
ModelA 3D model.
objectAn object inside the 3D model.
textureA 3D texture.
Returns
Nothing.
NIL texture3d.finish ( )

Ends the image capture of texture3d.render().

Returns
Nothing.