Difference between revisions of "Application:configureFrustum"
(→Description: changed Application to application) |
(prefixindex) |
||
Line 1: | Line 1: | ||
− | + | '''Available since:''' Gideros 2015.04.04<br/> | |
− | < | + | '''Class:''' [[Application|Application]]<br/> |
− | + | === Description === | |
− | |||
− | |||
− | |||
− | |||
− | === | ||
− | |||
Configure the field of view (fov) and far clipping plane for 3D projection. | Configure the field of view (fov) and far clipping plane for 3D projection. | ||
Line 21: | Line 15: | ||
<br/> | <br/> | ||
− | is eye location. The far clipping plane specifies the maximum distance of an object. Objects more distant than the far clipping plane are not drawn. | + | Z is the eye location. The far clipping plane specifies the maximum distance of an object. Objects more distant than the far clipping plane are not drawn. |
<br/> | <br/> | ||
− | Note the perspective is oriented so that the full screen is at Z=0 (so sprite:setPosition(x,y,0) will place the sprite at exactly (x,y) pixels on the screen, irrespective of fov) and distant objects are placed at negative Z values. | + | '''Note:''' the perspective is oriented so that the full screen is at Z=0 (so sprite:setPosition(x,y,0) will place the sprite at exactly (x,y) pixels on the screen, irrespective of fov) and distant objects are placed at negative Z values. |
<br/> | <br/> | ||
<br/> | <br/> | ||
Line 32: | Line 26: | ||
If fov is set at 0 then the eye is at +infinity and a near plane is set at z=+farplane. Objects closer than this are clipped. The farplane remains at z=-farplane. | If fov is set at 0 then the eye is at +infinity and a near plane is set at z=+farplane. Objects closer than this are clipped. The farplane remains at z=-farplane. | ||
− | |||
<br/> | <br/> | ||
<br/> | <br/> | ||
Line 41: | Line 34: | ||
<br/> | <br/> | ||
− | === | + | === Parameters === |
− | '''fov''': (number) | + | '''fov''': (number) Specifies the field of view angle in degrees If fov>0 a perspective projection is used with the eye at position z=+h/tan(fov/2) where h is half the larger screen dimension (logical coordinates). In this case there is a farplane but no nearplane: clipping is done only at the eye position. If fov=0, an orthographic projection is used with both a farplane and a nearplane (see below) |
+ | <br/> | ||
+ | '''farplane''': (number) The distance of the far clipping plane along Z axis. If fov>0 and this value is not set, the farplane is set at distance 100*(screen height) from the origin (z=0). If fov=0 (orthographic projection), a nearplane is also used at distance farplane from the origin. If fov=0 and no farplane is set then near and farplanes are set at 1 pixel from the origin. '''optional''' | ||
<br/> | <br/> | ||
− | + | ||
+ | ---- | ||
+ | {{Special:PrefixIndex/Application}} | ||
<br/> | <br/> | ||
+ | |||
+ | {{Special:PrefixIndex/Event.APPLICATION}} |
Revision as of 11:52, 2 December 2019
Available since: Gideros 2015.04.04
Class: Application
Description
Configure the field of view (fov) and far clipping plane for 3D projection.
Setting a fov of 0 selects default orthographic projection (no perspective).
The field of view specifies the angle of vision by which the largest side of the scene is seen. It is used to compute the distance of the eye relative to the screen along the Z axis:
Z=(largest screen dimension/2)/tan(fov/2)
Z is the eye location. The far clipping plane specifies the maximum distance of an object. Objects more distant than the far clipping plane are not drawn.
Note: the perspective is oriented so that the full screen is at Z=0 (so sprite:setPosition(x,y,0) will place the sprite at exactly (x,y) pixels on the screen, irrespective of fov) and distant objects are placed at negative Z values.
If the fov is set at non-zero then perspective projection is activated. If farplane is then not set it takes the default value 100*(screen height). Normally the user should set this value. Note that there is no nearplane in perspective mode (objects are clipped only at the eye position)
If fov is set at 0 then the eye is at +infinity and a near plane is set at z=+farplane. Objects closer than this are clipped. The farplane remains at z=-farplane.
application:configureFrustum(fov,farplane)
Parameters
fov: (number) Specifies the field of view angle in degrees If fov>0 a perspective projection is used with the eye at position z=+h/tan(fov/2) where h is half the larger screen dimension (logical coordinates). In this case there is a farplane but no nearplane: clipping is done only at the eye position. If fov=0, an orthographic projection is used with both a farplane and a nearplane (see below)
farplane: (number) The distance of the far clipping plane along Z axis. If fov>0 and this value is not set, the farplane is set at distance 100*(screen height) from the origin (z=0). If fov=0 (orthographic projection), a nearplane is also used at distance farplane from the origin. If fov=0 and no farplane is set then near and farplanes are set at 1 pixel from the origin. optional
- Application
- Application.CONSTANTS
- Application.LANDSCAPE LEFT
- Application.LANDSCAPE RIGHT
- Application.PORTRAIT
- Application.PORTRAIT UPSIDE DOWN
- Application:applyStyles
- Application:canOpenUrl
- Application:checkPermission
- Application:configureFrustum
- Application:enableDrawInfo
- Application:enableOnDemandDraw
- Application:exit
- Application:get
- Application:getApiVersion
- Application:getAppId
- Application:getBackgroundColor
- Application:getClipboard
- Application:getContentHeight
- Application:getContentWidth
- Application:getDeviceHeight
- Application:getDeviceInfo
- Application:getDeviceName
- Application:getDeviceOrientation
- Application:getDeviceSafeArea
- Application:getDeviceWidth
- Application:getFps
- Application:getKeyboardModifiers
- Application:getLanguage
- Application:getLocale
- Application:getLogicalBounds
- Application:getLogicalHeight
- Application:getLogicalScaleX
- Application:getLogicalScaleY
- Application:getLogicalTranslateX
- Application:getLogicalTranslateY
- Application:getLogicalWidth
- Application:getNativePath
- Application:getOrientation
- Application:getProjectProperties
- Application:getScaleMode
- Application:getScreenDensity
- Application:getTextureMemoryUsage
- Application:isPlayerMode
- Application:openUrl
- Application:requestPermissions
- Application:set
- Application:setBackgroundColor
- Application:setClipboard
- Application:setEventMerging
- Application:setFps
- Application:setFullScreen
- Application:setKeepAwake
- Application:setKeyboardVisibility
- Application:setLogicalDimensions
- Application:setOrientation
- Application:setScaleMode
- Application:setTextInput
- Application:setWindowSize
- Application:vibrate