Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bge.types.KX_VertexProxy.rst « bge_types « rst « python_api « doc - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 73d692770d635ba709cbaa2bba26340d84f9581e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
KX_VertexProxy(SCA_IObject)
===========================

.. module:: bge.types

base class --- :class:`SCA_IObject`

.. class:: KX_VertexProxy(SCA_IObject)

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

   Note:
   The physics simulation is NOT currently updated - physics will not respond
   to changes in the vertex position.

   .. attribute:: XYZ

      The position of the vertex.

      :type: Vector((x, y, z))

   .. attribute:: UV

      The texture coordinates of the vertex.

      :type: Vector((u, v))

   .. attribute:: normal

      The normal of the vertex.

      :type: Vector((nx, ny, nz))

   .. attribute:: color

      The color of the vertex.

      :type: Vector((r, g, b, a))

      Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]

   .. attribute:: x

      The x coordinate of the vertex.

      :type: float

   .. attribute:: y

      The y coordinate of the vertex.

      :type: float

   .. attribute:: z

      The z coordinate of the vertex.

      :type: float

   .. attribute:: u

      The u texture coordinate of the vertex.

      :type: float

   .. attribute:: v

      The v texture coordinate of the vertex.

      :type: float

   .. attribute:: u2

      The second u texture coordinate of the vertex.

      :type: float

   .. attribute:: v2

      The second v texture coordinate of the vertex.

      :type: float

   .. attribute:: r

      The red component of the vertex color. 0.0 <= r <= 1.0.

      :type: float

   .. attribute:: g

      The green component of the vertex color. 0.0 <= g <= 1.0.

      :type: float

   .. attribute:: b

      The blue component of the vertex color. 0.0 <= b <= 1.0.

      :type: float

   .. attribute:: a

      The alpha component of the vertex color. 0.0 <= a <= 1.0.

      :type: float

   .. method:: getXYZ()

      Gets the position of this vertex.

      :return: this vertexes position in local coordinates.
      :rtype: Vector((x, y, z))

   .. method:: setXYZ(pos)

      Sets the position of this vertex.

      :type:  Vector((x, y, z))

      :arg pos: the new position for this vertex in local coordinates.

   .. method:: getUV()

      Gets the UV (texture) coordinates of this vertex.

      :return: this vertexes UV (texture) coordinates.
      :rtype: Vector((u, v))

   .. method:: setUV(uv)

      Sets the UV (texture) coordinates of this vertex.

      :type:  Vector((u, v))

   .. method:: getUV2()

      Gets the 2nd UV (texture) coordinates of this vertex.

      :return: this vertexes UV (texture) coordinates.
      :rtype: Vector((u, v))

   .. method:: setUV2(uv, unit)

      Sets the 2nd UV (texture) coordinates of this vertex.

      :type:  Vector((u, v))

      :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
      :arg unit:  integer

   .. method:: getRGBA()

      Gets the color of this vertex.

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

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

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

      .. code-block:: python

         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)

      :return: packed color. 4 byte integer with one byte per color channel in RGBA format.
      :rtype: integer

   .. method:: setRGBA(col)

      Sets the color of this vertex.

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

      setRGBA() also accepts a four component list as argument col.  The list represents the color 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]

      .. code-block:: python

         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.

      :arg col: the new color of this vertex in packed RGBA format.
      :type col: integer or list [r, g, b, a]

   .. method:: getNormal()

      Gets the normal vector of this vertex.

      :return: normalized normal vector.
      :rtype: Vector((nx, ny, nz))

   .. method:: setNormal(normal)

      Sets the normal vector of this vertex.

      :type:  sequence of floats [r, g, b]

      :arg normal: the new normal of this vertex.