LitDev Extension API

LD3DView LDArray LDBits LDBlueTooth LDCall
LDChart LDClient LDClipboard LDColours LDCommPort
LDController LDControls LDCursors LDDataBase LDDateTime
LDDebug LDDialogs LDDictionary LDEffect LDEmail
LDEncryption LDEvents LDFastArray LDFastShapes LDFigures
LDFile LDFocus LDftp LDGraph LDGraphicsWindow
LDHID LDImage LDInline LDIOWarrior LDList
LDLogic LDMath LDMathX LDMatrix LDMusic
LDNetwork LDPhysics LDProcess LDQueue LDRegex
LDResources LDScrollBars LDSearch LDServer LDSettings
LDShapes LDShell LDSort LDSound LDSpeech
LDStatistics LDStopwatch LDText LDTextWindow LDTimer
LDTranslate LDUnits LDUtilities LDWaveForm LDWebCam
LDWindows LDxml LDZip

LD3DView
3D Visualisation in the GraphicsWindow.

Coordinates have the following directions and have no correspondence to the GraphicsWindow coordinates.
X - Left(-) to Right(+)
Y - Down(-) to Up(+)
Z - Far(-) to Near(+)

For more details on the underlying methods see http://msdn.microsoft.com/en-us/library/ms747437%28v=vs.90%29.aspx
Several of the AddShape methods use HelixToolkit (recompiled and slightly modified for SmallBasic) http://helixToolkit.codeplex.com


AddAmbientLight AddArrow AddCone
AddCube AddDirectionalLight AddGeometry
AddIcosahedron AddImage AddPipe
AddPointLight AddPyramid AddRectangle
AddRevolute AddSphere AddSpotLight
AddTube AddView AnimateRotation
AnimateRotation2 AnimateTranslation AutoControl
BoundingBox CameraProperties CloneObject
Freeze GetCameraDirection GetCameraPosition
GetCameraUpDirection GetPosition HitTest
LastRotationCompleted LastTranslationCompleted LoadModel
ModifyObject MoveCamera QueuedRotationCompleted
QueuedTranslationCompleted ResetCamera ResetMaterial
ReverseNormals RotateGeometry RotateGeometry2
RotateGeometry3 RotationCompleted ScaleGeometry
SetBillBoard SetCentre SpecularExponent
TranslateGeometry TranslationCompleted

AddAmbientLight(shapeName,colour)
Add an ambient light source.
shapeName The 3DView object.
colour The light colour.
returns The 3DView Light name.

AddArrow(shapeName,length,diameter,arrowLength,arrowDiameter,divisions,colour,materialType)
Add an arrow geometry object pointing up starting at (0,0,0).
shapeName The 3DView object.
length The length of the arrow.
diameter The diameter of the arrow shaft.
arrowLength The length of the arrow head.
arrowDiameter The diameter of the arrow head.
divisions The number of divisions for the arrow (default 18).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddCone(shapeName,baseRadius,topRadius,height,divisions,colour,materialType)
Add a cone geometry object pointing up with base centred at (0,0,0).
Note a cylinder is a cone with baseRadius = topRadius.

shapeName The 3DView object.
baseRadius The radius of the base.
topRadius The radius of the top if truncated (default 0).
height The height of the cone.
divisions The number of divisions for the cone (default 18).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddCube(shapeName,sideLength,colour,materialType)
Add a cube geometry object centered on (0,0,0).
shapeName The 3DView object.
sideLength The side length of the cube.
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddDirectionalLight(shapeName,colour,xDir,yDir,zDir)
Add a directional light source.
shapeName The 3DView object.
colour The light colour.
xDir The x direction of the light.
yDir The y direction of the light.
zDir The z direction of the light.
returns The 3DView Light name.

AddGeometry(shapeName,points,indices,normals,colour,materialType)
Add a geometry object.
shapeName The 3DView object.
points A space or colon deliminated list of point coordinates.
indices A space or colon deliminated list of indices for each triangle (counter-clockwise for outward face).
normals An optional space or colon deliminated list of the outward normals for each node or "".
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddIcosahedron(shapeName,radius,colour,materialType)
Add an icosahedron geometry object centred at (0,0,0).
shapeName The 3DView object.
radius The radius of the icosahedron.
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddImage(shapeName,geometryName,textures,imageName,materialType)
Add an image to a geometry object.
A geometry 'skin' may contain several segment images in one image.

