get_camera_state

Camera as { eye, target, up, projection } in f64 world space (up is the screen up), with moving, and during a transition its goal.

Query

Usage

TypeScript
surface.query('get_camera_state', { viewport? })

Parameters

  • viewportstring

    the slot (viewport id); the first by default

    Optional

Returns

object with eye, target, up, projection, moving, goal, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "eye": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "target": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "up": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "projection": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "perspective",
            "orthographic"
          ]
        },
        "fovYDeg": {
          "type": "number"
        },
        "height": {
          "type": "number"
        }
      },
      "required": [
        "kind"
      ]
    },
    "moving": {
      "type": "boolean"
    },
    "goal": {
      "type": "object",
      "properties": {
        "eye": {
          "type": "object",
          "description": "f64 world-space point or direction",
          "properties": {
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            },
            "z": {
              "type": "number"
            }
          },
          "required": [
            "x",
            "y",
            "z"
          ]
        },
        "target": {
          "type": "object",
          "description": "f64 world-space point or direction",
          "properties": {
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            },
            "z": {
              "type": "number"
            }
          },
          "required": [
            "x",
            "y",
            "z"
          ]
        },
        "up": {
          "type": "object",
          "description": "f64 world-space point or direction",
          "properties": {
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            },
            "z": {
              "type": "number"
            }
          },
          "required": [
            "x",
            "y",
            "z"
          ]
        },
        "projection": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "perspective",
                "orthographic"
              ]
            },
            "fovYDeg": {
              "type": "number"
            },
            "height": {
              "type": "number"
            }
          },
          "required": [
            "kind"
          ]
        }
      },
      "required": [
        "eye",
        "target",
        "up",
        "projection"
      ]
    }
  },
  "required": [
    "eye",
    "target",
    "up",
    "projection"
  ]
}

See also