![]() |
![]() |
![]() |
![]() |
DefaultCamera2d, DefaultCamera3d
Synopsis
define a Graphics Display Kit camera
group GDcamera_notify_templ {
int+read update;
enum type {
choices = {"3D", "2D"};
};
enum mode {
choices = {"Manual", "Automatic"};
};
enum auto_norm {
choices = {"None", "Data Change", "Object Attach", "Data and Object"};
};
float norm_scale;
int norm_invisible;
enum extents {
choices = {"Compute", "Window"};
};
enum mapping {
choices = {"World", "Pixel"};
};
int image_pass;
int pickable;
/* array of objects to render */
int nobjs;
GDobject_templ+IPort2+read *objects[];
prim+read ptr_depends[] => objects.local_ptr;
/* viewport specification */
float xmin;
float ymin;
float xmax;
float ymax;
/* camera orientation */
float from[3];
float up[3];
float at[3];
float scale;
GDxform_templ+IPort2 &xform;
/* camera projection */
int perspec;
int hither;
float front;
float back;
float fov;
float wsize;
/* depth cue information */
int depth_cue<animate=1>;
float depth_front<animate=1>;
float depth_back<animate=1>;
float depth_scale<animate=1>;
float jitter_scale<animate=1>;
int+write dep<NEvisible=0>;
method+notify_val upd_func = "GDcamera_update";
method+notify_deinst del_func = "GDcamera_delete";
};
GDcamera_notify_templ+OPort GDcamera_templ;
GDcamera_templ GDcamera<NEsmallPixmapName="camera.bmx",
cxx_name="GDXcamera"> {
nobjs => array_size(objects);
ptr+nonotify+write local_ptr<NEvisible=0>;
};GDcamera_notify_templ+OPort GDcamera_templ;
GDcamera_templ GDcamera<NEsmallPixmapName="camera.bmx",
cxx_name="GDXcamera"> {
nobjs => array_size(objects);
ptr+nonotify+write local_ptr<NEvisible=0>;
};GDcamera DefaultCamera {
mode = GD_CAMERA_AUTO_UPDATE;
pickable = 1;
auto_norm = GD_CAMERA_AUTO_NORM_NONE;
norm_scale = GD_DEFAULT_NORM_SCALE;
norm_invisible = GD_DEFAULT_NORM_INVISIBLE;
extents = GD_CAMERA_COMPUTE_EXTENT;
mapping = GD_CAMERA_MAP_WORLD;
xmin = 0.0; /* viewport spec. */
ymin = 0.0;
xmax = 1.0;
ymax = 1.0;
from = {0.0, 0.0, 12.0};
up = {0.0, 1.0, 0.0};
at = {0.0, 0.0, 0.0};
scale = 1.0;
perspec = 0;
hither = 0;
front = GD_DEFAULT_FRONT_PAR; /* perspec == 0 */
back = GD_DEFAULT_BACK;
fov = GD_DEFAULT_VIEW_ANGLE;
wsize = GD_DEFAULT_WSIZE;
depth_cue = 0;
depth_front = GD_DEFAULT_DEPTH_FRONT;
depth_back = GD_DEFAULT_DEPTH_BACK;
depth_scale = GD_DEFAULT_DEPTH_SCALE;
jitter_scale = 1.0;
};DefaultCamera DefaultCamera2D {
type = GD_CAMERA_2D;
image_pass = 1;
};DefaultCamera DefaultCamera3D {
type = GD_CAMERA_3D;
image_pass = 0;
};Description
These templates define a Graphics Display Kit camera. GDcamera_notify_templ defines the elements that cause the camera's methods to execute. GDcamera is used to define a camera without default values. DefaultCamera2D define a 2D camera with default values; in other words, Graphics Display Kit objects connected to DefaultCamera2D are rendered in 2D. DefaultCamera3D defines a 3D camera with default values; in other words, Graphics Display Kit objects connected to DefaultCamera3D are rendered in 3D.
Input
One or more objects to be rendered. This input port is an array of connections to objects matching type GDobject_templ.
A transformation that represents the camera's orientation. xform is a connection to an object that matches type GDxform_templ. The subelements from, at, up and scale are used to calculate the transformation.
Parameters
When the mode parameter (see below) is set to 0, determines whether the view is updated: 0 means no; 1 means yes.
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.
This parameter controls how the extents of the objects connected to the camera are computed when doing normalization:
Map data to pixel space. This effectively sets the camera's wsize parameter to the camera's number of pixels divided by 2. This is useful for image data.
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.
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 also unpickable. Use this subelement if objects in the view, such as annotation or legends, should not be transformed.
The number of Graphics Display Kit objects connected to the camera. nobjs is updated automatically when the size of the array changes.
The camera's viewport; that is, the region it occupies in the view. For the purposes of specifying a viewport, point (0,0) is the top-left corner of the view and point (1,1) is the bottom-right corner. The viewport specification is not currently supported by the camera.
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.
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.back must be greater than front for both parallel and perspective cameras.
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.
For parallel cameras only, a scale factor in world coordinates that determines the range of viewing.
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.
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.
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.
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.
Example
Libraries.Graphics_Display.Views.View2D Libraries.Graphics_Display.Views.View3D
File
See also related modules
![]() |
![]() |
![]() |
![]() |