|
@@ -1,11 +1,24 @@
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="PoolRealArray" version="3.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<class name="PoolRealArray" version="3.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
<brief_description>
|
|
- A pooled array of reals ([float]).
|
|
|
|
|
|
+ A pooled array of real numbers ([float]).
|
|
</brief_description>
|
|
</brief_description>
|
|
<description>
|
|
<description>
|
|
An array specifically designed to hold floating-point values. Optimized for memory usage, does not fragment the memory.
|
|
An array specifically designed to hold floating-point values. Optimized for memory usage, does not fragment the memory.
|
|
- [b]Note:[/b] This type is passed by value and not by reference.
|
|
|
|
|
|
+ [b]Note:[/b] This type is passed by value and not by reference. This means that when [i]mutating[/i] a class property of type [PoolRealArray] or mutating a [PoolRealArray] within an [Array] or [Dictionary], changes will be lost:
|
|
|
|
+ [codeblock]
|
|
|
|
+ var array = [PoolRealArray()]
|
|
|
|
+ array[0].push_back(12.34)
|
|
|
|
+ print(array) # [[]] (empty PoolRealArray within an empty Array)
|
|
|
|
+ [/codeblock]
|
|
|
|
+ Instead, the entire [PoolRealArray] property must be [i]reassigned[/i] with [code]=[/code] for it to be changed:
|
|
|
|
+ [codeblock]
|
|
|
|
+ var array = [PoolRealArray()]
|
|
|
|
+ var pool_array = array[0]
|
|
|
|
+ pool_array.push_back(12.34)
|
|
|
|
+ array[0] = pool_array
|
|
|
|
+ print(array) # [[12.34]] (PoolRealArray with 1 element inside an Array)
|
|
|
|
+ [/codeblock]
|
|
[b]Note:[/b] Unlike primitive [float]s which are 64-bit, numbers stored in [PoolRealArray] are 32-bit floats. This means values stored in [PoolRealArray] have lower precision compared to primitive [float]s. If you need to store 64-bit floats in an array, use a generic [Array] with [float] elements as these will still be 64-bit. However, using a generic [Array] to store [float]s will use roughly 6 times more memory compared to a [PoolRealArray].
|
|
[b]Note:[/b] Unlike primitive [float]s which are 64-bit, numbers stored in [PoolRealArray] are 32-bit floats. This means values stored in [PoolRealArray] have lower precision compared to primitive [float]s. If you need to store 64-bit floats in an array, use a generic [Array] with [float] elements as these will still be 64-bit. However, using a generic [Array] to store [float]s will use roughly 6 times more memory compared to a [PoolRealArray].
|
|
</description>
|
|
</description>
|
|
<tutorials>
|
|
<tutorials>
|