code: def json_object(t):
      # TODO make material depend on object type
      if t["geometry"]["type"] == "text":
          mesh = sage_handlers["text"](t)
      elif t["geometry"]["type"] == "point":
          mesh = sage_handlers["point"](t)
      elif t["geometry"]["type"] == "line":
          mesh = sage_handlers["line"](t)
      else:
          m = sage_handlers["texture"](t["texture"])
          g = sage_handlers[t["geometry"]["type"]](t["geometry"])
          mesh = Mesh(geometry=g, material=m)
          if t.get("mesh", False) is True:
              wireframe_material = BasicMaterial(
                  color=0x222222,
                  transparent=True,
                  opacity=0.2,
                  wireframe=True,
              )
              mesh = Object3d(
                  children=[
                      mesh,
                      Mesh(geometry=g, material=wireframe_material),
                  ]
              )
      if t["geometry"]["type"] in ("cone", "cylinder"):
          # Sage assumes the base is on the xy plane and the cylinder axis is parallel to the z-axis
          m = [
              1,
              0,
              0,
              0,
              0,
              0,
              1,
              0,
              0,
              -1,
              0,
              0,
              0,
              0,
              t["geometry"]["height"] / 2,
              1,
          ]
          mesh = Object3d(children=[mesh]).set_matrix(m)
      return mesh
  
file_path: pythreejs/pythreejs/sage.py
label_desc: Use image node_id 2 for calling a global function with example usage: json_object(t) and returns: mesh