GeeXLab
Current version: 0.45.1
>GeeXLab homepage

FurMark
Current version: 1.30.0
>FurMark homepage

GPU Caps Viewer
Current version: 1.55.0.0
>GPU Caps Viewer homepage

GPU Shark
Current version: 0.26.0.0
>GPU Shark homepage


Blogs
>JeGX's HackLab

Geeks3D's Articles
>GPU Memory Speed Demystified

>Multi-Threading Programming Resources

>GeForce and Radeon OpenCL Overview

>How to Get your Multi-core CPU Busy at 100%

>How To Make a VGA Dummy Plug

>Night Vision Post Processing Filter

PhysX FluidMark
Current version: 1.5.4
>FluidMark homepage

TessMark
Current version: 0.3.0
>TessMark homepage

ShaderToyMark
Current version: 0.3.0
>ShaderToyMark homepage
>ShaderToyMark Scores

Demoniak3D
Current Version: 1.23.0
>Demoniak3D
>Download
>Libraries and Plugins
>Demos
>Online Help - Reference Guide
>Codes Samples
 
oZone3D.Net - Demoniak3D Developer Guide


» Back To Index

Demoniak3D/LUA API: Cameras Management library

HYP_Camera is the library of the LUA API which controls the cameras.
HYP_Camera.PositionMoveAlongDirection
HYP_Camera.PositionStrafeHorizontal
HYP_Camera.PositionStrafeVertical
HYP_Camera.Disable
HYP_Camera.Enable
HYP_Camera.GetFarPlane
HYP_Camera.GetFOV
HYP_Camera.GetKeyboardSpeed
HYP_Camera.GeLookAtDirection
HYP_Camera.GetNearPlane
HYP_Camera.GetPosition
HYP_Camera.MakeScreenshot
HYP_Camera.SetScreenshotsDirectory
HYP_Camera.SetFarPlane
HYP_Camera.SetFOV
HYP_Camera.SetKeyboardSpeed
HYP_Camera.SetLookAt
HYP_Camera.SetNearPlane
HYP_Camera.SetOrientation
HYP_Camera.SetPitch
HYP_Camera.SetPosition
HYP_Camera.SetRoll
HYP_Camera.SetTarget
HYP_Camera.SetViewParams
HYP_Camera.SetYaw
HYP_Camera.ShakePosition
HYP_Camera.GetNumCameras
HYP_Camera.GetIdByIndex
HYP_Camera.GetNameByIndex
HYP_Camera.GetId
HYP_Camera.GetName
HYP_Camera.GetProjectionMatrix
HYP_Camera.GetViewMatrix
HYP_Camera.SetViewport
HYP_Camera.GetViewport
HYP_Camera.SetBkgColor

ShakePosition

ShakePosition allows to apply a translation to the camera along the direction vector.
Syntax
HYP_Camera.ShakePosition( camera_name, shake_delay, shake_strength );
  • camera_name - [STR127] - name of the camera as specified in the XML script with the "name" attribute.
  • shake_delay - [REAL] - time in seconds of the tremor.
  • shake_strength - [REAL] - intensity of the tremor.
Example
g_camera_delay = 1.0; 
g_camera_strength = 2.5;
HYP_Camera.ShakePosition( "Main_Camera", g_camera_delay, g_camera_strength );

SetKeyboardSpeed

SetKeyboardSpeed allows to regulate the speed factor of the camera movement keys (AWSD or UP, DOWN, RIGHT and LEFT).
Syntax
HYP_Camera.SetKeyboardSpeed( camera_name, speed );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • speed - [REAL] - displacement speed in units per second - default value: 100.0.

GetKeyboardSpeed

