Module GameTypes :: Class KX_VertexProxy
[hide private]
[frames] | no frames]

Class KX_VertexProxy

source code

PyObjectPlus --+        
               |        
          CValue --+    
                   |    
         SCA_IObject --+
                       |
                      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.

Instance Methods [hide private]
list [x, y, z]
getXYZ()
Gets the position of this vertex.
source code
 
setXYZ(pos)
Sets the position of this vertex.
source code
list [u, v]
getUV()
Gets the UV (texture) coordinates of this vertex.
source code
 
setUV(uv)
Sets the UV (texture) coordinates of this vertex.
source code
list [u, v]
getUV2()
Gets the 2nd UV (texture) coordinates of this vertex.
source code
 
setUV2(uv, unit)
Sets the 2nd UV (texture) coordinates of this vertex.
source code
integer
getRGBA()
Gets the colour of this vertex.
source code
 
setRGBA(col)
Sets the colour of this vertex.
source code
list [nx, ny, nz]
getNormal()
Gets the normal vector of this vertex.
source code
 
setNormal(normal)
Sets the normal vector of this vertex.
source code
    Deprecated
    Inherited from CValue
string
getName()
Returns the name of the CValue.
source code
    Inherited from PyObjectPlus
bool
isA(game_type)
Check if this is a type or a subtype game_type.
source code
Instance Variables [hide private]
list [u, v] UV
The texture coordinates of the vertex.
list [x, y, z] XYZ
The position of the vertex.
  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
float u2
The second u texture coordinate of the vertex.
float v2
The second v texture coordinate 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 a
The alpha component of the vertex colour.
float b
The blue component of the vertex colour.
float g
The green component of the vertex colour.
float r
The red component of the vertex colour.
    Inherited from CValue
string name
The name of this CValue derived object (read-only).
    Inherited from PyObjectPlus
bool invalid
Test if the object has been freed by the game engine and is no longer valid.
Method Details [hide private]

getXYZ()

source code 
Gets the position of this vertex.
Returns: list [x, y, z]
this vertexes position in local coordinates.

setXYZ(pos)

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

getUV()

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

setUV(uv)

source code 
Sets the UV (texture) coordinates of this vertex.

getUV2()

source code 
Gets the 2nd UV (texture) coordinates of this vertex.
Returns: list [u, v]
this vertexes UV (texture) coordinates.

setUV2(uv, unit)

source code 
Sets the 2nd UV (texture) coordinates of this vertex.
Parameters:
  • unit - optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
  • unit - int

getRGBA()

source code 

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: integer
packed colour. 4 byte integer with one byte per colour channel in RGBA format.

setRGBA(col)

source code 

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 (integer or list [r, g, b, a]) - the new colour of this vertex in packed RGBA format.

getNormal()

source code 
Gets the normal vector of this vertex.
Returns: list [nx, ny, nz]
normalised normal vector.

setNormal(normal)

source code 
Sets the normal vector of this vertex.
Parameters:
  • normal (sequence of floats [r, g, b]) - the new normal of this vertex.

Instance Variable Details [hide private]

a

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

b

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

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]

g

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

r

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