shapeName The 3DView object.
geometryName The geometry object.
textures A space or colon deliminated list of the texture coordinates for each node.
Each node has 2 values between 0 and 1 indicating the x,y image mapping to the node.
The may be defaulted to "" if the texture has previously been set.

imageName The image to load to the geometry.
Value returned from ImageList.LoadImage or local or network image file.
A colour or gradient brush can also be used here.

materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - additional specular highlights.


AddPipe(shapeName,length,innerDiameter,outerDiameter,divisions,colour,materialType)
Add a pipe geometry object pointing up with base centred at (0,0,0).
shapeName The 3DView object.
length The length of the pipe.
innerDiameter The inner diameter of the pipe.
outerDiameter The outer diameter of the pipe.
divisions The number of divisions for the pipe (default 18).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddPointLight(shapeName,colour,xPos,yPos,zPos,range)
Add a non-directional point light source.
shapeName The 3DView object.
colour The light colour.
xPos The x position of the light.
yPos The y position of the light.
zPos The z position of the light.
range The light range.
returns The 3DView Light name.

AddPyramid(shapeName,sideLength,height,colour,materialType)
Add a pyramid geometry object pointing up with base centred at (0,0,0).
shapeName The 3DView object.
sideLength The radius of the base.
height The height of the cone.
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddRectangle(shapeName,width,height,colour,materialType)
Add a rectangle geometry object centred at (0,0,0).
shapeName The 3DView object.
width The width of the rectangle.
height The height of the rectangle.
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddRevolute(shapeName,path,divisions,colour,materialType)
Add a revolute geometry object. This is a surface starting at (0,0,0) and pointing up.
Its shape is defined by a set points (Y,Z) where Y is the vertical distance along the surface from 0 and Z is the radius of revolution.

shapeName The 3DView object.
path A space or colon deliminated list of 2D point coordinates describing the revolute shape.
divisions The radial divisions, default 10 (affects number of triangles and smoothness).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddSphere(shapeName,radius,divisions,colour,materialType)
Add a sphere geometry object centred on (0,0,0).
shapeName The 3DView object.
radius The sphere radius.
divisions The sphere divisions, default 10 (affects number of triangles and smoothness).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddSpotLight(shapeName,colour,xPos,yPos,zPos,xDir,yDir,zDir,angle,range)
Add a directional spot light source.
shapeName The 3DView object.
colour The light colour.
xPos The x position of the light.
yPos The y position of the light.
zPos The z position of the light.
xDir The x direction of the light.
yDir The y direction of the light.
zDir The z direction of the light.
angle The cone angle the light in degrees.
range The light range.
returns The 3DView Light name.

AddTube(shapeName,path,diameter,divisions,colour,materialType)
Add a tube geometry object.
shapeName The 3DView object.
path A space or colon deliminated list of 3D point coordinates.
diameter The tube diameter.
divisions The tube radial divisions, default 10 (affects number of triangles and smoothness).
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.

returns The 3DView Geometry name.

AddView(width,height,performance)
Add a 3DView (GraphicsWindow shape).
width The width of the 3DView.
height The height of the 3DView.
performance A flag to favour speed over quality "True" or "False".
"True" removes visual clipping (clip 3DView to input width and height), hit-testing (unused) and anti-aliasing (not needed).

returns The 3DView viewport3D name.

AnimateRotation(shapeName,geometryName,xDir,yDir,zDir,startAngle,endAngle,duration,repeats)
Animate a geometry rotation about an axis vector.
This uses the second rotation, the first is still available for another axis rotation.

shapeName The 3DView object.
geometryName The geometry object to animate.
xDir X direction of vector to rotate about.
yDir Y direction of vector to rotate about.
zDir Z direction of vector to rotate about.
startAngle The starting angle in degrees (e.g. 0).
endAngle The final angle in degrees (e.g. 360).
duration The animation duration (time in sec).
repeats The number of times to repeat the animation (-1 is for ever).

AnimateRotation2(shapeName,geometryName,xDir,yDir,zDir,startAngle,endAngle,duration,repeats)
Animate a geometry rotation about an axis vector.
This uses the third rotation, the first is still available for another axis rotation.

