OverviewFilesCommitsIssuesDocsReleasesPeers

nvidia-rtx-godot / doc / classes / CameraServer.xml

111 lines · xml ref:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CameraServer" inherits="Object" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		Server keeping track of different cameras accessible in Godot.
	</brief_description>
	<description>
		The [CameraServer] keeps track of different cameras accessible in Godot. These are external cameras such as webcams or the cameras on your phone.
		It is notably used to provide AR modules with a video feed from the camera.
		[b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available. To get a [CameraFeed] on iOS, enable [member EditorExportPlatformIOS.modules/camera].
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="add_feed">
			<return type="void" />
			<param index="0" name="feed" type="CameraFeed" />
			<description>
				Adds the camera [param feed] to the camera server.
			</description>
		</method>
		<method name="feeds">
			<return type="CameraFeed[]" />
			<description>
				Returns an array of [CameraFeed]s.
			</description>
		</method>
		<method name="get_feed">
			<return type="CameraFeed" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the [CameraFeed] corresponding to the camera with the given [param index].
			</description>
		</method>
		<method name="get_feed_count">
			<return type="int" />
			<description>
				Returns the number of [CameraFeed]s registered.
			</description>
		</method>
		<method name="remove_feed">
			<return type="void" />
			<param index="0" name="feed" type="CameraFeed" />
			<description>
				Removes the specified camera [param feed].
			</description>
		</method>
	</methods>
	<members>
		<member name="monitoring_feeds" type="bool" setter="set_monitoring_feeds" getter="is_monitoring_feeds" default="false">
			If [code]true[/code], the server is actively monitoring available camera feeds.
			This has a performance cost, so only set it to [code]true[/code] when you're actively accessing the camera.
			[b]Note:[/b] After setting it to [code]true[/code], you can receive updated camera feeds through the [signal camera_feeds_updated] signal.
			[codeblocks]
			[gdscript]
			func _ready():
				CameraServer.camera_feeds_updated.connect(_on_camera_feeds_updated)
				CameraServer.monitoring_feeds = true

			func _on_camera_feeds_updated():
				var feeds = CameraServer.feeds()
			[/gdscript]
			[csharp]
			public override void _Ready()
			{
				CameraServer.CameraFeedsUpdated += OnCameraFeedsUpdated;
				CameraServer.MonitoringFeeds = true;
			}

			void OnCameraFeedsUpdated()
			{
				var feeds = CameraServer.Feeds();
			}
			[/csharp]
			[/codeblocks]
		</member>
	</members>
	<signals>
		<signal name="camera_feed_added">
			<param index="0" name="id" type="int" />
			<description>
				Emitted when a [CameraFeed] is added (e.g. a webcam is plugged in).
			</description>
		</signal>
		<signal name="camera_feed_removed">
			<param index="0" name="id" type="int" />
			<description>
				Emitted when a [CameraFeed] is removed (e.g. a webcam is unplugged).
			</description>
		</signal>
		<signal name="camera_feeds_updated">
			<description>
				Emitted when camera feeds are updated.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="FEED_RGBA_IMAGE" value="0" enum="FeedImage">
			The RGBA camera image.
		</constant>
		<constant name="FEED_YCBCR_IMAGE" value="0" enum="FeedImage">
			The [url=https://en.wikipedia.org/wiki/YCbCr]YCbCr[/url] camera image.
		</constant>
		<constant name="FEED_Y_IMAGE" value="0" enum="FeedImage">
			The Y component camera image.
		</constant>
		<constant name="FEED_CBCR_IMAGE" value="1" enum="FeedImage">
			The CbCr component camera image.
		</constant>
	</constants>
</class>