automated snapshot
This commit is contained in:
14
field.go
14
field.go
@@ -124,9 +124,21 @@ func (fl *FieldLayer) IsDirty() bool {
|
|||||||
return fl.dirty
|
return fl.dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AdderField struct {
|
||||||
|
fields []Field
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *AdderField) Get(x, y float32) float32 {
|
||||||
|
var z float32 = 0.0
|
||||||
|
for _, field := range f.fields {
|
||||||
|
z += rl.Clamp(field.Get(x, y), 0.0, 1.0) / float32(len(f.fields))
|
||||||
|
}
|
||||||
|
return z
|
||||||
|
}
|
||||||
|
|
||||||
type SinXYField struct {}
|
type SinXYField struct {}
|
||||||
|
|
||||||
func (f *SinXYField) Get(x, y float32) float32 {
|
func (f *SinXYField) Get(x, y float32) float32 {
|
||||||
return float32(math.Sin(float64(x * y)))
|
return float32(0.5 + 0.5*math.Sin(float64(x))*math.Sin(float64(y)))
|
||||||
|
//return float32(math.Sin(float64(x * y)))
|
||||||
}
|
}
|
||||||
|
|||||||
13
main.go
13
main.go
@@ -10,7 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
g "github.com/d2fn/sumi/internal/graphics"
|
g "github.com/d2fn/sumi/internal/graphics"
|
||||||
//"github.com/ojrac/opensimplex-go"
|
"github.com/ojrac/opensimplex-go"
|
||||||
|
|
||||||
gui "github.com/gen2brain/raylib-go/raygui"
|
gui "github.com/gen2brain/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "github.com/gen2brain/raylib-go/raylib"
|
||||||
@@ -58,7 +58,7 @@ func main() {
|
|||||||
|
|
||||||
rng := rand.New(rand.NewSource(0))
|
rng := rand.New(rand.NewSource(0))
|
||||||
//imageField := NewImageField("/home/d/Dropbox/art/data/david.png")
|
//imageField := NewImageField("/home/d/Dropbox/art/data/david.png")
|
||||||
//noiseField := &SimplexNoiseField { Noise: opensimplex.New32(0) }
|
noiseField := &SimplexNoiseField { Noise: opensimplex.New32(0) }
|
||||||
sinXYField := &SinXYField { }
|
sinXYField := &SinXYField { }
|
||||||
//imageField := NewImageField("/home/d/Dropbox/art/data/ramstatue.png")
|
//imageField := NewImageField("/home/d/Dropbox/art/data/ramstatue.png")
|
||||||
//imageField := NewImageField("/home/d/Dropbox/art/data/bassrockastro/Photo Dec 24 2025, 5 58 23 PM.jpg")
|
//imageField := NewImageField("/home/d/Dropbox/art/data/bassrockastro/Photo Dec 24 2025, 5 58 23 PM.jpg")
|
||||||
@@ -69,8 +69,13 @@ func main() {
|
|||||||
x: -float32(sourceWidth / 2.0),
|
x: -float32(sourceWidth / 2.0),
|
||||||
y: -float32(sourceHeight / 2.0),
|
y: -float32(sourceHeight / 2.0),
|
||||||
field: &ScaleField{
|
field: &ScaleField{
|
||||||
scale: 500.0,
|
scale: 100.0,
|
||||||
field: sinXYField,
|
field: &AdderField {
|
||||||
|
fields: []Field {
|
||||||
|
sinXYField,
|
||||||
|
noiseField,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user