<<<<<<<<<<<<<<<<<

texture_map_cut(display) Display texture_map_cut(display)

NAME

texture_map_cut - generate texture coordinates to simulate a planar cut

DESCRIPTION

The texture_map_cut object takes as input a display_data object that must contain points. Each point is assigned a texture coordinate by calculating its distance to a cut plane. The plane is defined with a point and a normal. A special texture map exits for use with this object in: textures/cut.texture.

SUPERCLASS

display_filter

INSTANCE VARIABLES

normal defines a normal to the cut plane. This will be normalized by the object before it is used.

point defines a point on the plane.

texture_index is the index (0 or 1) of the texture coordinate to be set. By linking together two texture_map_cut's, two cut planes can be specified.

MESSAGES

center! sets the point to the center of the inpu display_data.

pull:amount moves the plane by the specified amount opposite the direction of the normal. Modifies the point instance variable.

push:amount moves the plane by the specified amount in the direction of the normal. Modifies the point instance variable.

EXAMPLE

/* Illustrate the texture_map_cut disaply data filter */ /* In: scripts/filters/texture_map_cut.scr */

/* Create two spheres */ sphere_modeller new: asphere radius=10 resolution=4; sphere_modeller new: anothersphere radius=5 resolution=4;

/* Define the filter */

texture_map_cut new: cutter normal=(1,1,1) point=(0,0,0) pull: .1 data_in=asphere ;

texture_map_cut new: cutter2 normal=(-1,-1,-1) point=(0,0,0) pull:.1 data_in=cutter texture_index=1 ;

display_all new: asphere_da data_in=cutter2; display_all new: anothersphere_da data_in=anothersphere;

/* Get the texture that does cutting */ /* File is in lymb/textures */ texture new: atexture file=`cut.texture' read! ;

/* The sphere to be cut */ actor new: anactor texture=atexture modeller=asphere_da ;

/* The other sphere */ actor new: anotheractor scale=(.8,.8,.8) color=(1,1,0) modeller=anothersphere_da ;

renderer new: aren actors=[actor instances?] render! ;

/* Create a scalar for random number */ scalar new: `anum';

/* Spin the cut plane */ cue new: spin duration=1000 tick_actions=` cutter point=(0,0,0); cutter normal= ([anum drand48?],[anum drand48?],[anum drand48?]); cutter normal+ (-.5,-.5,-.5);

' ;

! ascene start!; will get things going scene new: ascene cues=spin renderers=aren;

SEE ALSO

display_feature, display_filter, data_geometry, display_data, texture_map_to_plane, texture, actor


Please send comments and suggestions to
consult@rpi.edu