@@ -8,31 +8,9 @@ import (
88 "os"
99
1010 "github.com/Patch2PDF/GDTF-Mesh-Reader/v2/pkg/MeshTypes"
11- GDTFTypes "github.com/Patch2PDF/GDTF-Parser/pkg/types"
1211 MVRTypes "github.com/Patch2PDF/MVR-Parser/pkg/types"
1312)
1413
15- var colors = map [GDTFTypes.GeometryType ]color.NRGBA {
16- GDTFTypes .GeometryTypeGeometry : {25 , 25 , 25 , 255 },
17- GDTFTypes .GeometryTypeAxis : {25 , 25 , 25 , 255 },
18- GDTFTypes .GeometryTypeFilterBeam : {0 , 0 , 0 , 255 },
19- GDTFTypes .GeometryTypeFilterColor : {0 , 0 , 0 , 255 },
20- GDTFTypes .GeometryTypeFilterGobo : {0 , 0 , 0 , 255 },
21- GDTFTypes .GeometryTypeFilterShaper : {0 , 0 , 0 , 255 },
22- GDTFTypes .GeometryTypeBeam : {200 , 200 , 200 , 255 },
23- GDTFTypes .GeometryTypeMediaServerLayer : {0 , 0 , 0 , 255 },
24- GDTFTypes .GeometryTypeMediaServerCamera : {0 , 0 , 0 , 255 },
25- GDTFTypes .GeometryTypeMediaServerMaster : {0 , 0 , 0 , 255 },
26- GDTFTypes .GeometryTypeDisplay : {0 , 0 , 0 , 255 },
27- GDTFTypes .GeometryTypeGeometryReference : {0 , 0 , 0 , 255 },
28- GDTFTypes .GeometryTypeLaser : {0 , 0 , 0 , 255 },
29- GDTFTypes .GeometryTypeWiringObject : {0 , 0 , 0 , 255 },
30- GDTFTypes .GeometryTypeInventory : {0 , 0 , 0 , 255 },
31- GDTFTypes .GeometryTypeStructure : {0 , 0 , 0 , 255 },
32- GDTFTypes .GeometryTypeSupport : {0 , 0 , 0 , 255 },
33- GDTFTypes .GeometryTypeMagnet : {0 , 0 , 0 , 255 },
34- }
35-
3614type Rotation struct {
3715 Alpha float64
3816 Beta float64
@@ -93,10 +71,15 @@ func drawMeshUpdateBB(mesh MeshTypes.Mesh, canvas *Canvas, color color.NRGBA, bb
9371 }
9472}
9573
96- func drawStageModel (mesh * MVRTypes.StageModel , canvas * Canvas , config RasterizerConfig ) {
74+ func drawStageModel (mesh * MVRTypes.StageModel , canvas * Canvas , config RasterizerConfig ) error {
75+ colors := getOverrideColors (config .OverrideColors )
9776 for _ , obj := range mesh .SceneObjectModels {
9877 for _ , part := range obj .MeshModel {
99- drawMesh (part .Mesh , canvas , colors [part .GeometryType ]) // TODO: obj type specific colors
78+ color , err := colors .getColor (ModelTypeSceneObject , part .GeometryType )
79+ if err != nil {
80+ return fmt .Errorf ("Could not draw stage model: %s" , err )
81+ }
82+ drawMesh (part .Mesh , canvas , color )
10083 }
10184 for _ , geometry := range obj .Geometries {
10285 drawMesh (geometry , canvas , color.NRGBA {100 , 100 , 100 , 255 })
@@ -109,7 +92,11 @@ func drawStageModel(mesh *MVRTypes.StageModel, canvas *Canvas, config Rasterizer
10992 bb .init ()
11093
11194 for _ , part := range fixture .MeshModel {
112- bb , _ = drawMeshUpdateBB (part .Mesh , canvas , colors [part .GeometryType ], bb )
95+ color , err := colors .getColor (ModelTypeFixture , part .GeometryType )
96+ if err != nil {
97+ return fmt .Errorf ("Could not draw stage model: %s" , err )
98+ }
99+ bb , _ = drawMeshUpdateBB (part .Mesh , canvas , color , bb )
113100 }
114101
115102 canvas .fixture_labels = append (
@@ -124,14 +111,19 @@ func drawStageModel(mesh *MVRTypes.StageModel, canvas *Canvas, config Rasterizer
124111 } else {
125112 for _ , fixture := range mesh .FixtureModels {
126113 for _ , part := range fixture .MeshModel {
127- drawMesh (part .Mesh , canvas , colors [part .GeometryType ])
114+ color , err := colors .getColor (ModelTypeFixture , part .GeometryType )
115+ if err != nil {
116+ return fmt .Errorf ("Could not draw stage model: %s" , err )
117+ }
118+ drawMesh (part .Mesh , canvas , color )
128119 }
129120
130121 for _ , geometry := range fixture .Geometries {
131122 drawMesh (geometry , canvas , color.NRGBA {100 , 100 , 100 , 255 })
132123 }
133124 }
134125 }
126+ return nil
135127}
136128
137129func Draw (mesh * MVRTypes.StageModel , config RasterizerConfig ) (* Canvas , error ) {
0 commit comments