1
# $Id: KX_VertexProxy.py,v 1.4 2004/07/17 05:28:23 kester Exp $
2
# Documentation for the vertex proxy class
6
A vertex holds position, UV, colour and normal information.
9
The physics simulation is NOT currently updated - physics will not respond
10
to changes in the vertex position.
12
@ivar XYZ: The position of the vertex.
13
@type XYZ: list [x, y, z]
14
@ivar UV: The texture coordinates of the vertex.
16
@ivar normal: The normal of the vertex
17
@type normal: list [nx, ny, nz]
18
@ivar colour: The colour of the vertex.
19
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
20
@type colour: list [r, g, b, a]
21
@ivar color: Synonym for colour.
23
@group Position: x, y, z
24
@ivar x: The x coordinate of the vertex.
26
@ivar y: The y coordinate of the vertex.
28
@ivar z: The z coordinate of the vertex.
31
@group Texture Coordinates: u, v
32
@ivar u: The u texture coordinate of the vertex.
34
@ivar v: The v texture coordinate of the vertex.
37
@group Colour: r, g, b, a
38
@ivar r: The red component of the vertex colour. 0.0 <= r <= 1.0
40
@ivar g: The green component of the vertex colour. 0.0 <= g <= 1.0
42
@ivar b: The blue component of the vertex colour. 0.0 <= b <= 1.0
44
@ivar a: The alpha component of the vertex colour. 0.0 <= a <= 1.0
50
Gets the position of this vertex.
52
@rtype: list [x, y, z]
53
@return: this vertexes position in local coordinates.
57
Sets the position of this vertex.
59
@type pos: list [x, y, z]
60
@param pos: the new position for this vertex in local coordinates.
64
Gets the UV (texture) coordinates of this vertex.
67
@return: this vertexes UV (texture) coordinates.
71
Sets the UV (texture) coordinates of this vertex.
77
Gets the colour of this vertex.
79
The colour is represented as four bytes packed into an integer value. The colour is
82
Since Python offers no way to get each byte without shifting, you must use the struct module to
83
access colour in an machine independent way.
85
Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead.
89
col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
91
# black = ( 0, 0, 0, 255)
92
# white = (255, 255, 255, 255)
95
@return: packed colour. 4 byte integer with one byte per colour channel in RGBA format.
99
Sets the colour of this vertex.
101
See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
102
or the colour attribute instead.
104
setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a]
105
with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
108
v.setRGBA(0xff0000ff) # Red
109
v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
110
v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
111
v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
113
@type col: integer or list [r, g, b, a]
114
@param col: the new colour of this vertex in packed RGBA format.
118
Gets the normal vector of this vertex.
120
@rtype: list [nx, ny, nz]
121
@return: normalised normal vector.