func parseMaterial(world *scene.Scene, jsondata map[string]interface{}, material_id string) (material *objects.Material) { log.Println("Parsing Json Material") materialdata := jsondata["materials"].(map[string]interface{})[material_id].(map[string]interface{}) material = new(objects.Material) material.ID = material_id material.Type = materialdata["type"].(string) if materialdata["parameters"].(map[string]interface{})["materials"] == nil { material.Color = util.Uint32toVec3ui8(uint32(materialdata["parameters"].(map[string]interface{})["color"].(float64))) material.Ambient = util.Uint32toVec3ui8(uint32(materialdata["parameters"].(map[string]interface{})["ambient"].(float64))) material.Emissive = util.Uint32toVec3ui8(uint32(materialdata["parameters"].(map[string]interface{})["emissive"].(float64))) material.Transparent = materialdata["parameters"].(map[string]interface{})["transparent"].(bool) material.Reflectivity = float32(materialdata["parameters"].(map[string]interface{})["reflectivity"].(float64)) material.Opacity = float32(materialdata["parameters"].(map[string]interface{})["opacity"].(float64)) material.Wireframe = materialdata["parameters"].(map[string]interface{})["wireframe"].(bool) material.WireframeLinewidth = int32(materialdata["parameters"].(map[string]interface{})["wireframeLinewidth"].(float64)) } else { materials := materialdata["parameters"].(map[string]interface{})["materials"].([]interface{}) for _, v := range materials { id := v.(string) if world.HasMaterial(id) { material.Materials = append(material.Materials, world.GetMaterial(id)) } else { material.Materials = append(material.Materials, parseMaterial(world, jsondata, id)) } } } return }