From 02ea99129e8f3882914431374c60a7d80c5146e1 Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Mon, 21 Aug 2017 00:17:24 +1000 Subject: Adding a new Camera Server implementation to Godot. This is a new singleton where camera sources such as webcams or cameras on a mobile phone can register themselves with the Server. Other parts of Godot can interact with this to obtain images from the camera as textures. This work includes additions to the Visual Server to use this functionality to present the camera image in the background. This is specifically targetted at AR applications. --- doc/classes/@GlobalScope.xml | 3 ++ doc/classes/ARVRInterface.xml | 7 ++++ doc/classes/CameraFeed.xml | 64 +++++++++++++++++++++++++++++++++ doc/classes/CameraServer.xml | 83 +++++++++++++++++++++++++++++++++++++++++++ doc/classes/CameraTexture.xml | 25 +++++++++++++ doc/classes/Environment.xml | 8 ++++- doc/classes/VisualServer.xml | 13 ++++++- 7 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 doc/classes/CameraFeed.xml create mode 100644 doc/classes/CameraServer.xml create mode 100644 doc/classes/CameraTexture.xml (limited to 'doc/classes') diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index ba31a774fc..d36a545c56 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -18,6 +18,9 @@ [AudioServer] singleton + + [CameraServer] singleton + [ClassDB] singleton diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml index 11084fb98e..c286811b5d 100644 --- a/doc/classes/ARVRInterface.xml +++ b/doc/classes/ARVRInterface.xml @@ -10,6 +10,13 @@ + + + + + If this is an AR interface that requires displaying a camera feed as the background, this method returns the feed id in the [CameraServer] for this interface. + + diff --git a/doc/classes/CameraFeed.xml b/doc/classes/CameraFeed.xml new file mode 100644 index 0000000000..7f353f7a05 --- /dev/null +++ b/doc/classes/CameraFeed.xml @@ -0,0 +1,64 @@ + + + + A camera feed gives you access to a single physical camera attached to your device. + + + A camera feed gives you access to a single physical camera attached to your device. + When enabled Godot will start capturing frames from the camera which can then be used. Do note that many cameras will return YCbCr images which are split into two textures and need to be combined in a shader. Godot does this automatically for you if you set the environment to show the camera image in the background. + + + + + + + + + Get unique id for this feed + + + + + + + Get name of the camera + + + + + + + Position of camera on the device. + + + + + + + + + + + + No image set for the feed. + + + Feed supplies RGB images. + + + Feed supplies YCbCr images that need to be converted to RGB. + + + Feed supplies separate Y and CbCr images that need to be combined and converted to RGB. + + + Unspecified position. + + + Camera is mounted at the front of the device. + + + Camera is moutned at the back of the device. + + + diff --git a/doc/classes/CameraServer.xml b/doc/classes/CameraServer.xml new file mode 100644 index 0000000000..bc76c306fb --- /dev/null +++ b/doc/classes/CameraServer.xml @@ -0,0 +1,83 @@ + + + + Our camera server keeps track of different cameras accessible in Godot. These are external cameras such as webcams or the cameras on your phone. + + + + + + + + + + + + + Adds a camera feed to the camera server. + + + + + + + Returns an array of [CameraFeed]s. + + + + + + + + + Returns the [CameraFeed] with this id. + + + + + + + Returns the number of [CameraFeed]s registered. + + + + + + + + + Removes a [CameraFeed]. + + + + + + + + + Emitted when a [CameraFeed] is added (webcam is plugged in). + + + + + + + Emitted when a [CameraFeed] is removed (webcam is removed). + + + + + + The RGBA camera image. + + + The YCbCr camera image. + + + The Y component camera image. + + + The CbCr component camera image. + + + diff --git a/doc/classes/CameraTexture.xml b/doc/classes/CameraTexture.xml new file mode 100644 index 0000000000..7477be7825 --- /dev/null +++ b/doc/classes/CameraTexture.xml @@ -0,0 +1,25 @@ + + + + This texture gives access to the camera texture provided by a [CameraFeed]. Note that many cameras supply YCbCr images which need to be converted in a shader. + + + + + + + + + + Id of the [CameraFeed] for which we want to display the image. + + + Convenience property that gives access to the active property of the [CameraFeed]. + + + Which image within the [CameraFeed] we want access to, important if the camera image is split in a Y and CbCr component. + + + + + diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index 2a4ab4ce0d..eb94447529 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -57,6 +57,9 @@ Speed of the auto exposure effect. Affects the time needed for the camera to perform auto exposure. + + The id of the camera feed to show in the background. + Maximum layer id (if using Layer background mode). @@ -266,7 +269,10 @@ Display a [CanvasLayer] in the background. - + + Display a camera feed in the background. + + Helper constant keeping track of the enum's size, has no direct usage in API calls. diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index 3997798cca..d4ca1194d2 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -3359,6 +3359,17 @@ + + + + + + + + + Binds the texture to a texture slot. + + @@ -4427,7 +4438,7 @@ - + -- cgit v1.2.3