Package pyffi :: Package utils :: Module tangentspace
[hide private]
[frames] | no frames]

Module tangentspace

source code

A module for tangent space calculation.
Functions [hide private]
 
getTangentSpace(vertices=None, normals=None, uvs=None, triangles=None, orientation=False, orthogonal=True)
Calculate tangent space data.
source code
Variables [hide private]
  __package__ = 'pyffi.utils'
Function Details [hide private]

getTangentSpace(vertices=None, normals=None, uvs=None, triangles=None, orientation=False, orthogonal=True)

source code 

Calculate tangent space data.

>>> vertices = [(0,0,0), (0,1,0), (1,0,0)]
>>> normals = [(0,0,1), (0,0,1), (0,0,1)]
>>> uvs = [(0,0), (0,1), (1,0)]
>>> triangles = [(0,1,2)]
>>> getTangentSpace(vertices = vertices, normals = normals, uvs = uvs, triangles = triangles)
([(0.0, 1.0, 0.0), (0.0, 1.0, 0.0), (0.0, 1.0, 0.0)], [(1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 0.0, 0.0)])
Parameters:
  • vertices - A list of vertices (triples of floats/ints).
  • normals - A list of normals (triples of floats/ints).
  • uvs - A list of uvs (pairs of floats/ints).
  • triangles - A list of triangle indices (triples of ints).
  • orientation - Set to True to return orientation (this is used by for instance Crysis).
Returns:
Two lists of vectors, tangents and binormals. If C{orientation} is True, then returns an extra list with orientations (containing floats which describe the total signed surface of all faces sharing the particular vertex).