DefaultObject


Synopsis

define a Graphics Display Kit object

GDobj_data_notify_templ


group+Port  GDobj_data_notify_templ
{
group+IPort2+nosave  &input {
data_method  render;
};
method+notify_inst+notify_val data_func = "GDobject_data";
};

 

GDobj_notify_templ


group+Port  GDobj_notify_templ
{
DatamapTempl+IPort2  &dmap;
GDxform_templ+IPort2  &xform;
GDxform_templ+IPort2 &alt_xform;
GDxform_templ+IPort2 &txtr_xform;
GDprops_templ+IPort2  &props;
GDmodes_templ+IPort2  &modes;
GDtexture_templ+IPort2  &texture;
int  nobjs;
group+IPort2  *objects[] {
GDxform_templ  &xform;
GDprops_templ  &props;
GDmodes_templ  &modes;
GDpick_info_templ  &pick_info;
};
int  visible;
enum space { choices = {"Match Camera", "Force 2D"}; };
int cached;
int cache_size;
enum xform_mode {choices = {"Normal", "Parent", "Alternate", "Locked"}; };
enum surf_conv { choices = {"Simple", "Optimal"}; };
int chunk;
int surf_chunk;
int line_chunk;
int surf_subdiv;
int  active;
enum type { choices = {"Static", "Dynamic"}; };
enum dith_tech { choices = {"Cube", "Ramp"}; };
enum interp_type { choices = {"Point", "Bilinear", "Bicubic"}; };
int tmap_method;
int tri_subdiv_type;
int tri_subdiv_aval;
int tri_subdiv_fval;
int missing_val;
float  window[6];
int use_altobj;
group+IPort2 &altobj {
GDxform_templ  &xform;
GDprops_templ  &props;
GDmodes_templ  &modes;
GDpick_info_templ  &pick_info;
};
string name;
ptr+nonotify+write local_ptr;
method+notify_inst+notify_val upd_func = "GDobject_update";
method+notify_deinst del_func = "GDobject_delete";
};

 

GDobject_templ


GDobj_data_notify_templ+GDobj_notify_templ+Port GDobject_templ {
GDpick_info_templ+IPort2 &pick_info;
int pickable;
Cells+Cell_Data cell_set_2d {
ncell_sets=0;
cell_set {
int cell_set_3d;
int cells_3d[ncells];
};
};
};


 

GDobject


GDobject_templ  GDobject
{
nobjs => array_size(objects);
};


 

DefaultObject


GDobject  DefaultObject
{
visible = 1;
space = 0;
pickable = 1;
cached = 1;
cache_size = 8;
xform_mode = GD_XFORM_MODE_NORMAL;
surf_conv = GD_SURF_CONV_OPTIMAL;
chunk = 1;
surf_chunk = 1000;
line_chunk = 10000;
surf_subdiv = 1;
type = GD_OBJ_STATIC;
dith_tech = GD_TECH_DITHER;
interp_type = GD_FILTER_POINT;
tmap_method = 0;
tri_subdiv_type = 1;
tri_subdiv_aval = 16;
tri_subdiv_fval = 4;
missing_val = 0;
missing_rgb = {0,0,0};
window = {-1,1,-1,1,-1,1};
use_altobj = 0;
};

Description

These templates define a Graphics Display Kit object. GDobject_data_notify_templ and GDobject_notify_templ defines the elements that cause the object's methods to execute. GDobject_templ adds additional elements that do not cause method execution. GDobject defines an instanceable version without default values. DefaultObject defines an instanceable version with default values.

Input Ports

input

The data to render. input is a connection to any data that has a method called render.

dmap

The object's optional datamap. dmap is a connection to an object that matches type Datamap. The datamap allows conversion from node or cell data to RGB values.

xform

A transformation. xform is a connection to an object that matches type GDxform_templ.

alt_xform

A transformation. alt_xform is a connection to an object that matches type GDxform_templ. alt_xform is used instead of xform when the xform_mode parameter (see below) is set to alternate.

txtr_form

A transformation. txtr_xform is a connection to an object that matches type GDxform_templ. txtr_xform is applied to the texture UV(W) data if present.