shapeName The 3DView object.
geometryName The geometry object to animate.
xDir X direction of vector to rotate about.
yDir Y direction of vector to rotate about.
zDir Z direction of vector to rotate about.
startAngle The starting angle in degrees (e.g. 0).
endAngle The final angle in degrees (e.g. 360).
duration The animation duration (time in sec).
repeats The number of times to repeat the animation (-1 is for ever).

AnimateTranslation(shapeName,geometryName,x,y,z,duration)
Animate a geometry translation.
shapeName The 3DView object.
geometryName The geometry object to animate.
x X position to animate to.
y Y position to animate to.
z Z position to animate to.
duration The animation duration (sec).

AutoControl(pitchRoll,shift,keyDistance,speed)
Set auto Control of the camera.
Move forwards and backwards with mouse wheel (faster with Shift down, slower with Control down).
Yaw and Pitch camera moving with left mouse button.
Yaw with A,D or Left,Right keys, move forwards and backwards with W,S or Up,Down keys.
Roll camera moving with right mouse button.
Double left click an object to center it.
Double right click to reset the up direction to Y.
Yaw and Pitch scene moving with Shift and left mouse button after selecting an object to rotate scene about.
X, Y, Z keys change the view direction and up direction to face in these directions towards (0,0,0), with Shift then the negative direction.

pitchRoll Allow pitch and roll movement, "True" or "False".
shift Allow the Shift/Control key modifiers for mouse control, "True" or "False".
keyDistance The distance to view the scene from using keys, (0 prevents the X,Y,Z key shortcuts, -1 also prevents the A,D,W,S and arrow keys).
speed Forwards and backwards speed multiplier (default 1).

BoundingBox(shapeName,geometryName)
Get the bounding box extent of a geometry.
This is the current position (after any transformations).

shapeName The 3DView object.
geometryName The geometry object.
returns An array of dimensions or "FAILED".
array[1] = sizeX (width)
array[2] = sizeY (height)
array[3] = sizeZ (depth)
array[4] = X (Xmin)
array[5] = Y (Ymin)
array[6] = Z (Zmin)


CameraProperties(shapeName,nearDistance,farDistance,angle)
Set the angle of view, near and far clipping distances.
These are all of the fundamental perspective camera properties.

shapeName The 3DView object.
nearDistance The near clipping distance (can improve near object e.g. wall hit detection).
A negative value is 0.001 (default is 0.125).

farDistance The far clipping distance (can improve performance).
A negative value is infinity (default).

angle The view angle cone of the camera in degrees (affects perspective vanishing point).
If this is negative, then an Orthographic (no perspective) camera is used with view width set to -angle).


CloneObject(shapeName,geometryName)
Create a complete copy of a geometry object and all of its properties.
shapeName The 3DView object.
geometryName The object to copy's name.
returns The new copied 3DView object name.

Freeze(shapeName,geometryName)
Freeze a geometry object to improve performance a bit - it cannot then be modified in any way.
shapeName The 3DView object.
geometryName The object to freeze.

GetCameraDirection(shapeName)
Get the camera direction.
shapeName The 3DView object.
returns An array of the camera direction vector.

GetCameraPosition(shapeName)
Get the camera position.
shapeName The 3DView object.
returns An array of the camera position coordinates.

GetCameraUpDirection(shapeName)
Get the camera up direction.
shapeName The 3DView object.
returns An array of the camera up direction vector.

GetPosition(shapeName,geometryName)
Get the transformed (current) center position of an existing geometry.
shapeName The 3DView object.
geometryName The geometry object.
returns An array of the transformed position or "FAILED".
array[1] = X (Xcen)
array[2] = Y (Ycen)
array[3] = Z (Zcen)


HitTest(shapeName,x,y)
Perform a hit test in the 3DView.
A negative value for the coordinates defaults to the screen centre (camera view).

shapeName The 3DView object.
x The x coordinate in the GraphicsWindow coordinates within the 3DView.
y The y coordinate in the GraphicsWindow coordinates within the 3DView.
returns An array with the hit object name and its distance or "" for no hit.

LastRotationCompleted
The last completed rotation animation geometry object.

LastTranslationCompleted
The last completed translation animation geometry object.

LoadModel(shapeName,fileName)
Load geometry models from a file.
Supported formats include 3ds, lwo, obj, objz, stl and off.

shapeName The 3DView object.
fileName The file to load.
Often image files etc are also required with the same name in the same folder.

returns An array with the added geometry names.

