Module KX_VertexProxy

Source Code for Module KX_VertexProxy

  1  # $Id: KX_VertexProxy.py 2832 2004-07-17 05:28:23Z kester $ 
  2  # Documentation for the vertex proxy class 
  3   
4 -class KX_VertexProxy:
5 """ 6 A vertex holds position, UV, colour and normal information. 7 8 Note: 9 The physics simulation is NOT currently updated - physics will not respond 10 to changes in the vertex position. 11 12 @ivar XYZ: The position of the vertex. 13 @type XYZ: list [x, y, z] 14 @ivar UV: The texture coordinates of the vertex. 15 @type UV: list [u, v] 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. 22 23 @group Position: x, y, z 24 @ivar x: The x coordinate of the vertex. 25 @type x: float 26 @ivar y: The y coordinate of the vertex. 27 @type y: float 28 @ivar z: The z coordinate of the vertex. 29 @type z: float 30 31 @group Texture Coordinates: u, v 32 @ivar u: The u texture coordinate of the vertex. 33 @type u: float 34 @ivar v: The v texture coordinate of the vertex. 35 @type v: float 36 37 @group Colour: r, g, b, a 38 @ivar r: The red component of the vertex colour. 0.0 <= r <= 1.0 39 @type r: float 40 @ivar g: The green component of the vertex colour. 0.0 <= g <= 1.0 41 @type g: float 42 @ivar b: The blue component of the vertex colour. 0.0 <= b <= 1.0 43 @type b: float 44 @ivar a: The alpha component of the vertex colour. 0.0 <= a <= 1.0 45 @type a: float 46 """ 47
48 - def getXYZ():
49 """ 50 Gets the position of this vertex. 51 52 @rtype: list [x, y, z] 53 @return: this vertexes position in local coordinates. 54 """
55 - def setXYZ(pos):
56 """ 57 Sets the position of this vertex. 58 59 @type pos: list [x, y, z] 60 @param pos: the new position for this vertex in local coordinates. 61 """
62 - def getUV():
63 """ 64 Gets the UV (texture) coordinates of this vertex. 65 66 @rtype: list [u, v] 67 @return: this vertexes UV (texture) coordinates. 68 """
69 - def setUV(uv):
70 """ 71 Sets the UV (texture) coordinates of this vertex. 72 73 @type uv: list [u, v] 74 """
75 - def getRGBA():
76 """ 77 Gets the colour of this vertex. 78 79 The colour is represented as four bytes packed into an integer value. The colour is 80 packed as RGBA. 81 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. 84 85 Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. 86 87 Example:: 88 import struct; 89 col = struct.unpack('4B', struct.pack('I', v.getRGBA())) 90 # col = (r, g, b, a) 91 # black = ( 0, 0, 0, 255) 92 # white = (255, 255, 255, 255) 93 94 @rtype: integer 95 @return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. 96 """
97 - def setRGBA(col):
98 """ 99 Sets the colour of this vertex. 100 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. 103 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] 106 107 Example:: 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. 112 113 @type col: integer or list [r, g, b, a] 114 @param col: the new colour of this vertex in packed RGBA format. 115 """
116 - def getNormal():
117 """ 118 Gets the normal vector of this vertex. 119 120 @rtype: list [nx, ny, nz] 121 @return: normalised normal vector. 122 """
123