Synopsis
define an editor for a Graphics Display Kit camera
GDcamera_edit_notify_templ
group GDcamera_edit_notify_templ
{
float from_x;
float from_y;
float from_z;
float up_x;
float up_y;
float up_z;
float at_x;
float at_y;
float at_z;
float scale;
float wsize;
float fov;
float front;
float back;
int perspec;
int hither;
int depth_cue;
float depth_front;
float depth_back;
float depth_scale;
enum type { choices = {"3D", "2D"}; };
enum auto_norm { choices = {"None", "Data Change", "Object Attach",
"Data and Object"}; };
float norm_scale;
int image_pass;
int pickable;
enum extents { choices = {"Compute", "Window"}; };
enum mapping { choices = {"World", "Pixel"}; };
float jitter_scale;
GDcamera_templ+IPort2 &camera;
};
GDcamera_edit_templ
GDcamera_edit_notify_templ GDcamera_edit_templ {
int+IPort2 shell_vis;
int reset;
GDcamera_templ+IPort2 &camera {
int+read dep;
};
method+notify_inst+notify_val upd_func = "GDcamera_edit_update";
};
GDcamera_edit
GDcamera_edit_templ GDcamera_edit;
Description
These templates define an editor for a Graphics Display Kit camera. GDcamera_edit_notify_templ and GDcamera_edit_templ define the elements that cause the camera editor's method to execute. GDcamera_edit is the version you instance.
As an alternative to using GDcamera_edit and having to define your own user interface for the editor, you can use CameraEditor, an application component. CameraEditor contains GDcamera_edit and defines a user interface.
Input Ports
shell_vis
This parameter controls whether the editor is active: 0 means it is not; 1 means it is.
shell_vis is only checked if the camera to which the editor is attached has changed. In this case, if shell_vis is not set to 1, the editor does not update. This inhibits updates to the editor's other subobjects -- which are normally attached to UI widgets -- when the user interface is not visible. The editor always executes when the values of the other parameters change. This means that the camera to which the editor is attached is always updated even if the user interface is not visible.
Typically you connect shell_vis to the same UIcmd object that the user selects to display the editor's user interface:
shell_vis => UICmd.do;
camera
The camera controlled by GDcamera_edit. camera is a connection to an object that matches type GDcamera_templ.
Parameters
from_x
from_y
from_z
The X, Y, and Z position in world coordinates of the camera.
up_x
up_y
up_z
An X, Y, and Z direction vector indicating the vertical axis of the camera.
at_x
at_y
at_z
The X, Y, and Z position in world coordinates at which the camera is pointed.
scale
The scale term that is applied to the camera.
wsize
For parallel cameras only, a scale factor in world coordinates that determines the range of viewing.
fov
For perspective cameras only, the angle in degrees formed by the edges of the field of view volume. fov must be a value between 0 and 180.
front
The distance in world coordinates from the camera's origin (from) to the front clip plane. The distance is measured along the front-at line.
The valid values of front depends on the type of camera. If the camera's type is parallel, then front can be any value, positive or negative. If the camera's type is perspective, then front can be any positive value.
back
The distance in world coordinates from the camera's origin (from) to the back clip plane. The distance is measured along the front-at line. The value must be greater than front for both parallel and perspective cameras.
perspec
The camera type: 0 means it is parallel; 1 means it is perspective.
hither
Whether front and back clipping is in effect: 0 means it is not; 1 means it is.
depth_cue
Whether depth cueing is in effect: 0 means it is not; 1 means it is.
depth_front
The distance in world coordinates from the camera's origin (from) to where depth cueing begins. The distance is measured along the front-at line.
depth_back
The distance in world coordinates from the camera's origin (from) to where the maximum depth scale is applied. The distance is measured along the front-at line.
depth_scale
The maximum depth scale.
Specify a value between 0 and 1. For example, 0.1 means that a factor of 0.1 is applied to locations at and further than depth_back.
view is updated: 0 means no; 1 means yes.
type
This parameter controls the camera's type:
Value |
Meaning |
Symbolic constant |
0 |
3D camera |
GD_CAMERA_3D |
1 |
2D camera |
GD_CAMERA_2D |
auto_norm
This parameter controls if and when the objects in the camera are normalized to fit in the view.
Value |
Meaning |
Symbolic constant |
0 |
No auto- normalization. |
GD_CAMERA_AUTO_NORM_NONE |
1 |
Auto-normalize when the data's extents become larger. |
GD_CAMERA_AUTO_NORM_DATA |
2 |
Auto-normalize when an object is attached to the camera. |
GD_CAMERA_AUTO_NORM_ATTACH |
3 |
Auto- normalize when either the data's extents become larger or an object is attached to the camera. |
GD_CAMERA_AUTO_NORM_ALL |
norm_scale
This parameter applies a scale to normalization. By default, norm_scale is set to 0.8, indicating that when normalization takes place, any objects will be scaled to fill 80% of the camera.
image_pass
This parameter controls if there is a separate pass to render the images in 2D cameras. A value of 1 means all images are rendered in a separate pass prior to all other objects in the 2D camera. A value of 0 means that images are rendered in the same pass as all other objects. When a separate image pass is enabled, images are rendered "behind" the other objects in the camera. Otherwise, all objects in the camera are rendered in the order that they were attached to the camera.
pickable
This parameter controls if the camera is pickable. 0 means the camera is not pickable; 1 means the camera is pickable. When the camera is not pickable, all the objects in that camera are unpickable as well. Use this subelement if there are objects in the view such as annotation or legends that should not be transformed.
extents
This parameter controls how the extents of the objects connected to the camera are computed when doing normalization:
Value |
Meaning |
Symbolic constant |
0 |
Compute the extents from the objects' data. |
GD_CAMERA_COMPUTE_EXTENT |
1 |
GD_CAMERA_USE_WINDOW |
mapping
This parameter controls the mapping of the camera:
Value |
Meaning |
Symbolic constant |
0 |
Map data to world space. |
GD_CAMERA_MAP_WORLD |
1 |
Map data to pixel space. This effectively sets the camera's wsize to the camera's number of pixels divided by 2. This is useful for image data. |
GD_CAMERA_MAP_PIXELS |
jitter_scale
This parameter is used to scale the jitter offset that can be applied to any of the objects in the camera. Jitter offset is used to move objects either positively or negatively in the camera in order to resolve the ambiguity in rendering objects at the same depth. Jitter_scale is useful for adjusting the amount of the jitter offset in order to reduce artifacts that may be introduced in cases where the objects are very thin geometries. Note that when an object is locked, its coordinates are not transformed, thus they are not jittered.
reset
This parameter when set causes the camera attached to the editor to be reset to its default values.
Example
Libraries.Graphics_Display.Editors.UI_Editors.CameraEditor
File
v/gd.v