Module KX_VertexProxy :: Class KX_VertexProxy
[frames | no frames]

Class KX_VertexProxy


A vertex holds position, UV, colour and normal information.

Note: The physics simulation is NOT currently updated - physics will not respond to changes in the vertex position.
Method Summary
list [nx, ny, nz] getNormal()
Gets the normal vector of this vertex.
integer getRGBA()
Gets the colour of this vertex.
list [u, v] getUV()
Gets the UV (texture) coordinates of this vertex.
list [x, y, z] getXYZ()
Gets the position of this vertex.
  setRGBA(col)
Sets the colour of this vertex.
  setUV(uv)
Sets the UV (texture) coordinates of this vertex.
  setXYZ(pos)
Sets the position of this vertex.

Instance Variable Summary
  color: Synonym for colour.
list [r, g, b, a] colour: The colour of the vertex.
list [nx, ny, nz] normal: The normal of the vertex
list [u, v] UV: The texture coordinates of the vertex.
list [x, y, z] XYZ: The position of the vertex.
    Position
float x: The x coordinate of the vertex.
float y: The y coordinate of the vertex.
float z: The z coordinate of the vertex.
    Texture Coordinates
float u: The u texture coordinate of the vertex.
float v: The v texture coordinate of the vertex.
    Colour
float r: The red component of the vertex colour.
float g: The green component of the vertex colour.
float b: The blue component of the vertex colour.
float a: The alpha component of the vertex colour.

Method Details

getNormal()

Gets the normal vector of this vertex.
Returns:
normalised normal vector.
           (type=list [nx, ny, nz])

getRGBA()

Gets the colour of this vertex.

The colour is represented as four bytes packed into an integer value. The colour is packed as RGBA.

Since Python offers no way to get each byte without shifting, you must use the struct module to access colour in an machine independent way.

Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead.

Example:
       import struct;
       col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
       # col = (r, g, b, a)
       # black = (  0,   0,   0, 255)
       # white = (255, 255, 255, 255)
Returns:
packed colour. 4 byte integer with one byte per colour channel in RGBA format.
           (type=integer)

getUV()

Gets the UV (texture) coordinates of this vertex.
Returns:
this vertexes UV (texture) coordinates.
           (type=list [u, v])

getXYZ()

Gets the position of this vertex.
Returns:
this vertexes position in local coordinates.
           (type=list [x, y, z])

setRGBA(col)

Sets the colour of this vertex.

See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes or the colour attribute instead.

setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]

Example:
       v.setRGBA(0xff0000ff) # Red
       v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
       v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
       v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
Parameters:
col - the new colour of this vertex in packed RGBA format.
           (type=integer or list [r, g, b, a])

setUV(uv)

Sets the UV (texture) coordinates of this vertex.
Parameters:
uv
           (type=list [u, v])

setXYZ(pos)

Sets the position of this vertex.
Parameters:
pos - the new position for this vertex in local coordinates.
           (type=list [x, y, z])

Instance Variable Details

x

The x coordinate of the vertex.
Type:
float

y

The y coordinate of the vertex.
Type:
float

z

The z coordinate of the vertex.
Type:
float

u

The u texture coordinate of the vertex.
Type:
float

v

The v texture coordinate of the vertex.
Type:
float

r

The red component of the vertex colour. 0.0 <= r <= 1.0
Type:
float

g

The green component of the vertex colour. 0.0 <= g <= 1.0
Type:
float

b

The blue component of the vertex colour. 0.0 <= b <= 1.0
Type:
float

a

The alpha component of the vertex colour. 0.0 <= a <= 1.0
Type:
float

color

Synonym for colour.

colour

The colour of the vertex. Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
Type:
list [r, g, b, a]

normal

The normal of the vertex
Type:
list [nx, ny, nz]

UV

The texture coordinates of the vertex.
Type:
list [u, v]

XYZ

The position of the vertex.
Type:
list [x, y, z]

Generated by Epydoc 2.1 on Thu Feb 1 00:12:33 2007 http://epydoc.sf.net