GetKeyboardSpeed allows to get the value of the speed factor of the camera movement keys (AWSD or UP, DOWN, RIGHT and LEFT).
Syntax
speed = HYP_Camera.GetKeyboardSpeed( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • speed - [REAL] - displacement speed in units per second - default value: 100.0.

PositionMoveAlongDirection

PositionMoveAlongDirection allows to apply a translation to the camera along the direction vector.
Syntax
HYP_Camera.PositionMoveAlongDirection( camera_name, speed_x, speed_y, speed_z );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • speed_x - [REAL] - translation X coefficient.
  • speed_y - [REAL] - translation Y coefficient.
  • speed_z - [REAL] - translation Z coefficient.
Example
HYP_Camera.PositionMoveAlongDirection( "main_cam", 2.0, 0.0, 2.0 );

PositionStrafeHorizontal

PositionStrafeHorizontal allows to apply a translation to the camera along the X local axis.
Syntax
HYP_Camera.PositionStrafeHorizontal( camera_name, speed );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • speed - [REAL] - translation coefficient.
Example
HYP_Camera.PositionStrafeHorizontal( "main_cam", 2.0 );
...

PositionStrafeVertical

PositionStrafeVertical allows to apply a translation to the camera along the Y local axis.
Syntax
HYP_Camera.PositionStrafeVertical( camera_name, speed );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • speed - [REAL] - translation coefficient.
Example
HYP_Camera.PositionStrafeVertical( "main_cam", 4.0 );
...

GetLookAtDirection

GetLookAtDirection allows to get the vector direction of the camera. This vector is a unitary vector i.e. its norm equals 1.
Syntax
x, y, z = HYP_Camera.GetLookAtDirection( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • x - [REAL] - X coordinate of the direction vector.
  • y - [REAL] - Y coordinate of the direction vector.
  • z - [REAL] - Z coordinate of the direction vector.
Example
dir_x, dir_y, dir_z = HYP_Camera.GetLookAtDirection( "main_cam" );
...

SetLookAt

SetLookAt allows to set the position of the aiming point.
Syntax
HYP_Camera.SetLookAt( camera_name, x, y, z, w );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • x - [REAL] - X coordinate of the aiming point position.
  • y - [REAL] - Y coordinate of the aiming point position.
  • z - [REAL] - Z coordinate of the aiming point position.
  • w - [REAL] - allows to specify if the {x, y, Z } triplet expresses a position in the 3d space (w=1.0) or a direction vector (w=0.0).
Example
-- the camera fixes the {10.0, -30.0, -200.0} point
HYP_Camera.SetLookAt( "main_cam", 10.0, -30.0, -200.0, 1.0 );
...

SetPitch

SetPitch allows to orient the camera around its X axis.
Syntax
HYP_Camera.SetPitch( camera_name, angle );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • angle - [REAL] - rotation angle in degrees around the X axis of its local reference mark.
Example
HYP_Camera.SetPitch( "main_cam", -30.0 );
...

SetYaw

SetYaw allows to orient the camera around its Y axis.
Syntax
HYP_Camera.SetYaw( camera_name, angle );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • angle - [REAL] - rotation angle in degrees around the Y axis of its local reference mark.
Example
HYP_Camera.SetYaw( "main_cam", 10.0 );
...

SetRoll

SetRoll allows to orient the camera around its Z axis.
Syntax
HYP_Camera.SetRoll( camera_name, angle );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • angle - [REAL] - aswing angle in degrees around the Z axis of its local reference mark.
Example
HYP_Camera.SetRoll( "main_cam", 5.0 );
...

SetOrientation

SetOrientation allows to change the orientation of the camera by specifying a quaternion (rotation angle AND rotation axis).
Syntax
HYP_Camera.SetOrientation( camera_name, angle, x, y, z );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • angle - [REAL] - rotation angle in degrees around the axis defined by X, Y and Z.
  • x - [REAL] - X component of the rotation axis
  • y - [REAL] - Y component of the rotation axis
  • z - [REAL] - Z component of the rotation axis
Example
HYP_Camera.SetOrientation( "main_cam", -30.0, 0.0, 1.0, 0.0 );
...

SetViewParams

SetViewParams allows to change the basic parameters of the camera: the position and its aiming point.
Syntax
HYP_Camera.SetViewParams( camera_name, 
pos_x, pos_y, pos_z, 
lookatpos_x, lookatpos_y, lookatpos_z, 
up_x, up_y, up_z );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • pos_x - [REAL] - X position.
  • pos_y - [REAL] - Y position.
  • pos_z - [REAL] - Z position.
  • lookatpos_x - [REAL] - X coordinate of the aiming point position.
  • lookatpos_y - [REAL] - Y coordinate of the aiming point position.
  • lookatpos_z - [REAL] - Z coordinate of the aiming point position.
  • up_x - [REAL] - X coordinate of the orientation vector.
  • up_y - [REAL] - Y coordinate of the orientation vector.
  • up_z - [REAL] - Z coordinate of the orientation vector.

SetFarPlane

SetFarPlane allows to change the distance from the far clipping plane of the camera. This distance is relating to the position of the camera.
Syntax
HYP_Camera.SetFarPlane( camera_name, far );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • far - [REAL] - distance from the far clipping plane.
Example
HYP_Camera.SetFarPlane( "main_cam", 1000.0 );
...

SetNearPlane

SetNearPlane allows to change the distance from the near clipping plane to the camera. This distance is relating to the position of the camera.
Syntax
HYP_Camera.SetNearPlane( camera_name, near );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • near - [REAL] - distance from the near clipping plane.
Example
HYP_Camera.SetNearPlane( "main_cam", 1.0 );
HYP_Camera.SetFarPlane( "main_cam", 1000.0 );

GetFarPlane

GetFarPlane allows to get the distance from the far clipping plane of the camera. This distance is relating to the position of the camera.
Syntax
far = HYP_Camera.GetFarPlane( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • far - [REAL] - distance from the far clipping plane.
Example
far = HYP_Camera.GetFarPlane( "main_cam" );
...

GetNearPlane

GetNearPlane allows to get the distance from the near clipping plane of the camera. This distance is relating to the position of the camera.
Syntax
near = HYP_Camera.GetNearPlane( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • near - [REAL] - distance from the near clipping plane.

Enable

Enable allows to enable the camera passed as parameter.
Syntax
HYP_Camera.Enable( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.

Disable

Disable allows to disable the camera passed as parameter.
Syntax
HYP_Camera.Disable( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.

SetFOV

SetFOV allows to change the value of the angle of vision (the FOV) of the camera passed as parameter.
Syntax
HYP_Camera.SetFOV( name, fov );
  • name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • fov - [REAL] - value of the Field Of View (or aperture angle) of the camera (in degrees).
Example
HYP_Camera.SetFOV( "main_cam", 130.0 );
...

GetFOV

GetFOV allows to get the value of the angle of vision (the FOV) of the camera passed as parameter.
Syntax
fov = HYP_Camera.GetFOV( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • fov - [REAL] - value of the Field Of View (or aperture angle) of the camera (in degrees).

SetPosition

SetPosition allows to change the position of the camera passed as parameter.
Syntax
HYP_Camera.SetPosition( camera_name, x, y, z );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • x - [REAL] - X position.
  • y - [REAL] - Y position.
  • z - [REAL] - Z position.
Example
HYP_Camera.SetPosition( "main_cam", 50.0, -60.0, 200.0 );
...

GetPosition

GetPosition allows to get the position of the camera passed as parameter.
Syntax
x, y, z = HYP_Camera.GetPosition( camera_name );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • x - [REAL] - position en X.
  • y - [REAL] - position en Y.
  • z - [REAL] - position en Z.
Example
pos_x, pos_y, pos_z = GetPosition( "main_cam" );
...

MakeScreenshot

MakeScreenshot allows to make a capture (screenshot) of the current frame. This screen capture can be saved in different ways: whether in the specified directory or in the Hyperion configuration file or by the SetDirForScreenshots() function. This function has no parameter and does not return anything. For the moment, it creates only JPEG image files.

The name of the image file follows this syntax: dir/img_xxxxxx.jpg where "dir" is the saving directory and xxxxxx the frame count numbers.
Syntax
HYP_Camera.MakeScreenshot();
Example
HYP_Camera.SetScreenshotsDirectory( "screenshots" );
HYP_Camera.MakeScreenshot();

SetScreenshotsDirectory

SetScreenshotsDirectory allows to specify the screenshots saving directory.
Syntax
HYP_Camera.SetScreenshotsDirectory( dirname );
  • dirname - [STR255] - name of the directory where the screenshots have to be saved.

SetTarget

SetTarget allows to change the target object of the camera.
Syntax
HYP_Camera.SetTarget( camera_name, target_name|target_id );
  • camera_name - [STR127] - name of the camera as specified in the XML script by the "name" attribute.
  • target_name|target_id - [STR127 | INTEGER] - camera's target object.
Example
HYP_Camera.SetTarget( "Main_Camera", "myGizmo" );
...
Remark
In order not to put more targets for the camera, just specify " NULL " for the name of the target object:
HYP_Camera.SetTarget( "Main_Camera", "NULL" );

GetNumCameras

GetNumCameras returns the number of available cameras in the camera list of the scene at a given time.
Syntax
n = HYP_Camera.GetNumCameras();
  • n - [INTEGER] - number of cameras in the scene.

GetIdByIndex

GetIdByIndex allows to know the identifier of a camera according to its position in the camera list of the scene.
Syntax
id = HYP_Camera.GetIdByIndex( index );
  • index - [INTEGER] - index of the camera in the camera list of the scene.
  • id - [INTEGER] - identifier of the camera.

GetNameByIndex

GetNameByIndex allows to know the name of a camera according to its position in the camera list of the scene.
Syntax
name = HYP_Camera.GetNameByIndex( index );
  • index - [INTEGER] - index of the camera in the camera list of the scene.
  • name - [STR64] - name of the camera.

GetId

GetId allows to know the identifier of a camera according to itsname.
Syntax
id = HYP_Camera.GetId( name );
  • name - [STR64] - name of the camera.
  • id - [INTEGER] - identifier of the camera.

GetName

GetName allows to know the name of a camera according to its identifier.
Syntax
name = HYP_Camera.GetName( id );
  • id - [INTEGER] - identifier of the camera.
  • name - [STR64] - name of the camera.

GetProjectionMatrix

GetProjectionMatrix returns the camera's current projection matrix. This matrix uses the OpenGL conventions:
| m0   m4    m8    m12 |
| m1   m5    m9    m13 |
| m2   m6    m10   m14 |
| m3   m7    m11   m15 |
Syntax
m0 to m15 = HYP_Camera.GetProjectionMatrix( name|id );
  • name - [STR127] - camera's name.
  • id - [INTEGER] - camera's identifier.

GetViewMatrix

GetProjectionMatrix returns the camera's current view matrix. This matrix uses the OpenGL conventions:
| m0   m4    m8    m12 |
| m1   m5    m9    m13 |
| m2   m6    m10   m14 |
| m3   m7    m11   m15 |
Syntax
m0 to m15 = HYP_Camera.GetViewMatrix( name|id );
  • name - [STR127] - camera's name.
  • id - [INTEGER] - camera's identifier.

SetViewport

SetViewport changes the camera's viewport.
Syntax
HYP_Camera.SetViewport( name|id, offset_x, offset_y, width, height );
  • name - [STR127] - camera's name.
  • id - [INTEGER] - camera's identifier.
  • offset_x, offset_y - [INTEGER] - viewport x and y offset. Default values: 0.
  • width, height - [INTEGER] - width and height of the viewport.

GetViewport

GetViewport returns the camera's viewport.
Syntax
offset_x, offset_y, width, height = HYP_Camera.GetViewport( name|id );
  • name - [STR127] - camera's name.
  • id - [INTEGER] - camera's identifier.
  • offset_x, offset_y - [INTEGER] - viewport x and y offset. Default values: 0.
  • width, height - [INTEGER] - width and height of the viewport.

SetBkgColor

SetBkgColor changes the camera's viewport background color.
Syntax
HYP_Camera.SetBkgColor( name|id, r, g, b );
  • name - [STR127] - camera's name.
  • id - [INTEGER] - camera's identifier.
  • r, g, b - [CLAMPED_REAL] - color.


GeeXLab demos


GLSL - Mesh exploder


PhysX 3 cloth demo


Normal visualizer with GS


Compute Shaders test on Radeon


Raymarching in GLSL



Misc
>Texture DataPack #1
>Asus Silent Knight CPU Cooler
Page generated in 0.0034248828887939 seconds.