|
TNTmips Downloads Menu

|
startOrbit.sml
### startOrbit.sml
#####################################################################################
### For a script to run under TNTsim3D, it must include an instance of
### class TNTSIM3D named "TNTsim3D". The script must also be saved as an RVC
### object in the TNTsim3D Landscape File you want to run it with.
#####################################################################################
# declare class instance for TNTsim3D interface class
class TNTSIM3D TNTsim3D;
class POINT3D viewer, center, orientation;
numeric elev;
numeric roll;
numeric radius; # radius of orbit
numeric heading; # heading of viewer in azimuth
numeric direction; # direction of view in internal cartesian coordinate system
# set fog parameters
class COLOR background;
background.red = 71;
background.green = 90;
background.blue = 100;
TNTsim3D.BackgroundColor = background;
TNTsim3D.UseBackgroundColor = 1;
TNTsim3D.FogType = "ExponentialTwo";
TNTsim3D.FogDensity = 8.00;
TNTsim3D.UseFog = 1;
# set parameters for initial scene (in map coordinates
# of primary terrain); use coordinates appropriate to
# your Landscape File
center.x = 562773; # initial view center coordinates
center.y = 5116225;
TNTsim3D.GetElevation(center, elev);
center.z = elev;
viewer.x = 563397; # initial viewer coordinates
viewer.y = 5126070;
TNTsim3D.GetElevation(viewer, elev);
viewer.z = elev + 3380;
# set initial scene using viewer and center positions
TNTsim3D.SetScene(viewer, center, 0);
### compute radius of orbit from current viewer and center positions
radius = sqrt( sqr(viewer.x - center.x) + sqr(viewer.y - center.y) );
#######################################################################
### get viewer position and orientation from current scene to
### get present heading
#######################################################################
TNTsim3D.GetSceneByOrientation(viewer, orientation);
heading = orientation.z; # azimuth angle from viewer toward center in degrees
# clockwise from north
########################################################################
### SML function name predefined in TNTsim3D, called for each frame.
########################################################################
func OnFrame()
{
# increment heading
heading = heading + 0.2;
# reverse heading and convert to direction angle (counter-clockwise from x axis)
# to compute next viewer position in orbit
direction = 180 - (heading - 90);
if (direction < 0) then
direction = direction + 360;
# compute new viewer x and y position from direction angle
viewer.x = center.x + (radius * cosd(direction) );
viewer.y = center.y + (radius * sind(direction) );
# set scene with new viewer position and center on orbit center
TNTsim3D.SetScene(viewer, center, 0);
}
########################################################################
### SML function name predefined in TNTsim3D, called when right mouse
### button is pressed.
########################################################################
func OnRightButtonPress()
{
Exit();
}
©MicroImages, Inc. 2013 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010 USA
Business & Sales: (402)477-9554 Support: (402)477-9562 Fax: (402)477-9559
Business info@microimages.com
Support support@microimages.com
Web webmaster@microimages.com
| |