props

The object's properties. props is a connection to an object that matches type GDprops_templ.

modes

The object's rendering modes. modes is a connection to an object that matches type GDmodes_templ.

texture

The object's optional texture map. texture is a connection to an object that matches type GDtexture_templ.

objects

Optional connections to one or more child objects.

use_altobj

This parameter controls whether the alternate object is used when rendering. By default, use_altobj is set to 0, disabling use of the alternate object.

altobj

An optional connection to an object to render instead of the object being defined. The object is rendered when parameter active (see below) is set to 1.

pick_info

The object's optional pick information. pick_info is a connection to an object that matches type GDpick_info_templ.

Parameters

nobjs

The number of child objects. This object is automatically updated when the size of the array changes.

visible

This parameter controls whether the object is visible: 0 means no; 1 means yes. When the object is not visible, all its children objects are also not visible

space

This parameter controls whether the object is rendered with primitives that match the space of the camera (either 3D or 2D) or if 2D primitives are always used. A value of 0 matches the space of the camera. A value of 1 forces the use of 2D primitives. This is especially useful when using an alternate object so only 2D primitive are rendered and thereby providing more camera interactivity.

pickable

This parameter controls whether the object is pickable: 0 means no; 1 means yes. When the object is not pickable, all its children objects are also not pickable.

cached

This parameter controls whether the Graphics Display Kit should cache the object's data: 0 means it should not; 1 means it should. The cache is a geometrical representation of the data being rendered. The cache is renderer specific. If an object is rendered in multiple view's with different renderers enabled, there are multiple caches. You should keep this is mind, particularly if the data being rendered is large.

cache_size

This parameter specifies the maximum allowable size of the geometrical cache in megabytes. The default cache size for each object is 8 megabytes. When the object is rendered, a calculation is performed to determine if the object will generate enough geometry to overflow the cache. If it will, the cache is automatically disabled before the rendering process begins. This allows the Graphics Display Kit to render large objects without consuming all the available memory.

xform_mode

This parameter controls the object's transform mode. Depending on the current transform mode, different transforms can be edited when the object is being directly manipulated. The transform mode may be:

Value

Meaning

Symbolic constant

0

Edit the xform of the object.

GD_XFORM_MODE_NORMAL

1

Edit the xform of the object's parent. Adhere to the parent's xform_mode.

GD_XFORM_MODE_PARENT

2

Edit the alt_xform of the object.

GD_XFORM_MODE_ALT

3

Do not edit the xform of the object.

GD_XFORM_MODE_LOCKED

 

surf_conv

This subobject controls how a surface converts to a triangle strip. This feature is supported when the cell type is either triangle, quad, or polyhedron. There are two different types of surface conversion:

•      simple

A value of 0 means the simple conversion should be used. In simple surface conversion, a triangle strip is constructed by adding zero-area triangles. In a typical case, 10,000 triangles are converted into a triangle strip that has 60,000 triangles in the strip.

•      optimal

A value of 1 means to use the optimal conversion. The optimal case rearranges the list of of cells into a triangle strip that is a more efficient representation of the surface. In a typical case, 10,000 triangles turn into a triangle strip that is 20,000 long. Note that the optimization provided by the optimal conversion depends on the existence of shared nodes in the input field.

While the triangle strip can be considerably shorter when using the optimal surface conversion, this manner of surface conversion takes extra time and memory. The amount of temporary storage used by the optimal conversion can roughly be calculated by multiplying the number of triangles by 240. The result is the number of bytes. For example, if you have 10,000 triangles, the temporary storage requirements are 2,400,000 bytes or about 2.3 Mbytes.

Optimal surface conversion is faster with smaller chunk sizes. It is worth experimenting with these controls to determine the configuration that provides the best speed/memory tradeoff for the data sets you are rendering.

chunk

This parameter controls whether chunking is enabled. 0 means disable; 1 means enable. Chunking allows you to control the temporary storage use during surface conversion. If chunking is disabled, the whole surface is converted at once. If chunking is enabled, the surface is converted in chunks as specified by the surface and line chunk sizes. The size is the number of primitives to convert at a time.

