Debian Codegraph @

doc/classes/PackedFloat32Array.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="PackedFloat32Array" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A packed array of 32-bit floating-point values.
5 </brief_description>
6 <description>
7 An array specifically designed to hold 32-bit floating-point values (float). Packs data tightly, so it saves memory for large array sizes.
8 If you need to pack 64-bit floats tightly, see [PackedFloat64Array].
9 [b]Note:[/b] Packed arrays are always passed by reference. To get a copy of an array that can be modified independently of the original array, use [method duplicate]. This is [i]not[/i] the case for built-in properties and methods. In these cases the returned packed array is a copy, and changing it will [i]not[/i] affect the original value. To update a built-in property of this type, modify the returned array and then assign it to the property again.
10 </description>
11 <tutorials>
12 </tutorials>
13 <constructors>
14 <constructor name="PackedFloat32Array">
15 <return type="PackedFloat32Array" />
16 <description>
17 Constructs an empty [PackedFloat32Array].
18 </description>
19 </constructor>
20 <constructor name="PackedFloat32Array">
21 <return type="PackedFloat32Array" />
22 <param index="0" name="from" type="PackedFloat32Array" />
23 <description>
24 Constructs a [PackedFloat32Array] as a copy of the given [PackedFloat32Array].
25 </description>
26 </constructor>
27 <constructor name="PackedFloat32Array">
28 <return type="PackedFloat32Array" />
29 <param index="0" name="from" type="Array" />
30 <description>
31 Constructs a new [PackedFloat32Array]. Optionally, you can pass in a generic [Array] that will be converted.
32 </description>
33 </constructor>
34 </constructors>
35 <methods>
36 <method name="append">
37 <return type="bool" />
38 <param index="0" name="value" type="float" />
39 <description>
40 Appends an element at the end of the array (alias of [method push_back]).
41 </description>
42 </method>
43 <method name="append_array">
44 <return type="void" />
45 <param index="0" name="array" type="PackedFloat32Array" />
46 <description>
47 Appends a [PackedFloat32Array] at the end of this array.
48 </description>
49 </method>
50 <method name="bsearch" qualifiers="const">
51 <return type="int" />
52 <param index="0" name="value" type="float" />
53 <param index="1" name="before" type="bool" default="true" />
54 <description>
55 Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array.
56 [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.
57 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
58 </description>
59 </method>
60 <method name="clear">
61 <return type="void" />
62 <description>
63 Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
64 </description>
65 </method>
66 <method name="count" qualifiers="const">
67 <return type="int" />
68 <param index="0" name="value" type="float" />
69 <description>
70 Returns the number of times an element is in the array.
71 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
72 </description>
73 </method>
74 <method name="duplicate" qualifiers="const">
75 <return type="PackedFloat32Array" />
76 <description>
77 Creates a copy of the array, and returns it.
78 </description>
79 </method>
80 <method name="erase">
81 <return type="bool" />
82 <param index="0" name="value" type="float" />
83 <description>
84 Removes the first occurrence of a value from the array and returns [code]true[/code]. If the value does not exist in the array, nothing happens and [code]false[/code] is returned. To remove an element by index, use [method remove_at] instead.
85 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
86 </description>
87 </method>
88 <method name="fill">
89 <return type="void" />
90 <param index="0" name="value" type="float" />
91 <description>
92 Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.
93 </description>
94 </method>
95 <method name="find" qualifiers="const">
96 <return type="int" />
97 <param index="0" name="value" type="float" />
98 <param index="1" name="from" type="int" default="0" />
99 <description>
100 Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.
101 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
102 </description>
103 </method>
104 <method name="get" qualifiers="const">
105 <return type="float" />
106 <param index="0" name="index" type="int" />
107 <description>
108 Returns the 32-bit float at the given [param index] in the array. If [param index] is out-of-bounds or negative, this method fails and returns [code]0.0[/code].
109 This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
110 </description>
111 </method>
112 <method name="has" qualifiers="const">
113 <return type="bool" />
114 <param index="0" name="value" type="float" />
115 <description>
116 Returns [code]true[/code] if the array contains [param value].
117 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
118 </description>
119 </method>
120 <method name="insert">
121 <return type="int" />
122 <param index="0" name="at_index" type="int" />
123 <param index="1" name="value" type="float" />
124 <description>
125 Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).
126 </description>
127 </method>
128 <method name="is_empty" qualifiers="const">
129 <return type="bool" />
130 <description>
131 Returns [code]true[/code] if the array is empty.
132 </description>
133 </method>
134 <method name="push_back">
135 <return type="bool" />
136 <param index="0" name="value" type="float" />
137 <description>
138 Appends an element at the end of the array.
139 </description>
140 </method>
141 <method name="remove_at">
142 <return type="void" />
143 <param index="0" name="index" type="int" />
144 <description>
145 Removes an element from the array by index.
146 </description>
147 </method>
148 <method name="resize">
149 <return type="int" />
150 <param index="0" name="new_size" type="int" />
151 <description>
152 Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
153 Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
154 </description>
155 </method>
156 <method name="reverse">
157 <return type="void" />
158 <description>
159 Reverses the order of the elements in the array.
160 </description>
161 </method>
162 <method name="rfind" qualifiers="const">
163 <return type="int" />
164 <param index="0" name="value" type="float" />
165 <param index="1" name="from" type="int" default="-1" />
166 <description>
167 Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
168 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
169 </description>
170 </method>
171 <method name="set">
172 <return type="void" />
173 <param index="0" name="index" type="int" />
174 <param index="1" name="value" type="float" />
175 <description>
176 Changes the float at the given index.
177 </description>
178 </method>
179 <method name="size" qualifiers="const">
180 <return type="int" />
181 <description>
182 Returns the number of elements in the array.
183 </description>
184 </method>
185 <method name="slice" qualifiers="const">
186 <return type="PackedFloat32Array" />
187 <param index="0" name="begin" type="int" />
188 <param index="1" name="end" type="int" default="2147483647" />
189 <description>
190 Returns the slice of the [PackedFloat32Array], from [param begin] (inclusive) to [param end] (exclusive), as a new [PackedFloat32Array].
191 The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]).
192 If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).
193 </description>
194 </method>
195 <method name="sort">
196 <return type="void" />
197 <description>
198 Sorts the elements of the array in ascending order.
199 [b]Note:[/b] [constant @GDScript.NAN] doesn't behave the same as other numbers. Therefore, the results from this method may not be accurate if NaNs are included.
200 </description>
201 </method>
202 <method name="to_byte_array" qualifiers="const">
203 <return type="PackedByteArray" />
204 <description>
205 Returns a copy of the data converted to a [PackedByteArray], where each element has been encoded as 4 bytes.
206 The size of the new array will be [code]float32_array.size() * 4[/code].
207 </description>
208 </method>
209 </methods>
210 <operators>
211 <operator name="operator !=">
212 <return type="bool" />
213 <param index="0" name="right" type="PackedFloat32Array" />
214 <description>
215 Returns [code]true[/code] if contents of the arrays differ.
216 </description>
217 </operator>
218 <operator name="operator +">
219 <return type="PackedFloat32Array" />
220 <param index="0" name="right" type="PackedFloat32Array" />
221 <description>
222 Returns a new [PackedFloat32Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead.
223 </description>
224 </operator>
225 <operator name="operator ==">
226 <return type="bool" />
227 <param index="0" name="right" type="PackedFloat32Array" />
228 <description>
229 Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal floats at the corresponding indices.
230 </description>
231 </operator>
232 <operator name="operator []">
233 <return type="float" />
234 <param index="0" name="index" type="int" />
235 <description>
236 Returns the [float] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error.
237 Note that [float] type is 64-bit, unlike the values stored in the array.
238 </description>
239 </operator>
240 </operators>
241 </class>