camera

 

Tag: camera
Parent tag: cameras
Attributes: name – string
Child tags:

  • viewport (string) – the name of a previously defined viewport
  • POSITION (vec4) – default 0.0f, 0.0f, 0.0f, 1.0f
  • VIEW (vec4) – default 0.0f, 0.0f, -1.0f, 0.0f
  • LOOK_AT_POINT (vec4) – default 0.0f, 0.0f, -1.0f, 1.0f
  • ZX_ANGLE (float) – default 3.14159
  • ELEVATION_ANGLE (float) – default 0.0
  • UP – vec4 (default 0.0f, 1.0f, 0.0f, 0.0f
  • FOV (float) – default 60.0
  • NEARP (float) – default 1.0
  • FARP (float) – default 1000.0
  • LEFT (float) – default -1.0
  • RIGHT (float) – default 1.0
  • TOP (float) – default 1.0
  • BOTTOM (float) – default -1.0
  • TYPE (enum) – possible values: {PERSPECTIVE, ORTHO} (default PERSPECTIVE)

Description:

This tag defines a camera. The camera type can be “PERSPECTIVE” or “ORTHO”, and different sets of attributes apply. The attributes LEFT, RIGHT, TOP, and BOTTOM are only meaningful for orthographic cameras. These attributes together with NEARP and FARP, the distance to the near and far planes, respectively, define the view frustum.

For perspective cameras the frustum is defined with FOV, the vertical field of view, NEARP, and FARP.

The camera direction can be defined in three different ways using:

  • VIEW – defines the view direction
  • LOOK_AT_POINT – the view direction is built as LOOK_AT_POINT - POSITION
  • ZX_ANGLE and ELEVATION_ANGLE – These are spherical coordinates (in radians) for the view direction. The ZX_ANGLE is zero when the view direction points in the positive Z axis. The ELEVATION_ANGLEis zero when the view direction is horizontal.

Examples:
– Setting camera with position and view direction:

	
<camera name="MainCamera" >
	<viewport name="MainViewport" />
	<POSITION x=-0.8143 y=1.066161 z=1.525997 />
	<VIEW x=0.300459 y=-0.560906 z=-0.771433 />
</camera>

– Setting camera with spherical coordinates

	
	<camera name="MainCamera" >
		<viewport name="MainViewport" />
		<TYPE value="PERSPECTIVE"/>
		<FOV value=60/>
		<NEARP value= 1/>
		<FARP value= 100/>
		<POSITION x=-16.4 y=9 z=-14.2 />
		<ZX_ANGLE value = 0.76/>
		<ELEVATION_ANGLE value=-0.24/>
		<UP x=0 y=1 z=0 />
	</camera>