[ Back to Geeks3D.com ]
 GeeXLab
Laboratory for Real Time 3D Programming (prototyping and demos) OpenGL, Lua, Python, GLSL, PhysX and more...Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
HYP_Camera Library
Camera management library
Number of functions: 33
HYP_Camera.Create
Creates a new camera object.
: Lua - Python
id [INTEGER]: camera id
:
id = HYP_Camera.Create()
HYP_Camera.Destroy
Destroy an existing camera object.
: Lua - Python
id [INTEGER]: camera id
:
HYP_Camera.Destroy(id)
HYP_Camera.SetActiveState
Sets camera's active state. The state is set to 1 at the camera creation.
: Lua - Python
id [INTEGER]: camera id
state [INTEGER]: active state (0 or 1)
:
HYP_Camera.SetActiveState(id)
HYP_Camera.ApplyToRenderer
Applies camera's matrices to renderer.
: Lua - Python
id [INTEGER]: camera id
:
HYP_Camera.ApplyToRenderer(id)
HYP_Camera.UpdateViewMatrix
Updates camera's view matrix.
: Lua - Python
id [INTEGER]: camera id
:
HYP_Camera.UpdateViewMatrix(id)
HYP_Camera.SetFOV
Sets the field of view (fov) in degrees of a specific camera (id).
: Lua - Python
id [INTEGER]: camera id
fov [REAL]: field of view in degrees.
:
HYP_Camera.SetFOV(id, 130.0)
HYP_Camera.SetFOV_XY
Sets the horizontal and vertical field of view (fov) in degrees of a specific camera (id).
: Lua - Python
id [INTEGER]: camera id
fovX [REAL]: horizontal fov in degrees.
fovY [REAL]: vertical fov in degrees.
:
HYP_Camera.SetFOV_XY(id, 90.0, 130.0)
HYP_Camera.GetFOV
Gets the field of view (fov) in degrees of a specific camera (id).
: Lua - Python
id [INTEGER]: camera id
fov [REAL]: field of view in degrees.
:
fov = HYP_Camera.GetFOV(id)
HYP_Camera.GetPosition
Gets camera position.
: Lua - Python
id [INTEGER]: camera id
pos_x [REAL]: position in X.
pos_y [REAL]: position in Y.
pos_z [REAL]: position in Z.
:
pos_x, pos_y, pos_z = HYP_Camera.GetPosition(id)
HYP_Camera.SetPosition
Sets the camera position.
: Lua - Python
id [INTEGER]: camera id
x [REAL]: position in X.
y [REAL]: position in Y.
z [REAL]: position in Z.
:
HYP_Camera.SetPosition(id, 50.0, -60.0, 200.0)
HYP_Camera.SetViewParams
Allows to change the camera's basic parameters: position, lookat and up vectors.
: Lua - Python
camera_id [INTEGER]: camera id
pos_x [REAL]: position in X.
pos_y [REAL]: position in Y.
pos_z [REAL]: position in Z.
lookat_x [REAL]: position in X of the lookat point.
lookat_y [REAL]: position in Y of the lookat point.
lookat_z [REAL]: position in Z of the lookat point.
up_x [REAL]: X component of orientation vector.
up_y [REAL]: Y component of orientation vector.
up_z [REAL]: Z component of orientation vector.
:
HYP_Camera.SetViewParams(id, pos_x, pos_y, pos_z, lookat_x, lookat_y, lookat_z, up_x, up_y, up_z);
HYP_Camera.SetTarget
Sets the object target (targetId) of a specific camera (id).
: Lua - Python
id [INTEGER]: camera id
target_id [INTEGER]: target object id
:
HYP_Camera.SetTarget(id, target_id)
HYP_Camera.SetPerspectiveProjection
Sets the camera's perspective projection. This function also swithes camera from any previous mode to perspective mode.
: Lua - Python
id [INTEGER]: camera id
fov [REAL]: field of view in degrees
aspect [REAL]: aspect ratio (width/height)
znear [REAL]: camera z near clipping plane
zfar [REAL]: camera z far clipping plane
:
HYP_Camera.SetPerspectiveProjection(id, fov, aspect, znear, zfar)
HYP_Camera.SetTwoFovPerspectiveProjection
Sets the camera's perspective projection. This function also swithes camera from any previous mode to perspective mode.
: Lua - Python
id [INTEGER]: camera id
fovX [REAL]: horizontal fov in degrees
fovY [REAL]: vertical fov in degrees
aspect [REAL]: aspect ratio (width/height)
znear [REAL]: camera z near clipping plane
zfar [REAL]: camera z far clipping plane
:
HYP_Camera.SetPerspectiveProjection(id, fov, aspect, znear, zfar)
HYP_Camera.SetOrthographicProjection
Sets the camera's orthographic projection. This function also swithes camera from any previous mode to orthographic mode.
: Lua - Python
id [INTEGER]: camera id
left [REAL]: left clipping plane
right [REAL]: right clipping plane
bottom [REAL]: bottom clipping plane
top [REAL]: top clipping plane
znear [REAL]: camera z near clipping plane
zfar [REAL]: camera z far clipping plane
:
HYP_Camera.SetOrthographicProjection(id, left, right, bottom, top, znear, zfar)
HYP_Camera.SetViewport
: Lua - Python
camera_id [INTEGER]: camera id
x_offset [INTEGER]: offset in x of the viewport
y_offset [INTEGER]: offset in y of the viewport
width [INTEGER]: width of viewport.
height [INTEGER]: height of viewport.
:
HYP_Camera.SetViewport(camera_id, 0, 0, width, height)
HYP_Camera.GetViewport
: Lua - Python
camera_id [INTEGER]: camera numeric identifier as returned by HYP_Object.GetId()
offset_x [INTEGER]: offset in x of the viewport.
offset_y [INTEGER]: offset in y of the viewport.
width [INTEGER]: width of viewport.
height [INTEGER]: height of viewport.
:
offset_x, offset_y, width, height = HYP_Camera.GetViewport(camera_id)
HYP_Camera.GetNumCameras
Returns the number of cameras in the scene cameras list.
: Lua - Python
n [INTEGER]: number of cameras in the 3D scene.
:
n = HYP_Camera.GetNumCameras()
HYP_Camera.GetIdByIndex
Returns camera's id from its index in scene cameras list.
: Lua - Python
index [INTEGER]: index of the camera in the cameras list of the 3D scene.
id [INTEGER]: camera id
:
id = HYP_Camera.GetIdByIndex(index)
HYP_Camera.SetBkgColor
Changes the background color of the viewport.
: Lua - Python
camera_id [INTEGER]: camera numeric identifier as returned by HYP_Object.GetId()
r [REAL]: Red component of color.
g [REAL]: Green component of color.
b [REAL]: Blue component of color.
:
HYP_Camera.SetBkgColor(camera_id, r, g, b)
HYP_Camera.SetFarPlane
Sets the distance of camera's far clipping plane.
The distance is relative to the camera's position.
: Lua - Python
camera_id [INTEGER]: camera id
far [REAL]: far clipping plane distance
:
HYP_Camera.SetFarPlane( camera_id, 1000.0 )
HYP_Camera.GetFarPlane
GetFarPlane gets the distance of the far clipping plane of camera.
The distance is relative to the camera's position .
: Lua - Python
camera_id [INTEGER]: camera id
far [REAL]: distance of the far clipping plane.
:
far = HYP_Camera.GetFarPlane(camera_id)
HYP_Camera.SetNearPlane
SetNearPlane allows to change the distance of the camera's near clipping plane.
This distance is relative to the camera's position.
: Lua - Python
camera_id [INTEGER]: camera id
near [REAL]: near clipping plane.
:
HYP_Camera.SetNearPlane(camera_id, 1000.0)
HYP_Camera.GetNearPlane
GetNearPlane gets the camera's near clipping plane distance.
This distance is relative to the camera's position.
: Lua - Python
camera_id [INTEGER]: camera id
near [REAL]: near clipping plane distance.
:
near = HYP_Camera.GetFarPlane(camera_id)
HYP_Camera.SetLookAt
Sets the lookat position.
: Lua - Python
camera_id [INTEGER]: camera id
x [REAL]: position in X of the lookat point.
y [REAL]: position in y of the lookat point.
z [REAL]: position in Z of the lookat point.
w [REAL]: Specify wether the {x, y, z} triplet corresponds to a position in space (w=1.0) or to a direction vector (w=0.0).
:
HYP_Camera.SetLookAt(camera_id, 10.0, -30.0, -200.0, 1.0 )
HYP_Camera.GetLookAtDirection
Returns the direction vector of the camera. This vector is a unit vector (normalized).
: Lua - Python
camera_id [INTEGER]: camera numeric identifier as returned by HYP_Object.GetId()
x [REAL]: X component of the direction vector
y [REAL]: Y component of the direction vector
z [REAL]: Z component of the direction vector
:
x, y, z = HYP_Camera.GetLookAtDirection(camera_id)
HYP_Camera.SetOrientation
Sets camera orientation with an angle and a rotation axis.
: Lua - Python
camera_id [INTEGER]: camera id
angle [REAL]: angle of rotation in degrees.
x [REAL]: component in X of rotation axis.
y [REAL]: component in Y of rotation axis.
z [REAL]: component in Z of rotation axis.
:
HYP_Camera.SetOrientation(camera_id, -30.0, 0.0, 1.0, 0.0)
HYP_Camera.SetPitch
Sets camera's X-axis rotation.
: Lua - Python
camera_id [INTEGER]: camera id
angle [REAL]: Rotation angle in degrees around X axis of the local system.
:
HYP_Camera.SetPitch(camera_id, -30.0)
HYP_Camera.SetYaw
Allows to rotate a camera around its Y axis.
: Lua - Python
camera_id [INTEGER]: camera id
angle [REAL]: rotation angle in degrees around Y axis of the local system.
:
HYP_Camera.SetYaw(camera_id, 10.0)
HYP_Camera.SetRoll
Allows to rotate the camera around its Z axis.
: Lua - Python
camera_id [INTEGER]: camera id
angle [REAL]: rotation angle in degrees around Z axis des Z of the local system.
:
HYP_Camera.SetRoll(camera_id, 5.0)
HYP_Camera.GetProjectionMatrix
Returns the 4x4 current projection matrix of camera. This matrix uses OpenGL conventions:
| m0 m4 m8 m12 |
| m1 m5 m9 m13 |
| m2 m6 m10 m14 |
| m3 m7 m11 m15 |
: Lua - Python
camera_id [INTEGER]: camera numeric identifier as returned by HYP_Object.GetId()
m0 .. to .. m15 [REAL]: values of the projection matrix
:
m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = HYP_Camera.GetProjectionMatrix(camera_id)
HYP_Camera.GetViewMatrix
Returns the 4x4 current view matrix of the camera. This matrix uses OpenGL conventions:
| m0 m4 m8 m12 |
| m1 m5 m9 m13 |
| m2 m6 m10 m14 |
| m3 m7 m11 m15 |
: Lua - Python
camera_id [INTEGER]: camera numeric identifier as returned by HYP_Object.GetId()
m0 .. to .. m15 [REAL]: values of the view matrix
:
m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = HYP_Camera.GetViewMatrix(camera_id)
HYP_Camera.MakeScreenshot
Makes a screen capture of the current frame.
This screen capture is saved in the directory specified in the configuration file or by the function SetDirForScreenshots().
: Lua - Python
dirname [STRING]: name of Direcoty in which screen captures are stored.
:
HYP_Camera.SetScreenshotsDirectory("dirname")
|