Generates a random instancing table. 更多...
import 语句: | import QtQuick3D.Helpers |
Since: | Qt 6.2 |
继承: |
The RandomInstancing type provides an easy way to generate a large number of random instances within defined bounds. The number of instances is defined by the instanceCount property. The bounds are defined by the properties position , scale , rotation , color ,和 customData .
另请参阅 InstanceList .
color : InstanceRange |
The color property defines the color variation range for the generated instances. The type is color. The default value is empty, causing the color to be white.
设置 colorModel property makes it possible to select only saturated colors, for example.
另请参阅 position , rotation , scale ,和 customData .
colorModel : enumeration |
This property controls how the color range is interpreted.
The instance colors are generated component by component within the range determined by the from and to colors. The color model determines how those components are defined.
常量 | 描述 |
---|---|
RandomInstancing.RGB
|
The components are red, green, blue, and alpha, according to the RGB color model. |
RandomInstancing.HSV
|
The components are hue, saturation, value, and alpha, according to the HSV Color Model . |
RandomInstancing.HSL
|
The components are hue, saturation, lightness, and alpha,, according to the HSL Color Model . |
As an example, the following color range
color: InstanceRange { from: Qt.hsva(0, 0.1, 0.8, 1) to: Qt.hsva(1, 0.3, 1, 1) }
will generate a full range of pastel colors when using the
HSV
color model, but only shades of pink when using the
RGB
color model.
默认值为
RandomInstancing.RGB
另请参阅 RandomInstancing::color .
customData : InstanceRange |
The customData property defines the custom data variation range for the generated instances. The type is
vector4d
. The default value is empty, causing causing the generated data to be
[0, 0, 0, 0]
.
另请参阅 position , color , rotation , scale , and customData.
instanceCount : int |
The instanceCount property specifies the number of instances to generate. Changing this value will regenerate the whole table.
另请参阅 randomSeed .
position : InstanceRange |
The position property defines the geometrical bounds of the generated instances. The default value is empty, causing a generated position of
[0, 0, 0]
.
另请参阅 color , rotation , scale ,和 customData .
randomSeed : int |
This property defines the seed for the random number generator. Setting this to a value different from -1 guarantees that the instance table will have the same content each time it is generated. Note that adding or changing attributes may cause a completely different table to be generated.
The default value is -1, causing the table to get a new random value each time it is generated.
rotation : InstanceRange |
The rotation property defines the rotation range for the generated instances. The type is
vector3d
, corresponding to a Euler rotation vector
[xRotation, yRotation, zRotation]
. The default value is empty, causing no rotation to be applied.
另请参阅 position , color , scale ,和 customData .
scale : InstanceRange |
The scale property defines the scaling limits for the generated instances. The type is
vector3d
. Set
InstanceRange.proportional
to
true
for uniform scaling. The default value is empty, causing no scaling to be applied.
另请参阅 position , color , rotation , scale, and customData .