ModifyObject(shapeName,geometryName,action)
Perform an action on a light or geometry object.
shapeName The 3DView object.
geometryName The geometry or light name.
action The action to perform.
The allowed actions are:
"X" remove
"H" hide
"S" show


MoveCamera(shapeName,yaw,pitch,roll,move)
Move the camera view direction and position.
shapeName The 3DView object.
yaw The Left/Right rotation in degrees (Yaw).
pitch The Up/Down rotation in degrees (Pitch).
roll Spin view about view direction in degrees (Roll).
move The Forward/Backward movement in device coordinates (along the view direction).

QueuedRotationCompleted
The number of currently queued completed rotation animations.

QueuedTranslationCompleted
The number of currently queued completed translation animations.

ResetCamera(shapeName,xPos,yPos,zPos,xDir,yDir,zDir,xUp,yUp,zUp)
Reset the camera position, view direction and up vector (optional).
shapeName The 3DView object.
xPos The x position of the camera.
yPos The y position of the camera.
zPos The z position of the camera.
xDir The x direction of the camera.
yDir The y direction of the camera.
zDir The z direction of the camera.
xUp The optional x up direction of the camera or "".
yUp The optional y up direction of the camera or "".
zUp The optional z up direction of the camera or "".

ResetMaterial(shapeName,geometryName,colour,materialType)
Reset the material for an existing geometry.
shapeName The 3DView object.
geometryName The geometry object.
colour A colour or gradient brush for the object.
materialType A material for the object.
The available options are:
"E" Emmissive - constant brightness.
"D" Diffusive - affected by lights.
"S" Specular - specular highlights.


ReverseNormals(shapeName,geometryName)
Reverse the outward normals for a geometry.
For example, make the inside surface of a sphere the visible surface instead of the outside surface (skydome).

shapeName The 3DView object.
geometryName The geometry object to reverse outward normals.

RotateGeometry(shapeName,geometryName,x,y,z,angle)
Rotate a geometry object about its centre.
shapeName The 3DView object.
geometryName The geometry object.
x X direction of vector to rotate about.
y Y direction of vector to rotate about.
z Z direction of vector to rotate about.
angle An angle in degrees to rotate.

RotateGeometry2(shapeName,geometryName,x,y,z,angle)
Rotate a geometry object about its centre (a second rotation).
shapeName The 3DView object.
geometryName The geometry object.
x X direction of vector to rotate about.
y Y direction of vector to rotate about.
z Z direction of vector to rotate about.
angle An angle in degrees to rotate.

RotateGeometry3(shapeName,geometryName,x,y,z,angle)
Rotate a geometry object about its centre (a third rotation).
shapeName The 3DView object.
geometryName The geometry object.
x X direction of vector to rotate about.
y Y direction of vector to rotate about.
z Z direction of vector to rotate about.
angle An angle in degrees to rotate.

RotationCompleted
Event when a rotation animation is completed.

ScaleGeometry(shapeName,geometryName,scaleX,scaleY,scaleZ)
Scale (zoom) a geometry object about its centre.
shapeName The 3DView object.
geometryName The geometry object.
scaleX X scale factor.
scaleY Y scale factor.
scaleZ Z scale factor.

SetBillBoard(shapeName,geometryName)
Set an object to rotate to always face the camera.
This uses the 2nd and 3rd rotations.

shapeName The 3DView object.
geometryName The geometry object.

SetCentre(shapeName,geometryName,x,y,z,options)
Set the centre for rotation and scale transformations of a geometry.
By default this is the centre of a bounding box for the geometry, often 0,0,0.
The centre is defined in the coordinates used to create the geometry.
It does not have to be within the geometry.
If a coordinate value is set to "", then the default value is used.

shapeName The 3DView object.
geometryName The geometry object.
x The x coordinate of the centre.
y The y coordinate of the centre.
z The z coordinate of the centre.
options Options to control centre setting. Multiples can be set, e.g. "R1R2R3" to set all rotations.
"R1" First rotation transformation
"R2" Second rotation transformation
"R3" Third rotation transformation
"S" Scale transformation


SpecularExponent
Get or set the specular exponent used for specular materials (default 5).

TranslateGeometry(shapeName,geometryName,dx,dy,dz)
Translate (move) a geometry object.
shapeName The 3DView object.
geometryName The geometry object.
dx X direction translation.
dy Y direction translation.
dz Z direction translation.

TranslationCompleted
Event when a translation animation is completed.