Open ioxu opened 1 year ago
In test_lines.gd
lines are generated by a method that returns a PoolVector2Array
. I made a utility function that returns a new PoolVector2Array
offset by a Vector2
.
To complete symmetry of a single square, 8 additional offsets were generated for line point positions.
8 additional pooled arrays were copied for colour and width arrays.
For test_lines.gd
, default parameters,
do_tiling
off
: 177 ms
do_tiling
on
: 341 ms
(192%)
lines.append(line)
if do_tiling:
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( idim , 0.0 ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( -idim , 0.0 ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( idim , idim ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( -idim , idim ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( idim , -idim ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( -idim , -idim ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( 0.0 , idim ) ) )
lines.append( Util.copyOffset_PoolVector2Array( line, Vector2( 0.0 , -idim ) ) )
var vc : PoolColorArray
if Global.vector_direction == "tangent":
vc = vcolours_simple(line, 0.0)
else:
vc = vcolours_simple(line)
lines_colours.append( vc )
if do_tiling:
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
lines_colours.append( vc )
var vw = Util.randf_range(thickness_max, thickness_min)
lines_widths.append( vw )
if do_tiling:
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
lines_widths.append( vw )
ideas
findings:
Tiling and symmetry should probably be built into each
texture_scene
itself, implicit in theirgenerate
functions.