surf_chunk

This parameter controls the number of cells to process at once when chunking is enabled and a surface rendering mode is selected.

line_chunk

This parameter controls the number of cells to process at once when chunking is enabled and a line rendering mode is selected.

surf_subdiv

This parameter controls whether quad cells are subdivided and to what extent. Valid values are in the range 1 to 4. A value of 1 means that no subdivision will be done. Values of 2 through 4 mean that each quad cell will be divided upto the number specified if the node data values at the verticies of the quad cell vary too much. For a value of 2, the values may vary up to 50% of the total range of the data. For a value of 3, the values may vary up to 33% of the total range of the data. For a value of 4, the values may vary up to 25% of the total range of the data.

active

This parameter controls whether the alternate object should be rendered instead of the object being defined: 0 means it should not; 1 means it should. The active parameter is set by the track editor when the object is being directly manipulated.

type

This parameter controls whether the object is marked as static or dynamic for accelerate mode rendering. When accelerate mode is set on for the view, the renderer(s) store the image and Z-buffer information for static-type objects. When dynamic-type objects are changed, they are re-rendered into the buffers already containing the rendered static objects -- the static object need not be re-rendered unless it is also changed.

Value

Meaning (accelerate mode on)

Symbolic contant

0

Static

GD_OBJ_STATIC

1

Dynamic

GD_OBJ_DYNAMIC

 

dith_tech

This parameter controls how the datamap is used when scalar images are rendered and when the virtual palette has an 8-bit visual selected. A value of 0 means that the scalar image values are converted to RGB color values and then dithered using the virtual palette's cube. A value of 1 means that the datamap is to be converted to a linear ramp in the system palette. The scalar image values are then converted directly to pixels using the ramp.

interp_type

This parameter controls the interpolation type used to scale an image. 0 means point sampling; 1 means bilinear interpolation. The XIL renderer (SunOS5 only) can also do bicubic interpolation (value 2).

tmap_method

This parameter controls the texture mapping method applied to the object. The default value is 0 or "normal" which is applicable for all platforms. A value of 1 means Vertex Level Texture Mapping (VLTM) and is applicable only in the XGL renderer on SunOS5 on the ZX graphics boards (see the System Prerequisites document).

tri_subdiv_type

This parameter controls the texture mapping subdivision type. A value of 0 is adaptive and a value of 1 is fixed. It is only applicable when using VLTM texture mapping in the XGL renderer on SunOS5 systems with ZX graphics boards (see tmap_method and the System Prerequisites document).

tri_subdiv_aval

This parameter sets the pixel tolerance level when the texture mapping subdivision type is adaptive. In this mode, the triangles are subdivided until the tolerance level is reached. It is only applicable when using VLTM texture mapping in the XGL renderer on SunOS5 systems with ZX graphics boards (see tmap_method and the System Prerequisites document).

tri_subdiv_fval

This parameter sets the number of segments when the texture mapping subdivision type is fixed. In this mode, each triangle is subdivided by the number of segments specified. It is only applicable when using VLTM texture mapping in the XGL renderer on SunOS5 systems with ZX graphics boards (see tmap_method and the System Prerequisites document).

missing_val

This paremeter provides the value to use when rendering areas of scalar images that have been "left empty" due to rotation.

missing_rgb

This parameter provides the values to use when rendering areas of RGB images that have been "left empty" due to rotation.

window

This parameter controls the extents to be used for the window in a normalize operation. The camera to which an object is connected has a parameter called extents. If extents is 0, the camera computes the object's extents from the object's data. If extents is 1, the camera computes the object's extents from window.

window is an array of six floating-point numbers specifying the minimum and maximum extents along X, Y, and Z: Xmin, Ymin, Zmin, Xmax, Ymax, and Zmax.

name

This parameter, if set, is displayed by the object selector. This allows you to define the names that are displayed in the object selector. By default, the name is set to the name of the macro that is instanced.

Example

Libraries.Graphics_Display.Objects.DataObject

File

v/gd.v