automated snapshot

This commit is contained in:
sumi
2025-12-26 00:55:59 -06:00
parent 91fb552651
commit 5755e953b2
3 changed files with 92 additions and 11 deletions

View File

@@ -11,10 +11,11 @@ type ContourLayer struct {
maxActors uint32
actors []*Actor
actorIndex uint32
actorColor rl.Color
rng *rand.Rand
}
func NewContourLayer(sketch *Sketch, rng *rand.Rand, field Field) *ContourLayer {
func NewContourLayer(sketch *Sketch, rng *rand.Rand, field Field, color rl.Color) *ContourLayer {
maxActors := 200000
@@ -25,15 +26,14 @@ func NewContourLayer(sketch *Sketch, rng *rand.Rand, field Field) *ContourLayer
field: field,
actors: actors,
maxActors: uint32(maxActors),
actorColor: color,
actorIndex: 0,
}
//layer.AddActors(1, sketch.sourceWidth, sketch.sourceHeight)
return &layer
}
func (s *ContourLayer) AddActors(n, sourceWidth, sourceHeight int32) {
func (s *ContourLayer) AddActors(color rl.Color, n, sourceWidth, sourceHeight int32) {
for range n {
x := s.rng.Int31() % sourceWidth
y := s.rng.Int31() % sourceHeight
@@ -42,7 +42,7 @@ func (s *ContourLayer) AddActors(n, sourceWidth, sourceHeight int32) {
position: rl.Vector2{X: float32(x), Y: float32(y)},
field: s.field,
stepSize: 1,
color: rl.NewColor(11, 35, 176, 50),
color: s.actorColor,
}
s.actors[s.actorIndex] = newActor
s.actorIndex = (s.actorIndex + 1) % s.maxActors
@@ -50,7 +50,7 @@ func (s *ContourLayer) AddActors(n, sourceWidth, sourceHeight int32) {
}
func (s *ContourLayer) Update(ctx *RenderCtx) {
s.AddActors(100, ctx.SourceWidth, ctx.SourceHeight)
s.AddActors(s.actorColor, 100, ctx.SourceWidth, ctx.SourceHeight)
}
func (s *ContourLayer) Draw(ctx *RenderCtx) {