Skip to content

Commit

Permalink
refactor graph managerment out of app into its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
EliCDavis committed Jan 26, 2025
1 parent db3adfa commit 482b1ee
Show file tree
Hide file tree
Showing 40 changed files with 874 additions and 748 deletions.
20 changes: 6 additions & 14 deletions cmd/polyform/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"os"

"github.com/EliCDavis/polyform/generator"
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/nodes"
"github.com/EliCDavis/polyform/generator/schema"

// Import these so they register their nodes with the generator
_ "github.com/EliCDavis/polyform/formats/gltf"
Expand All @@ -26,24 +25,17 @@ import (
func main() {
app := generator.App{
Name: "Polyform",
Version: "0.21.0",
Version: "0.22.0",
Description: "Immutable mesh processing program",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli C Davis",
ContactInfo: []generator.AuthorContact{
{
Medium: "bsky.app",
Value: "@elicdavis.bsky.social",
},
{
Medium: "github.com",
Value: "EliCDavis",
},
ContactInfo: []schema.AuthorContact{
{Medium: "bsky.app", Value: "@elicdavis.bsky.social"},
{Medium: "github.com", Value: "EliCDavis"},
},
},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{},
}

if err := app.Run(os.Args); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions examples/collar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/artifact/basics"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/math/quaternion"
"github.com/EliCDavis/polyform/math/trs"
"github.com/EliCDavis/polyform/modeling"
Expand Down Expand Up @@ -241,18 +242,18 @@ func main() {
Name: "Spiked Collar Demo",
Version: "0.0.1",
Description: "Small demo that let's you edit a spiked collar",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli Davis",
ContactInfo: []generator.AuthorContact{
ContactInfo: []schema.AuthorContact{
{
Medium: "twitter",
Value: "@EliCDavis",
},
},
},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"mesh.glb": gltfNode.Out(),
mrTexturePath: basics.NewImageNode(nodes.FuncValue(mrTexture)),
collarAlbedoPath: basics.NewImageNode(&CollarAlbedoTextureNode{
Expand Down
2 changes: 1 addition & 1 deletion examples/disco/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func main() {
Name: "Woodland Disco Romance",
Version: "1.0.0",
Description: "Applying color pallettes to a sample room",
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"disco.glb": discoScene.Out(),
"metal.png": basics.NewImageNode(nodes.Value(texture(1, 0))),
"rough.png": basics.NewImageNode(nodes.Value(texture(0, 1))),
Expand Down
10 changes: 5 additions & 5 deletions examples/edit-gaussian-splats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/artifact/basics"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/room"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/math/geometry"
"github.com/EliCDavis/polyform/math/vector"
"github.com/EliCDavis/polyform/modeling/meshops"
Expand Down Expand Up @@ -148,10 +148,10 @@ func main() {
Name: "Edit Gaussian Splats",
Version: "1.0.0",
Description: "Crop and Scale portions of Gaussian Splat data",
Authors: []generator.Author{{Name: "Eli C Davis"}},
WebScene: &room.WebScene{
Authors: []schema.Author{{Name: "Eli C Davis"}},
WebScene: &schema.WebScene{
Background: coloring.Black(),
Fog: room.WebSceneFog{
Fog: schema.WebSceneFog{
Color: coloring.Black(),
Near: 5,
Far: 25,
Expand All @@ -161,7 +161,7 @@ func main() {
AntiAlias: false,
XrEnabled: true,
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"mesh.ply": ply.NewSplatPlyNode(pointcloud.Out()),
"info.txt": basics.NewTextNode(&InfoNode{
Data: InfoNodeData{
Expand Down
10 changes: 5 additions & 5 deletions examples/fired-heater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/EliCDavis/polyform/generator"
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/room"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/modeling/extrude"
"github.com/EliCDavis/polyform/modeling/primitives"
"github.com/EliCDavis/polyform/modeling/repeat"
Expand Down Expand Up @@ -457,13 +457,13 @@ func main() {
Name: "Fired Heater",
Version: "1.0.0",
Description: "Idk making a fired heater",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli C Davis",
},
},
WebScene: &room.WebScene{
Fog: room.WebSceneFog{
WebScene: &schema.WebScene{
Fog: schema.WebSceneFog{
Far: 150,
Near: 10,
Color: coloring.WebColor{R: 0xa0, G: 0xa0, B: 0xa0, A: 255},
Expand All @@ -472,7 +472,7 @@ func main() {
Lighting: coloring.WebColor{R: 0xff, G: 0xfd, B: 0xd1, A: 255},
Ground: coloring.WebColor{R: 0x87, G: 0x82, B: 0x78, A: 255},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"firedheater.glb": firedheaterNode,
},
}
Expand Down
12 changes: 6 additions & 6 deletions examples/pumpkin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/artifact/basics"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/room"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/math/colors"
"github.com/EliCDavis/polyform/math/noise"
"github.com/EliCDavis/polyform/modeling"
Expand Down Expand Up @@ -285,19 +285,19 @@ func main() {
Name: "Pumpkin",
Version: "1.0.0",
Description: "Making a pumpkin for Haloween",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli C Davis",
ContactInfo: []generator.AuthorContact{
ContactInfo: []schema.AuthorContact{
{
Medium: "Twitter",
Value: "@EliCDavis",
},
},
},
},
WebScene: &room.WebScene{
Fog: room.WebSceneFog{
WebScene: &schema.WebScene{
Fog: schema.WebSceneFog{
Near: 2,
Far: 10,
Color: coloring.WebColor{R: 0x13, G: 0x0b, B: 0x3c, A: 255},
Expand All @@ -306,7 +306,7 @@ func main() {
Background: coloring.WebColor{R: 0x13, G: 0x0b, B: 0x3c, A: 255},
Lighting: coloring.WebColor{R: 0xff, G: 0xd8, B: 0x94, A: 255},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"pumpkin.glb": &PumpkinGLBArtifact{
Data: PumpkinGLBArtifactData{
PumpkinBody: pumpkinMesh,
Expand Down
12 changes: 6 additions & 6 deletions examples/rails/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/EliCDavis/polyform/generator"
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/room"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/math"
"github.com/EliCDavis/polyform/math/curves"
"github.com/EliCDavis/polyform/math/trs"
Expand Down Expand Up @@ -213,28 +213,28 @@ func main() {
Name: "Rail Road Demo",
Version: "0.0.1",
Description: "Small demo that let's you build a rail road track",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli Davis",
ContactInfo: []generator.AuthorContact{
ContactInfo: []schema.AuthorContact{
{
Medium: "twitter",
Value: "@EliCDavis",
},
},
},
},
WebScene: &room.WebScene{
WebScene: &schema.WebScene{
Background: coloring.WebColor{R: 0x91, G: 0xd2, B: 0xed},
Ground: coloring.WebColor{R: 0x80, G: 0xac, B: 0x8a},
Lighting: coloring.WebColor{R: 0xFF, G: 0xFF, B: 0xFF},
Fog: room.WebSceneFog{
Fog: schema.WebSceneFog{
Color: coloring.WebColor{R: 0x91, G: 0xd2, B: 0xed},
Near: 10,
Far: 50,
},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"rails.glb": gltfNode.Out(),
},
}
Expand Down
12 changes: 6 additions & 6 deletions examples/structure/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/artifact/basics"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/room"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/math/chance"
"github.com/EliCDavis/polyform/math/quaternion"
"github.com/EliCDavis/polyform/modeling"
Expand Down Expand Up @@ -344,14 +344,14 @@ func main() {
Name: "Structure",
Version: "1.0.0",
Description: "ProcJam 2023 Submission",
Authors: []generator.Author{
Authors: []schema.Author{
{
Name: "Eli C Davis",
ContactInfo: []generator.AuthorContact{{Medium: "Twitter", Value: "@EliCDavis"}},
ContactInfo: []schema.AuthorContact{{Medium: "Twitter", Value: "@EliCDavis"}},
},
},
WebScene: &room.WebScene{
Fog: room.WebSceneFog{
WebScene: &schema.WebScene{
Fog: schema.WebSceneFog{
Near: 2,
Far: 40,
Color: coloring.WebColor{R: 0x9f, G: 0xb0, B: 0xc1, A: 255},
Expand All @@ -360,7 +360,7 @@ func main() {
Background: coloring.WebColor{R: 0x9f, G: 0xb0, B: 0xc1, A: 255},
Lighting: coloring.WebColor{R: 0xff, G: 0xd8, B: 0x94, A: 255},
},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"pipe-normal.png": basics.NewImageNode((&PipeNormalsNode{
Data: PipeNormalsNodeData{
BlurIterations: &parameter.Int{
Expand Down
5 changes: 3 additions & 2 deletions examples/texturing/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/EliCDavis/polyform/generator/artifact"
"github.com/EliCDavis/polyform/generator/artifact/basics"
"github.com/EliCDavis/polyform/generator/parameter"
"github.com/EliCDavis/polyform/generator/schema"
"github.com/EliCDavis/polyform/nodes"
"github.com/fogleman/gg"
)
Expand Down Expand Up @@ -59,8 +60,8 @@ func main() {
app := generator.App{
Name: "Grid Texture",
Version: "1.0.0",
Authors: []generator.Author{{Name: "Eli C Davis"}},
Producers: map[string]nodes.NodeOutput[artifact.Artifact]{
Authors: []schema.Author{{Name: "Eli C Davis"}},
Files: map[string]nodes.NodeOutput[artifact.Artifact]{
"grid.png": basics.NewImageNode(&GridNode{
Data: GridNodeData{
HorizontalLines: lines,
Expand Down
Loading

0 comments on commit 482b1ee

Please sign in to comment.