cmlibs / zinc

Source code repository for OpenCMISS-Zinc
Mozilla Public License 2.0
15 stars 18 forks source link

JSON export sometimes gives invalid JSON output. #200

Closed hsorby closed 2 years ago

hsorby commented 2 years ago

When creating web-gl output using sparc-converter two of the output files have invalid trailing commas. Here is one example of the invalid JSON produced:

{
    "metadata" : {
        "formatVersion" : 3,
        "description" : "Exported from LibZinc."
    },

    "materials" : [ {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "my_material",
    "colorDiffuse" : [0.9, 0.9, 0.7],
    "colorSpecular" : [0.1, 0.1, 0.1],
    "shading" : "Phong",
    "specularCoef" : 20,
    "opacity" : 1,
    "vertexColors" : true
    }],

}

Looks like it is expecting something further after materials to be present. Maybe these regions are empty? Haven't fully investigated yet.

hsorby commented 2 years ago

The region isn't empty, it does only have nodes though and they are not visualised.

alan-wu commented 2 years ago

This occurs when graphics is created but the region does not contain any primitive that can be rendered for the said graphics. I will add additional check for these conditions.