TextureMapping

TextureMapping

Represents a texture mapping.

Constructor

new TextureMapping()

Extends

Members

isPeriodic

isValid :bool

Inherited From:
Tests an object to see if it is valid.
Type:
  • bool

requiresVertexNormals

userStringCount

Inherited From:

Methods

(static) CreateBoxMapping(plane, dx, dy, dz, capped) → {TextureMapping}

Create a box projection texture mapping.
Parameters:
Name Type Description
plane Plane The sides of the box the box are parallel to the plane's coordinate planes. The dx, dy, dz intervals determine the location of the sides.
dx Interval Determines the location of the front and back planes. The vector plane.xaxis is perpendicular to these planes and they pass through plane.PointAt(dx[0],0,0) and plane.PointAt(dx[1],0,0), respectively.
dy Interval Determines the location of the left and right planes. The vector plane.yaxis is perpendicular to these planes and they pass through plane.PointAt(0,dy[0],0) and plane.PointAt(0,dy[1],0), respectively.
dz Interval Determines the location of the top and bottom planes. The vector plane.zaxis is perpendicular to these planes and they pass through plane.PointAt(0,0,dz[0]) and plane.PointAt(0,0,dz[1]), respectively.
capped bool If true, the box is treated as a finite capped box.
Returns:
TextureMapping instance if input is valid
Type
TextureMapping

(static) createCylinderMapping(cylinder, capped) → {TextureMapping}

Create a cylindrical projection texture mapping.
Parameters:
Name Type Description
cylinder Cylinder cylinder in world space used to define a cylindrical coordinate system. The angular parameter maps (0,2pi) to texture "u" (0,1), The height parameter maps (height[0],height[1]) to texture "v" (0,1), and the radial parameter maps (0,r) to texture "w" (0,1).
capped bool If true, the cylinder is treated as a finite capped cylinder
Returns:
TextureMapping instance if input is valid
Type
TextureMapping

(static) createPlaneMapping(plane, dx, dy, dz) → {TextureMapping}

Create a planar UV projection texture mapping
Parameters:
Name Type Description
plane Plane A plane to use for mapping.
dx Interval portion of the plane's x axis that is mapped to [0,1] (can be a decreasing interval)
dy Interval portion of the plane's y axis that is mapped to [0,1] (can be a decreasing interval)
dz Interval portion of the plane's z axis that is mapped to [0,1] (can be a decreasing interval)
Returns:
TextureMapping instance if input is valid
Type
TextureMapping

(static) createSphereMapping(sphere) → {TextureMapping}

Create a spherical projection texture mapping.
Parameters:
Name Type Description
sphere Sphere sphere in world space used to define a spherical coordinate system. The longitude parameter maps (0,2pi) to texture "u" (0,1). The latitude parameter maps (-pi/2,+pi/2) to texture "v" (0,1). The radial parameter maps (0,r) to texture "w" (0,1).
Returns:
TextureMapping instance if input is valid
Type
TextureMapping

(static) createSurfaceParameterMapping() → {TextureMapping}

Create a mapping that will convert surface parameters into normalized(0,1)x(0,1) texture coordinates.
Returns:
TextureMapping instance or null if failed.
Type
TextureMapping

encode()

Inherited From:
...

evaluate(p, n) → {Array}

Evaluate the mapping to get a texture coordinate
Parameters:
Name Type Description
p Array.<x, y, z> Vertex location
n Array.<x, y, z> If the mapping projection is ray_projection, then this is the vertex unit normal. Otherwise n is ignored.
Returns:
[int, Array.]
  • (int) Nonzero if evaluation is successful. When the mapping is a box or capped cylinder mapping, the value indicates which side was evaluated. Cylinder mapping: 1 = cylinder wall, 2 = bottom cap, 3 = top cap Box mapping: 1 = front, 2 = right, 3 = back, 4 = left, 5 = bottom, 6 = top
  • (Array.) Texture coordinate (u,v,w)
Type
Array

getUserString()

Inherited From:
...

getUserStrings()

Inherited From:
...

rdkXml()

Inherited From:
...

reverseTextureCoordinate()

...

setUserString()

Inherited From:
...

swapTextureCoordinate()

...

tileTextureCoordinate()

...

toJSON()

Inherited From:
Create a JSON string representation of this object

tryGetMappingCylinder() → {Array}

Get a cylindrical projection parameters from this texture mapping.
Returns:
[bool, Cylinder]
  • (bool) Returns true if a valid cylinder is returned.
Type
Array

tryGetMappingSphere() → {Array}

Get a spherical projection parameters from this texture mapping.
Returns:
[bool, Sphere]
  • (bool) Returns true if a valid sphere is returned.
Type
Array