home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / tema / TS3 / Caligari / pluSpack1 / primitiveitch / vbapi15.exe / TsxApi.bas
Encoding:
BASIC Source File  |  1998-01-11  |  111.5 KB  |  2,504 lines

  1. Attribute VB_Name = "TsxApi"
  2. '------------------------------------------------------------------------------
  3. ' VbTsxApi
  4. ' v1.5 - 01/11/98
  5. '
  6. ' VB5 Declarations for TsxAPI 3.1
  7. '
  8. '------------------------------------------------------------------------------
  9.  
  10. '------------------------------------------------------------------------------
  11. '//    File: tsxTypes.h
  12. '//   Descr: Basic data types used in most places
  13.  
  14. '// Return type for functions that test a condition.
  15. Enum tsxBool
  16.     e_tsxFALSE = 0
  17.     e_tsxTRUE
  18. End Enum
  19.  
  20. '// Return type for functions that simply report success or failure.
  21. Enum tsxRET
  22.     e_tsxFAILURE = 0
  23.     e_tsxSUCCESS
  24. End Enum
  25.  
  26. '// Return type for functions that return an error code when they fail.
  27. '// These are documented in "tsxErr.h".
  28. 'typedef int tsxERR;
  29.  
  30. '//  Geometry
  31.  
  32. '// Reference Frames: World or Model
  33. Enum tsxFRAMEID
  34.     e_tsxWorldFrame
  35.     e_tsxModelFrame
  36. End Enum
  37.  
  38. '// Specifying Vectors and Points
  39. Type CtsxVector2f
  40.     x As Single
  41.     y As Single
  42. End Type
  43.  
  44. Type CtsxVector3f
  45.     x As Single
  46.     y As Single
  47.     z As Single
  48. End Type
  49.  
  50. '// Specifying axes.
  51. Type CtsxAxes3f
  52.     xAxis As CtsxVector3f '//Unit vector specifying orientation of Model's X axis.
  53.     yaxis As CtsxVector3f  '// ... Y ...
  54.     zAxis As CtsxVector3f  '// ... Z ...
  55. End Type
  56.  
  57. '// Transformation Matrix.
  58. Type CtsxTxmx3f
  59.     matrix(0 To 3, 0 To 2) As Single
  60. End Type
  61.  
  62. '// Bounding Box.
  63. Type CtsxBBox3f
  64.     minbounds As CtsxVector3f
  65.     maxbounds As CtsxVector3f
  66. End Type
  67.  
  68. '// For specifying color, e.g. in a material or for a vertex.
  69. Type CtsxColor
  70.     red As Byte
  71.     green As Byte
  72.     blue As Byte
  73.     alpha As Byte
  74. End Type
  75.  
  76. '// For specifying UV-space coordinates of a vertex.
  77. Type CtsxUV
  78.     u As Single
  79.     v As Single
  80. End Type
  81.  
  82. '// Object types in a scene.
  83. Enum tsxSOBJTYPE
  84.     e_tsxUNDEFINED = 0 '//Not a TSX-supported SOBJ type
  85.     '// SOBJ types
  86.     e_tsxMATERIAL = 1
  87.     e_tsxSCENE
  88.     e_tsxPLUGIN_FILTER
  89.     e_tsxPHYS_WIND
  90.     e_tsxMATRECT
  91.     '// Selectable objects
  92.     e_tsxSELECTABLE = 50 '//(Not a legal SOBJ type)
  93.     e_tsxAXES
  94.     '// GNODE types
  95.     e_tsxGNODETYPES = 100 '//(Not a legal SOBJ type)
  96.     e_tsxCAMERA
  97.     e_tsxLIGHT
  98.     e_tsxJOINT
  99.     e_tsxNAIL
  100.     e_tsxLATTICE
  101.     e_tsxPATH
  102.     '// MNODE types
  103.     e_tsxMNODETYPES = 200 '//(Not a legal SOBJ type)
  104.     e_tsxPOLYHEDRON
  105.     e_tsxGROUP
  106.     e_tsxLODGROUP '//Levels of Detail
  107.     e_tsxMBALLOBJ '//Object with meta-balls
  108. '//    e_tsxOPARTICLE
  109.     e_tsxSADEF '// Free-standing deformation
  110.     e_tsxIKGROUP '//Object with joints (Inverse Kinematics)
  111.  
  112.     e_tsxSOBJEND '//(Not a legal SOBJ type)
  113. End Enum
  114.  
  115. '------------------------------------------------------------------------------
  116. '//    File: tsxErr.h
  117. '//   Descr: TSX Error Codes
  118.  
  119. #Const tsxERR_SUCCESS = 0
  120.  
  121. '// Defined Error Codes
  122.  
  123. #Const tsxERR_NOGOOD = -1      '// something generally went wrong
  124. #Const tsxERR_NO_MEMORY = -2  '// no memory available
  125. #Const tsxERR_NULL_REF = -3   '// null pointer reference
  126. #Const tsxERR_BAD_INPUT = -4  '// bad input data
  127. #Const tsxERR_FORMAT = -5     '// general bad data format
  128. #Const tsxERR_ABORT = -8      '// user abort request
  129. #Const tsxERR_REPORTED = -10  '// still an error but was reported below
  130. #Const tsxERR_UNIMPL = -11    '// feature unimplemented
  131. #Const tsxERR_IDENTIFIER = -12 '// bad identifier on data or record
  132. #Const tsxERR_VERSION = -13   '// Correct file type but wrong version
  133. #Const tsxERR_NOT_FOUND = -14 '// object not found
  134. #Const tsxERR_OVERFLOW = -15  '// data overflow for size of result
  135. #Const tsxERR_RANGE = -16     '// value out of range
  136. #Const tsxERR_INIT = -18  '// subsystem improperly initialized
  137.  
  138. '// system errors
  139. #Const tsxERR_SYSERR_BASE = -50
  140. #Const tsxERR_STDIO = (tsxERR_SYSERR_BASE - 0)    '// error occurred in io
  141. #Const tsxERR_MSWIN = (tsxERR_SYSERR_BASE - 1)    '// error occurred in windows
  142.  
  143. '------------------------------------------------------------------------------
  144. '//    File: tsxGeom.h
  145. '//   Descr: Basic geometric manipulation in 2D and 3D.
  146.  
  147. #Const M_PI = 3.14159265359
  148.  
  149. '// 180/pi
  150. #Const tsxRAD2DEG_FAC = 57.29577951308
  151. '// pi/180
  152. #Const tsxDEG2RAD_FAC = 0.01745329251994
  153.  
  154. '// |vect|
  155. Declare Function tsxMagnitude3f Lib "tsxapi.dll" (ByRef vec As CtsxVector3f) As Single
  156. Declare Function tsxMagnitude2f Lib "tsxapi.dll" (ByRef vec As CtsxVector2f) As Single
  157.  
  158. '//      Normalizing ... returns the length of the original vector `vec'.
  159. Declare Function tsxNormalize3f Lib "tsxapi.dll" (ByRef vec As CtsxVector3f) As Single
  160. Declare Function tsxNormalize2f Lib "tsxapi.dll" (ByRef vec As CtsxVector2f) As Single
  161. '// norm = vec/|vec|
  162. Declare Function tsxGetNormalized3f Lib "tsxapi.dll" (ByRef norm As CtsxVector3f, ByRef vec As CtsxVector3f) As Single
  163. Declare Function tsxGetNormalized2f Lib "tsxapi.dll" (ByRef norm As CtsxVector2f, ByRef vec As CtsxVector2f) As Single
  164.  
  165. '//      Scalar-Vector arithmetic ... `vec' is modified and returned
  166. '// vec = vec + s
  167. Declare Function tsxAddScalar3f Lib "tsxapi.dll" (ByRef vec As CtsxVector2f, s As Single) As Variant
  168. '// vec = vec * s
  169. Declare Function tsxMulScalar3f Lib "tsxapi.dll" (ByRef vec As CtsxVector2f, s As Single) As Variant
  170.  
  171. '//      Vector-Vector arithmetic ... Vector `u' is modified and returned
  172. '// u = u + v
  173. Declare Function tsxAddVec3f Lib "tsxapi.dll" (ByRef u As CtsxVector3f, ByRef v As CtsxVector3f) As Variant
  174. '// u = u - v
  175. Declare Function tsxSubVec3f Lib "tsxapi.dll" (ByRef u As CtsxVector3f, ByRef v As CtsxVector3f) As Variant
  176.  
  177. '//      Vector Multiplication
  178. '// u . v ... Dot Product
  179. Declare Function tsxDProdVec3f Lib "tsxapi.dll" (ByRef u As CtsxVector3f, ByRef v As CtsxVector3f) As Single
  180. '// uxv = u x v ... Cross Product
  181. Declare Function tsxXProdVec3f Lib "tsxapi.dll" (ByRef uxv As CtsxVector3f, ByRef u As CtsxVector3f, ByRef v As CtsxVector3f) As Variant
  182. '// Returns Signed angle from vector `u' to `v' about the axis `axis'.
  183. '// `axis' gets the (unnormalized) cross-product (axis = u x v). Angle in radians.
  184. Declare Function tsxAngleBtwVecs3f Lib "tsxapi.dll" (ByRef u As CtsxVector3f, ByRef v As CtsxVector3f, ByRef axis As CtsxVector3f) As Single
  185.  
  186. '// Distance between 2 points `p', `q'.
  187. Declare Function tsxDistanceToPoint3f Lib "tsxapi.dll" (ByRef p As CtsxVector3f, ByRef q As CtsxVector3f) As Single
  188. '// Distance from a point `p' to a line containing point `line_point' and
  189. '// with unit direction vector `line_unitvec'.
  190. Declare Function tsxDistanceToLine3f Lib "tsxapi.dll" (ByRef p As CtsxVector3f, ByRef line_point As CtsxVector3f, ByRef line_unitvec As CtsxVector3f) As Single
  191. '// Distance from a Point `p' to a Plane with normal `plane_norm' and
  192. '// containing Point `plane_point'. This distance is positive only if
  193. '// `plane_norm' points towards `p'.
  194. Declare Function tsxDistanceToPlane3f Lib "tsxapi.dll" (ByRef p As CtsxVector3f, ByRef plane_norm As CtsxVector3f, ByRef plane_point As CtsxVector3f) As Single
  195.  
  196.  
  197. '// A = B x C ... Matrix Multiplication.
  198. '// A may be the same as B or C.
  199. Declare Function tsxXProdMx3f Lib "tsxapi.dll" (ByRef A As CtsxTxmx3f, ByRef B As CtsxTxmx3f, ByRef C As CtsxTxmx3f) As Variant
  200. '// Minv = Inverse(M) ... Matrix Inverse
  201. '// Returns e_tsxFAILURE if result is not reliable.
  202. Declare Function tsxInvertMx3f Lib "tsxapi.dll" (ByRef Minv As CtsxTxmx3f, ByRef M As CtsxTxmx3f) As Long
  203.  
  204. '// Makes Transformation Matrix from specified X and Z axes and Origin.
  205. '// pTxmx points to matrix where result Transformation Matrix is stored.
  206. '// If pInvTxmx is specified, the inverted Transform is stored there.
  207. '// Returns reference to Txmx.
  208. Declare Function tsxMakeMxFromXZO3f Lib "tsxapi.dll" (ByRef xAxis As CtsxVector3f, _
  209.                                                       ByRef zAxis As CtsxVector3f, _
  210.                                                       ByRef origin As CtsxVector3f, _
  211.                                                       ByRef pTxmx As CtsxTxmx3f, _
  212.                                                       pInvTxmx As Any) As Variant
  213.  
  214. '// Makes a transformation matrix for rotation by `angle' about a line
  215. '// defined by the center point `cent' and the normalized axis vector `axis'.
  216. '// Returns reference to Txmx.
  217. Declare Function tsxMakeRotMx3f Lib "tsxapi.dll" (ByRef cent As CtsxVector3f, _
  218.                                                   ByRef axis As CtsxVector3f, _
  219.                                                   ByVal angle As Single, _
  220.                                                   ByRef pTxmx As CtsxTxmx3f, _
  221.                                                   pInvTxmx As Any) As Long
  222.                                                   
  223. '// This version builds a pure rotation matrix, leaving other cells untouched.
  224. '// The rotation is about a (unit) vector `axis'.
  225. Declare Function tsxMakePureRotMx3f Lib "tsxapi.dll" (ByRef axis As CtsxVector3f, _
  226.                                                       ByVal angle As Single, _
  227.                                                       ByRef pTxmx As CtsxTxmx3f, _
  228.                                                       pInvTxmx As Any) As Long
  229.  
  230. '//      Translation in the Txmx
  231. '// Get the translation components {x, y, z} into `trvec'.
  232. Declare Function tsxGetMxTranslation3f Lib "tsxapi.dll" (ByRef trvec As CtsxVector3f, ByRef txmx As CtsxTxmx3f) As Long
  233. '// Set the translation components of a Txmx
  234. Declare Function tsxSetMxTranslation3f Lib "tsxapi.dll" (ByRef txmx As CtsxTxmx3f, ByRef trvec As CtsxVector3f) As Long
  235. '// Add translation vector `trvec' to Txmx
  236. Declare Function tsxAddMxTranslation3f Lib "tsxapi.dll" (ByRef txmx As CtsxTxmx3f, ByRef trvec As CtsxVector3f) As Long
  237. '// Subtract translation vector `trvec' from Txmx
  238. Declare Function tsxSubMxTranslation3f Lib "tsxapi.dll" (ByRef txmx As CtsxTxmx3f, ByRef trvec As CtsxVector3f) As Long
  239. '// Extract the pure rotation matrix (Rot) and scaling/shearing factors
  240. '// from a Transformation Matrix (Txmx).
  241. '// If specified, pScaleShear must be float[6], and is assigned as follows:
  242. '//      { Sx, Sy, Sz, Sxy, Sxz, Syz }
  243. Declare Sub tsxUnMatrix3f Lib "tsxapi.dll" (ByRef txmx As CtsxTxmx3f, ByRef Rot As CtsxTxmx3f, pScaleShear As Long)
  244.  
  245. '// Transform an array of vectors `pInVecs', placing result in `pOutVecs'.
  246. Declare Sub tsxTransformVecs3f Lib "tsxapi.dll" (ByVal numVecs As Long, _
  247.                                                  ByRef pOutVecs As CtsxVector3f, _
  248.                                                  ByRef pInVecs As CtsxVector3f, _
  249.                                                  ByRef txmx As CtsxTxmx3f)
  250. '// Apply only the rotational part of the Txmx to an array of vectors.
  251. Declare Sub tsxRotateVecs3f Lib "tsxapi.dll" (ByVal numVecs As Long, _
  252.                                               ByRef pOutVecs As CtsxVector3f, _
  253.                                               ByRef pInVecs As CtsxVector3f, _
  254.                                               ByRef txmx As CtsxTxmx3f)
  255. '// OutAxes = Rotate InAxes using Txmx. Ignore non-rotational part of Txmx.
  256. '// IF InAxes are orthogonal and unit, then OutAxes are also valid axes.
  257. Declare Sub tsxRotateAxes3f Lib "tsxapi.dll" (ByRef pOutAxes As CtsxAxes3f, ByRef pInAxes As CtsxAxes3f, ByRef txmx As CtsxTxmx3f)
  258.  
  259. '// Initialize BBox to negative volume.
  260. Declare Sub tsxBBoxInit Lib "tsxapi.dll" (ByRef pBBox As CtsxBBox3f)
  261.  
  262. '// Returns e_tsxTRUE if BBox1 and BBox2 intersect.
  263. '// If they do intersect, and pBBintx is non-zero,
  264. '// then BBintx gets their intersection.
  265. Declare Function tsxBBoxIntersection Lib "tsxapi.dll" ( _
  266.                           ByRef pBBintx As CtsxBBox3f, _
  267.                           ByRef pBBox1 As CtsxBBox3f, _
  268.                           ByRef pBBox2 As CtsxBBox3f) As Long
  269.  
  270. '------------------------------------------------------------------------------
  271. '//    File: tsxSobj.h
  272. '//   Descr: Definition of tsxSOBJ
  273.  
  274. '// Sobj Type
  275. Declare Function tsxSobjGetType Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  276.  
  277. '// e_tsxTRUE if Node is a Sobj
  278. Declare Function tsxIsSobj Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  279.  
  280. '// Get the first child of an object.
  281. Declare Function tsxSobjGetFirstChild Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  282.  
  283. '// Get the last child of an object.
  284. Declare Function tsxSobjGetLastChild Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  285.  
  286. '// Get the next node of valid tsx Sobj Type
  287. '// pSobj is any Calobj
  288. Declare Function tsxSobjGetNext Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  289.  
  290. '// Get the prev node of valid tsx Sobj Type
  291. '// pSobj is any Calobj
  292. Declare Function tsxSobjGetPrev Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  293.  
  294. '// Delete and free memory, including internal allocations.
  295. '// Also delete all children, if any.
  296. '// Erases objects from all Views.
  297. Declare Sub tsxSobjDelete Lib "tsxapi.dll" (ByVal pSobj As Long)
  298.  
  299. '------------------------------------------------------------------------------
  300. '//    File: tsxMatrl.h
  301. '//   Descr: Definition of tsxMATERIAL
  302.  
  303. '// Solid texture direction values (used in the grain fields).
  304. #Const tsxSOLID_DIR_X = 0
  305. #Const tsxSOLID_DIR_Y = 1
  306. #Const tsxSOLID_DIR_Z = 2
  307.  
  308. '// Simulates a granite like texture with upto 4 colors.
  309. Type CtsxGraniteProps
  310.     color1 As CtsxColor '//The different stone colors.
  311.     color2 As CtsxColor
  312.     color3 As CtsxColor
  313.     color4 As CtsxColor
  314.     amount1 As Single '//Relative amount of color1 [0.0 - 1.0] (0=none)
  315.     amount2 As Single '//Relative amount of color2 [0.0 - 1.0]
  316.     amount3 As Single '//Relative amount of color3 [0.0 - 1.0]
  317.     amount4 As Single '//Relative amount of color4 [0.0 - 1.0]
  318.     sharpness As Single '//[0.0 (max blurring to one color) - 1.0 (no blur)]
  319.     scale As CtsxVector3f 'Scaling along solid texture directions. Non-negative.
  320.                           '// Larger values result in finer texture.
  321.     seed As Integer '//Random seed for generating pattern [0 - 64k]
  322. End Type
  323.  
  324. '// Simulates texture of swirling veins produced by turbulent forces
  325. '// applied before marble solidifies.
  326. Type CtsxMarbleProps
  327.     stonecol As CtsxColor '//Base stone color
  328.     veincol As CtsxColor '//Color of veins
  329.     turbulence As Integer '//Higher numbers result in larger, bumpier veins.
  330.                           '// 0 produces straight veins. Typically [0 - 20].
  331.     sharpness As Single '//Blending between vein and stone colors at vein edges.
  332.                         '// Higher values increase sharpness. [0.0 - 1.0]
  333.     grain As Integer '//Vein direction (tsxSOLID_DIR_*).
  334.     scale As CtsxVector3f '//Scaling along solid texture directions. Non-negative.
  335.                           '// Larger values result in more veins.
  336.     seed As Integer '//Random seed for generating pattern [0 - 64k]
  337. End Type
  338.  
  339. '// This produces concentric light (Spring) and dark (Summer) colored rings,
  340. '// around an axis.
  341. Type CtsxWoodProps
  342.     lightcol As CtsxColor '//The light or spring color
  343.     darkcol As CtsxColor '//The dark or summer color
  344.     ldratio As Single '//Light/Dark ratio.
  345.                       '// [0.0 (almost all dark) - 1.0 (almost all light)]
  346.     rdensity As Single '//Number of rings per unit distance.
  347.     rwidthvar As Single '//Variation in ring width [0.0 (uniform) - 1.0]
  348.     rshapevar As Single '//Variation in ring shape [0.0 (perfect circle) - 1.0]
  349.     center As CtsxVector3f '//Location of rings center.
  350.     grain As Integer '//Ring axis direction (tsxSOLID_DIR_*).
  351.     scale As CtsxVector3f '//Scaling along solid texture directions. Non-negative.
  352.     seed As Integer '//Random seed for generating pattern [0 - 64k]
  353. End Type
  354.  
  355. '// Values for CtsxProcTexture::txtrtype
  356. #Const tsxTEXTURE_NONE = 0
  357. #Const tsxTEXTURE_GRANITE = 1
  358. #Const tsxTEXTURE_MARBLE = 2
  359. #Const tsxTEXTURE_WOOD = 3
  360. '// returned by `tsxMaterialGetTextureType' if texture is not procedural.
  361. '// Not a valid value for field txtrtype.
  362. #Const tsxTEXTURE_IMAGE = 4
  363.  
  364. '// Structure for specifying one of the procedural textures in tsxMATERIAL
  365. 'struct CtsxProcTexture
  366. '{
  367.     'short txtrtype; //one of tsxTEXTURE_*
  368.     'Union
  369.     '{
  370.         'CtsxGraniteProps gprops;
  371.         'CtsxMarbleProps  mprops;
  372.         'CtsxWoodProps    wprops;
  373.     '};
  374. '};
  375. Type CtsxGraniteTexture
  376.     txtrtype As Integer '// one of tsxTEXTURE_*
  377.     gprops As CtsxGraniteProps
  378. End Type
  379.  
  380. Type CtsxMarbleTexture
  381.     txtrtype As Integer '// one of tsxTEXTURE_*
  382.     mprops As CtsxMarbleProps
  383. End Type
  384.  
  385. Type CtsxWoodTexture
  386.     txtrtype As Integer '// one of tsxTEXTURE_*
  387.     wprops As CtsxWoodProps
  388. End Type
  389.  
  390. '// Reflection shading types (mutually exclusive)
  391. #Const tsxSHADER_FLAT = 1
  392. #Const tsxSHADER_PHONG = 2
  393. #Const tsxSHADER_METAL = 4
  394. '// Surface smoothness (mutually exclusive)
  395. #Const tsxFACET_FACETED = 1
  396. #Const tsxFACET_AUTO = 2
  397. #Const tsxFACET_SMOOTH = 4
  398.  
  399. '// Surface properties ......................................
  400. Type CtsxSurfaceProps
  401.     ka As Single '//ambient coefficent [0.0 -(0.01)- 1.0]
  402.     ks As Single '//specular coefficent [0.0 -(0.01)- 1.0]
  403.     exp As Single '//exponent of specularity (roughness) [0.0 -(0.01)- 1.0]
  404. End Type
  405.  
  406. '// Texture Map properties ..................................
  407.  
  408. #Const tsxTXTR_OVERLAY = 1
  409. #Const tsxTXTR_ON = 2         '//otherwise OFF
  410. #Const tsxTXTR_MOVIE = 4
  411. #Const tsxTXTR_MARBLE = 1024
  412. #Const tsxTXTR_WOOD = 2048
  413. #Const tsxTXTR_GRANITE = 4096
  414. '// Only one of MARBLE, WOOD or GRANITE may be set.
  415.  
  416. Type CtsxTextureProps
  417.     offsetu As Single '//texture U offset [-1.0 -(.001)- 1.0]
  418.     offsetv As Single '//texture V offset [-1.0 -(.001)- 1.0]
  419.     repeatsu As Single '//texture repeats in U [0.01 -(.1)- 100.0]
  420.     repeatsv As Single '//texture repeats in V [0.01 -(.1)- 100.0]
  421.     flags As Integer '//see above
  422. End Type
  423.  
  424. '// Bump Map properties .....................................
  425. #Const tsxBUMP_ON = 2         '//otherwise OFF
  426. #Const tsxBUMP_MOVIE = 4
  427.  
  428. Type CtsxBumpProps
  429.     offsetu As Single '//bump U offset [-1.0 -(.001)- 1.0]
  430.     offsetv As Single '//bump V offset [-1.0 -(.001)- 1.0]
  431.     repeatsu As Single '//bump repeats in U [0.01 -(.1)- 100.0]
  432.     repeatsv As Single '//bump repeats in V [0.01 -(.1)- 100.0]
  433.     amplitude As Single '//bump amplitude [-10.0 - 10.0]
  434.     flags As Integer '//see above
  435. End Type
  436.  
  437. '// Environment Map properties ..............................
  438.  
  439. #Const tsxENVR_CUBIC = 1      '//cubic environment, otherwise its spherical
  440. #Const tsxENVR_ON = 2         '//otherwise OFF
  441. #Const tsxENVR_MOVIE = 4
  442.  
  443.  
  444. #Const tsxUVPROJ_PLANE = 1
  445. #Const tsxUVPROJ_PLANE_SQUARE = 2
  446. #Const tsxUVPROJ_CYLINDER = 4
  447. #Const tsxUVPROJ_SPHERE = 8
  448.  
  449. '// Create a new material object with default properties:
  450. '//   - reflection shading = tsxSHADER_FLAT
  451. '//   - Surface smoothness = tsxFACET_FACETED
  452. '//   - alpha-chanel = 1
  453. '//   - index of refraction = 1
  454. '//   - Texture U repeats = 1
  455. '//   - Texture V repeats = 1
  456. '//   - Bump U repeats = 1
  457. '//   - Bump V repeats = 1
  458. '//   - Bump amplitude = 1
  459. '//   - Zero (0) in the rest of the fields
  460. '// Ptr to new object assigned to ppMatrl on success.
  461. 'TSXAPIFN tsxERR tsxMaterialCreate( tsxMATERIAL** ppMatrl );
  462. Declare Function tsxMaterialCreate Lib "tsxapi.dll" _
  463.     (ByRef ppMatrl As Long) As Long
  464.  
  465. '// Create a new material object, with same properties as pOldMatrl.
  466. '// Ptr to new object assigned to ppNewMatrl on success.
  467. 'TSXAPIFN tsxERR tsxMaterialCreateCopy(
  468.     'tsxMATERIAL** ppNewMatrl,
  469.     'tsxMATERIAL* pOldMatrl
  470.     ');
  471. Declare Function tsxMaterialCreateCopy Lib "tsxapi.dll" _
  472.     (ByRef ppNewMatrl As Long, ByVal pOldMatrl As Long) As Long
  473.  
  474. '// Create a new material object, with same properties as the Active Material.
  475. '// Ptr to new object assigned to ppMatrl on success.
  476. 'TSXAPIFN tsxERR tsxMaterialCreateCopyActive( tsxMATERIAL** ppMatrl );
  477. Declare Function tsxMaterialCreateCopyActive Lib "tsxapi.dll" _
  478.     (ByRef ppMatrl As Long) As Long
  479.  
  480. '// Destroy a material object.  If assigned to faces, corresponding material
  481. '// entries in matlist set to null.
  482. 'TSXAPIFN void tsxMaterialDestroy( tsxMATERIAL* pMatrl );
  483. Declare Sub tsxMaterialDestroy Lib "tsxapi.dll" _
  484.     (ByVal pMatrl As Long)
  485.  
  486. '// Set the active material to pNewActive (may be NULL).
  487. 'TSXAPIFN void tsxMaterialSetActive( tsxMATERIAL* pNewActive );
  488. Declare Sub tsxMaterialSetActive Lib "tsxapi.dll" _
  489.     (ByVal pNewActive As Long)
  490.  
  491. '// Returns ptr to the Active Material (may be NULL)
  492. 'TSXAPIFN tsxMATERIAL* tsxMaterialGetActive();
  493. Declare Function tsxMaterialGetActive Lib "tsxapi.dll" _
  494.     () As Long
  495.  
  496. '// Copy Active Material's (if any) attributes into pMatrl.
  497. 'TSXAPIFN void tsxMaterialCopyActive( tsxMATERIAL* pMatrl );
  498. Declare Sub tsxMaterialCopyActive Lib "tsxapi.dll" _
  499.     (ByVal pMatrl As Long)
  500.  
  501. '// Testing two materials for equivalence.
  502. 'TSXAPIFN tsxBOOL tsxMaterialsAreEqual( tsxMATERIAL* pMatrl1,
  503.                                        'tsxMATERIAL* pMatrl2 );
  504. Declare Function tsxMaterialsAreEqual Lib "tsxapi.dll" _
  505.     (ByVal pMatrl1 As Long, ByVal pMatrl2 As Long) As Long
  506.  
  507. '// Get its ID (0-64K, -1 if not material)
  508. 'TSXAPIFN int tsxMaterialGetId( tsxMATERIAL* pMatrl );
  509. Declare Function tsxMaterialGetId Lib "tsxapi.dll" _
  510.     (ByVal pMatrl As Long) As Long
  511.  
  512. '// Surface attributes ..........................................................
  513.  
  514. '// Reflection shading (tsxSHADER_*, 0 on error)
  515. 'TSXAPIFN int tsxMaterialGetShadingType( tsxMATERIAL* pMatrl );
  516. Declare Function tsxMaterialGetShadingType Lib "tsxapi.dll" _
  517.     (ByVal pMatrl As Long) As Long
  518.  
  519. '// Surface faceting (tsxFACET_*, 0 on error)
  520. 'TSXAPIFN int tsxMaterialGetFacetingType( tsxMATERIAL* pMatrl );
  521. Declare Function tsxMaterialGetFacetingType Lib "tsxapi.dll" _
  522.     (ByVal pMatrl As Long) As Long
  523.  
  524. '// The angle in degrees (0 - 120)
  525. 'TSXAPIFN int tsxMaterialGetAutofacetAngle( tsxMATERIAL* pMatrl );
  526. Declare Function tsxMaterialGetAutofacetAngle Lib "tsxapi.dll" _
  527.     (ByVal pMatrl As Long) As Long
  528.  
  529. '// Color
  530. 'TSXAPIFN void tsxMaterialGetColor( tsxMATERIAL* pMatrl, CtsxColor* pColor );
  531. Declare Sub tsxMaterialGetColor Lib "tsxapi.dll" _
  532.     (ByVal pMatrl As Long, ByRef pColor As CtsxColor)
  533.  
  534. '// Surface properties
  535. 'TSXAPIFN void tsxMaterialGetSurfaceProps( tsxMATERIAL* pMatrl,
  536.                                           'CtsxSurfaceProps* pSprops );
  537. Declare Sub tsxMaterialGetSurfaceProps Lib "tsxapi.dll" _
  538.     (ByVal pMatrl As Long, ByRef pSprops As CtsxSurfaceProps)
  539.  
  540. '// index of refraction (1.0 - 2.0, 0 on error)
  541. 'TSXAPIFN float tsxMaterialGetIor( tsxMATERIAL* pMatrl );
  542. Declare Function tsxMaterialGetIor Lib "tsxapi.dll" _
  543.     (ByVal pMatrl As Long) As Single
  544.  
  545. '// Returns tsxTEXTURE_*
  546. 'TSXAPIFN int tsxMaterialGetTextureType( tsxMATERIAL* pMatrl );
  547. Declare Function tsxMaterialGetTextureType Lib "tsxapi.dll" _
  548.     (ByVal pMatrl As Long) As Long
  549.  
  550. '// If not procedural texture, pPrTxt->txtrtype = tsxTEXTURE_NONE.
  551. 'TSXAPIFN void tsxMaterialGetProcTexture( tsxMATERIAL* pMatrl,
  552.                                          'CtsxProcTexture* pPrTxt );
  553. Declare Sub tsxMaterialGetProcTexture Lib "tsxapi.dll" _
  554.     (ByVal pMatrl As Long, pPrTxt As Any)
  555.  
  556. '// File used as texture map image.
  557. 'TSXAPIFN void tsxMaterialGetTextureFilename(
  558.     'tsxMATERIAL* pMatrl,
  559.     'char* szFilename,   // File name copied here, if any
  560.     'int iFilenameSize   // size of szFilename buffer
  561.     ');
  562. Declare Sub tsxMaterialGetTextureFilename Lib "tsxapi.dll" _
  563.     (ByVal pMatrl As Long, ByVal szFilename As String, iFilenameSize As Long)
  564.  
  565. '// Texture mapping parameters
  566. 'TSXAPIFN void tsxMaterialGetTextureProps(
  567.     'tsxMATERIAL* pMatrl,
  568.     'CtsxTextureProps* pTxtrProps
  569.     ');
  570. Declare Sub tsxMaterialGetTextureProps Lib "tsxapi.dll" _
  571.     (ByVal pMatrl As Long, ByRef pTxtrProps As CtsxTextureProps)
  572.  
  573.  
  574. '// Bump Map ....................................................................
  575.  
  576. '// File used as bump map image.
  577. 'TSXAPIFN void tsxMaterialGetBumpFilename(
  578.     'tsxMATERIAL* pMatrl,
  579.     'char* szFilename,   // File name copied here, if any
  580.     'int iFilenameSize   // size of szFilename buffer
  581.     ');
  582. Declare Sub tsxMaterialGetBumpFilename Lib "tsxapi.dll" _
  583.     (ByVal pMatrl As Long, ByVal szFilename As String, iFilenameSize As Long)
  584.  
  585. '// Bump mapping parameters
  586. 'TSXAPIFN void tsxMaterialGetBumpProps(
  587.     'tsxMATERIAL* pMatrl,
  588.     'CtsxBumpProps* pBumpProps
  589.     ');
  590. Declare Sub tsxMaterialGetBumpProps Lib "tsxapi.dll" _
  591.     (ByVal pMatrl As Long, ByRef pTxtrProps As CtsxBumpProps)
  592.  
  593.  
  594. '// Environment Map .............................................................
  595.  
  596. '// File used as environment map image.
  597. 'TSXAPIFN void tsxMaterialGetEnvrFilename(
  598.     'tsxMATERIAL* pMatrl,
  599.     'char* szFilename,   // File name copied here, if any
  600.     'int iFilenameSize   // size of szFilename buffer
  601.     ');
  602. Declare Sub tsxMaterialGetEnvrFilename Lib "tsxapi.dll" _
  603.     (ByVal pMatrl As Long, ByVal szFilename As String, iFilenameSize As Long)
  604.  
  605. '// Returns tsxENVR_* (0 on error)
  606. 'TSXAPIFN int tsxMaterialGetEnvrFlags( tsxMATERIAL* pMatrl );
  607. Declare Function tsxMaterialGetEnvrFlags Lib "tsxapi.dll" _
  608.     (ByVal pMatrl As Long) As Long
  609.  
  610.  
  611. '// Surface attributes ..........................................................
  612.  
  613. '// Reflection shading (tsxSHADER_*)
  614. 'TSXAPIFN void tsxMaterialSetShadingType( tsxMATERIAL* pMatrl, int shading );
  615. Declare Sub tsxMaterialSetShadingType Lib "tsxapi.dll" _
  616.     (ByVal pMatrl As Long, ByVal shading As Long)
  617.  
  618. '// Surface faceting (tsxFACET_*)
  619. 'TSXAPIFN void tsxMaterialSetFacetingType( tsxMATERIAL* pMatrl, int faceting );
  620. Declare Sub tsxMaterialSetFacetingType Lib "tsxapi.dll" _
  621.     (ByVal pMatrl As Long, ByVal faceting As Long)
  622.  
  623. '// The angle in degrees (0 - 120)
  624. 'TSXAPIFN void tsxMaterialSetAutofacetAngle( tsxMATERIAL* pMatrl,
  625.                                             'int angleDegrees );
  626. Declare Sub tsxMaterialSetAutofacetAngle Lib "tsxapi.dll" _
  627.     (ByVal pMatrl As Long, ByVal angleDegrees As Long)
  628.  
  629. '// Color
  630. 'TSXAPIFN void tsxMaterialSetColor( tsxMATERIAL* pMatrl, CtsxColor* pColor );
  631. Declare Sub tsxMaterialSetColor Lib "tsxapi.dll" _
  632.     (ByVal pMatrl As Long, ByRef pColor As CtsxColor)
  633.  
  634. '// Surface properties
  635. 'TSXAPIFN void tsxMaterialSetSurfaceProps( tsxMATERIAL* pMatrl,
  636.                                           'CtsxSurfaceProps* pSprops );
  637. Declare Sub tsxMaterialSetSurfaceProps Lib "tsxapi.dll" _
  638.     (ByVal pMatrl As Long, ByRef pSprops As CtsxSurfaceProps)
  639.  
  640. '// index of refraction (1.0 - 2.0)
  641. 'TSXAPIFN void tsxMaterialSetIor( tsxMATERIAL* pMatrl, float ior );
  642. Declare Function tsxMaterialSetIor Lib "tsxapi.dll" _
  643.     (ByVal pMatrl As Long, ByVal ior As Single)
  644.  
  645. '// Texture Map .................................................................
  646.  
  647. '// Returns tsxTEXTURE_*
  648. 'TSXAPIFN void tsxMaterialSetTextureType( tsxMATERIAL* pMatrl, int txtype );
  649. Declare Sub tsxMaterialSetTextureType Lib "tsxapi.dll" _
  650.     (ByVal pMatrl As Long, ByVal txtype As Long)
  651.  
  652. '// If not procedural texture, pPrTxt->txtrtype = tsxTEXTURE_NONE.
  653. 'TSXAPIFN void tsxMaterialSetProcTexture( tsxMATERIAL* pMatrl,
  654.                                          'CtsxProcTexture* pPrTxt );
  655. Declare Sub tsxMaterialSetProcTexture Lib "tsxapi.dll" _
  656.     (ByVal pMatrl As Long, pPrTxt As Any)
  657.  
  658. '// File used as texture map image.
  659. 'TSXAPIFN void tsxMaterialSetTextureFilename(
  660.     'tsxMATERIAL* pMatrl,
  661.     'char* szFilename    // File name ptr (may be NULL)
  662.     ');
  663. Declare Sub tsxMaterialSetTextureFilename Lib "tsxapi.dll" _
  664.     (ByVal pMatrl As Long, ByVal szFilename As String)
  665.  
  666. '// Texture mapping parameters
  667. 'TSXAPIFN void tsxMaterialSetTextureProps(
  668.     'tsxMATERIAL* pMatrl,
  669.     'CtsxTextureProps* pTxtrProps
  670.     ');
  671. Declare Sub tsxMaterialSetTextureProps Lib "tsxapi.dll" _
  672.     (ByVal pMatrl As Long, ByRef pTxtrProps As CtsxTextureProps)
  673.  
  674.  
  675. '// Bump Map ....................................................................
  676.  
  677. '// File used as bump map image.
  678. 'TSXAPIFN void tsxMaterialSetBumpFilename(
  679.     'tsxMATERIAL* pMatrl,
  680.     'char* szFilename    // File name ptr (may be 0)
  681.     ');
  682. Declare Sub tsxMaterialSetBumpFilename Lib "tsxapi.dll" _
  683.     (ByVal pMatrl As Long, ByVal szFilename As String)
  684.  
  685. '// Bump mapping parameters
  686. 'TSXAPIFN void tsxMaterialSetBumpProps(
  687.     'tsxMATERIAL* pMatrl,
  688.     'CtsxBumpProps* pBumpProps
  689.     ');
  690. Declare Sub tsxMaterialSetBumpProps Lib "tsxapi.dll" _
  691.     (ByVal pMatrl As Long, ByRef pBumpProps As CtsxBumpProps)
  692.  
  693.  
  694. '// Environment Map .............................................................
  695.  
  696. '// File used as environment map image.
  697. 'TSXAPIFN void tsxMaterialSetEnvrFilename(
  698.     'tsxMATERIAL* pMatrl,
  699.     'char* szFilename    // File name ptr (may be 0)
  700.     ');
  701. Declare Sub tsxMaterialSetEnvrFilename Lib "tsxapi.dll" _
  702.     (ByVal pMatrl As Long, ByVal szFilename As String)
  703.  
  704. '// Environment flags tsxENVR_*
  705. 'TSXAPIFN void tsxMaterialSetEnvrFlags( tsxMATERIAL* pMatrl, int flags );
  706. Declare Sub tsxMaterialSetEnvrFlags Lib "tsxapi.dll" _
  707.     (ByVal pMatrl As Long, ByVal flags As Long)
  708.  
  709. '------------------------------------------------------------------------------
  710. '//    File: tsxScene.cpp
  711. '//   Descr: Definition of tsxSCENE
  712.  
  713. '// Get the trueSpace scene.
  714. 'TSXAPIFN tsxSCENE* tsxGetScene();
  715. Declare Function tsxGetScene Lib "tsxapi.dll" _
  716.     () As Long
  717.  
  718. '// Adds pGNode as top-level member of scene, and makes it the current selection.
  719. '// IF bNoDraw is TRUE THEN the object will not be drawn in this function call.
  720. '// pGNode must be a new object not already in Scene.
  721. 'TSXAPIFN void tsxSceneAddObject( tsxGNODE* pGNode, tsxBOOL bNoDraw );
  722. Declare Sub tsxSceneAddObject Lib "tsxapi.dll" _
  723.     (ByVal pGNode As Long, ByVal bNoDraw As Long)
  724.  
  725. '// Get the first top level GNode.
  726. '// The rest can be accessed using `tsxGNodeGetNext'.
  727. 'TSXAPIFN tsxGNODE* tsxSceneGetFirstNode();
  728. Declare Function tsxSceneGetFirstNode Lib "tsxapi.dll" _
  729.     () As Long
  730.  
  731. '// Returns tsxTRUE for Fog On.
  732. 'TSXAPIFN tsxBOOL tsxSceneIsFogOn();
  733. Declare Function tsxSceneIsFogOn Lib "tsxapi.dll" _
  734.     () As Long
  735.  
  736. '// Use tsxTRUE to set Fog On.
  737. 'TSXAPIFN void tsxSceneSwitchFog( tsxBOOL fog_on );
  738. Declare Sub tsxSceneSwitchFog Lib "tsxapi.dll" _
  739.     (ByVal fog_on As Long)
  740.     
  741. '//
  742. 'TSXAPIFN void tsxSceneGetFogParms(
  743.     'unsigned int* pFogRed,      //0 - 255
  744.     'unsigned int* pFogBlue,     //0 - 255
  745.     'unsigned int* pFogGreen,    //0 - 255
  746.     'int*          pFogNear,
  747.     'int*          pFogFar,
  748.     'int*          pFogMax
  749.     ');
  750. Declare Sub tsxSceneGetFogParms Lib "tsxapi.dll" _
  751.     (ByRef pFogRed As Long, ByRef pFogBlue As Long, ByRef pFogGreen As Long, ByRef pFogNear As Long, ByRef pFogFar As Long, ByRef pFogMax As Long)
  752.  
  753. '//
  754. 'TSXAPIFN void tsxSceneSetFogParms(
  755.     'unsigned int FogRed,        //0 - 255
  756.     'unsigned int FogBlue,       //0 - 255
  757.     'unsigned int FogGreen,      //0 - 255
  758.     'int          FogNear,
  759.     'int          FogFar,
  760.     'int          FogMax
  761.     ');
  762. Declare Sub tsxSceneSetFogParms Lib "tsxapi.dll" _
  763.     (ByVal FogRed As Long, ByVal FogBlue As Long, ByVal FogGreen As Long, ByVal FogNear As Long, ByVal FogFar As Long, ByVal FogMax As Long)
  764.  
  765. '// (Re)Draw the scene in the active View, in the View's rendering mode.
  766. 'TSXAPIFN void tsxSceneDraw();
  767. Declare Sub tsxSceneDraw Lib "tsxapi.dll" ()
  768.  
  769. '------------------------------------------------------------------------------
  770. '//    File: tsxGNode.h
  771. '//   Descr: Definition of tsxGNODE
  772.  
  773. '// e_tsxTRUE if pSobj is a GNode
  774. 'TSXAPIFN tsxBOOL tsxIsGNode( tsxSOBJ* pSobj );
  775. Declare Function tsxIsGNode Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  776.  
  777. '// Get a copy of the entire tree rooted at a GNode
  778. 'TSXAPIFN tsxERR tsxGNodeCopy(
  779. '    tsxGNODE* pGNode,       // The GNode to copy
  780. '    tsxGNODE** ppGNodeCopy  // Ptr to Copy placed here, on success
  781. '    );
  782. Declare Function tsxGNodeCopy Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef ppGNodeCopy As Long) As Long
  783.  
  784. '// Returns: 0       if pGNode is the Scene object;
  785. '//          pGNode  if parent of pGNode is the Scene object,
  786. '//                  or pGNode has no parent;
  787. '//     else ptr to highest tsxGNODE ancestor of pGNode below Scene.
  788. 'TSXAPIFN tsxGNODE* tsxGNodeGetRoot( tsxGNODE* pGNode );
  789. Declare Function tsxGNodeGetRoot Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  790.  
  791. '// Get the parent node in the scene graph.
  792. 'TSXAPIFN tsxGNODE* tsxGNodeGetParent( tsxGNODE* pGNode );
  793. Declare Function tsxGNodeGetParent Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  794.  
  795. '// Returns e_tsxTRUE if pGNode is a member of the Scene at some level.
  796. 'TSXAPIFN tsxBOOL tsxIsGNodeInScene( tsxGNODE* pGNode );
  797. Declare Function tsxIsGNodeInScene Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  798.  
  799. '// Get the first child of a Group or LOD object.
  800. 'TSXAPIFN tsxGNODE* tsxGNodeGetFirstChild( tsxGNODE* pGNode );
  801. Declare Function tsxGNodeGetFirstChild Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  802.  
  803. '// Get the next node of valid tsx Type
  804. 'TSXAPIFN tsxGNODE* tsxGNodeGetNext( tsxGNODE* pGNode );
  805. Declare Function tsxGNodeGetNext Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  806.  
  807. '// Get the prev node of valid tsx Type
  808. 'TSXAPIFN tsxGNODE* tsxGNodeGetPrev( tsxGNODE* pGNode );
  809. Declare Function tsxGNodeGetPrev Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  810.  
  811. '// Returns e_tsxTRUE if pCheckGNode is a node in the tree rooted at pGNode.
  812. 'TSXAPIFN tsxBOOL tsxIsGNodeSubobj( tsxGNODE* pGNode, tsxGNODE* pCheckGNode );
  813. Declare Function tsxIsGNodeSubobj Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal pCheckGNode As Long) As Long
  814.  
  815. '// Draws pGNode in the current view, in the current view's rendering mode.
  816. 'TSXAPIFN void tsxGNodeDraw( tsxGNODE* pGNode );
  817. Declare Sub tsxGNodeDraw Lib "tsxapi.dll" (ByVal pGNode As Long)
  818.  
  819. '// Gets the Name of a GNode.
  820. '// Returns length of name. (0 if not valid request or null name)
  821. 'TSXAPIFN int tsxGNodeGetName(
  822. '    tsxGNODE* pGNode,
  823. '    char*     pName,    //buffer where name is copied
  824. '    int       iNameSz   //Size of pName buffer
  825. '    );
  826. Declare Function tsxGNodeGetName Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal pName As String, ByVal iNameSz As Long) As Long
  827.  
  828. '// Sets the Name of a GNode.
  829. '// Returns 0 on success.
  830. 'TSXAPIFN tsxERR tsxGNodeSetName( tsxGNODE* pGNode, char* szNewName );
  831. Declare Function tsxGNodeSetName Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal pName As String) As Long
  832.  
  833. '// Get the GNode's position in World coordinates.
  834. '// Returns 0 if not GNODE, else posn.
  835. 'TSXAPIFN CtsxVector3f* tsxGNodeGetAxesPosition(
  836.     'tsxGNODE* pGNode,
  837.     'CtsxVector3f* posn
  838.     ');
  839. Declare Function tsxGNodeGetAxesPosition Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef posn As CtsxVector3f) As Long
  840.  
  841. '// Get the GNode's model axes orientation, as a triple of normalized orthogonal
  842. '// vectors pointing in the directions of GNode's X, Y and Z.
  843. '// Returns 0 if not GNODE, else axes.
  844. 'TSXAPIFN CtsxAxes3f* tsxGNodeGetAxesOrientation(
  845.     'tsxGNODE* pGNode,
  846.     'CtsxAxes3f* axes
  847. '    );
  848. Declare Function tsxGNodeGetAxesOrientation Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef posn As CtsxAxes3f) As Long
  849.  
  850. '// Add the bounding box of GNode to input BBox.
  851. '// Not valid for Track and Path objects.
  852. '// The resulting BBox will also enclose the input BBox bounds. To get BBox
  853. '// of only pGNode, use `tsxBBoxInit()' before calling this function.
  854. 'TSXAPIFN tsxERR tsxGNodeGetBBox(
  855.     'tsxGNODE* pGNode,   //Non Track/Path GNode
  856.     'CtsxBBox3f* pBBox   //BBox updated with result.
  857.     ');
  858. Declare Function tsxGNodeGetBBox Lib "tsxapi.dll" _
  859.     (ByVal pGNode As Long, ByRef pBBox As CtsxBBox3f) As Long
  860.  
  861. '// Get the location of GNode.
  862. '// Returns 0 if not GNODE, else loc.
  863. 'TSXAPIFN CtsxVector3f* tsxGNodeGetLocation(
  864.     'tsxGNODE* pGNode,
  865.     'CtsxVector3f* loc
  866.     ');
  867. Declare Function tsxGNodeGetLocation Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef loc As CtsxVector3f) As Long
  868.  
  869. '// Get the euler angles of GNode's orientation.
  870. '// Returns 0 if not GNODE, else rot.
  871. 'TSXAPIFN CtsxVector3f* tsxGNodeGetRotation(
  872.     'tsxGNODE* pGNode,
  873.     'CtsxVector3f* rot
  874.     ');
  875. Declare Function tsxGNodeGetRotation Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef Rot As CtsxVector3f) As Long
  876.  
  877. '// Get the size of GNode.
  878. '// Returns 0 if not GNODE, else size.
  879. 'TSXAPIFN CtsxVector3f* tsxGNodeGetSize(
  880.     'tsxGNODE* pGNode,
  881.     'CtsxVector3f* size
  882.     ');
  883. Declare Function tsxGNodeGetSize Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef size As CtsxVector3f) As Long
  884.  
  885. '// Set the location of GNode.
  886. 'TSXAPIFN void tsxGNodeSetLocation(
  887.     'tsxGNODE* pGNode,
  888.     'CtsxVector3f* loc
  889.     ');
  890. Declare Sub tsxGNodeSetLocation Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef loc As CtsxVector3f)
  891.  
  892. '// Set the euler angles of GNode's orientation.
  893. 'TSXAPIFN void tsxGNodeSetRotation(
  894.     'tsxGNODE* pGNode,
  895.     'CtsxVector3f* rot
  896.     ');
  897. Declare Sub tsxGNodeSetRotation Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef Rot As CtsxVector3f)
  898.  
  899. '// Set the size of GNode.
  900. 'TSXAPIFN void tsxGNodeSetSize(
  901.     'tsxGNODE* pGNode,
  902.     'CtsxVector3f* size
  903.     ');
  904. Declare Sub tsxGNodeSetSize Lib "tsxapi.dll" (ByVal pGNode As Long, ByRef size As CtsxVector3f)
  905.  
  906. '// Returns Transformation matrix representation of the GNode's axes,
  907. '//         with only Rotation and Translation elements,
  908. '//         and no Scaling/Shearing factors.
  909. '//         0 if not GNode
  910. 'TSXAPIFN CtsxTxmx3f* tsxGNodeGetPureTransform(
  911.     'tsxGNODE* pGNode,
  912.     'CtsxTxmx3f* pTxmx
  913.     ');
  914. Declare Function tsxGNodeGetPureTransform Lib "tsxapi.dll" ( _
  915.       ByVal pGNode As Long, _
  916.       ByRef pTxmx As CtsxTxmx3f) As Long
  917.  
  918. '// Returns Transformation matrix of GNode,
  919. '//         0 if not GNode
  920. 'TSXAPIFN CtsxTxmx3f* tsxGNodeGetTransform(
  921.     'tsxGNODE* pGNode,
  922.     'CtsxTxmx3f* pTxmx
  923.     ');
  924. Declare Function tsxGNodeGetTransform Lib "tsxapi.dll" ( _
  925.       ByVal pGNode As Long, _
  926.       ByRef pTxmx As CtsxTxmx3f) As Long
  927.  
  928. '// Translate GNode by pVec, in the specified reference frame.
  929. 'TSXAPIFN void tsxGNodeTranslate(
  930.     'tsxGNODE* pGNode,
  931.     'CtsxVector3f* pVec, // translation vector
  932.     'tsxFRAMEID frameid   // Reference frame for pVec
  933.     ');
  934. Declare Sub tsxGNodeTranslate Lib "tsxapi.dll" ( _
  935.       ByVal pGNode As Long, _
  936.       ByRef pVec As CtsxVector3f, _
  937.       ByVal frameid As Long)
  938.  
  939. '// Rotate by fAngle radians about pAxis passing thru pCenter,
  940. '// in the specified reference frame.
  941. 'TSXAPIFN void tsxGNodeRotate(
  942.     'tsxGNODE* pGNode,
  943.     'CtsxVector3f* pCenter,  //Center of rotation.
  944.     'CtsxVector3f* pAxis,    //Rotation axis passing thru pCenter.
  945.     'float fAngle,       //Radians. Rotation angle.
  946.     'tsxFRAMEID frameid
  947.     ');
  948. Declare Sub tsxGNodeRotate Lib "tsxapi.dll" ( _
  949.       ByVal pGNode As Long, _
  950.       ByRef pCenter As CtsxVector3f, _
  951.       ByRef pAxis As CtsxVector3f, _
  952.       ByVal fAngle As Single, _
  953.       ByVal frameid As Long)
  954.  
  955. '// Scale by factors along each axis, in the specified reference frame.
  956. '// Scale factors must be non-zero.
  957. 'TSXAPIFN void tsxGNodeScale(
  958.     'tsxGNODE* pGNode,
  959.     'CtsxVector3f* pScaleFacs,   //x, y, z scale factors (non-zero)
  960.     'tsxFRAMEID frameid
  961.     ');
  962. Declare Sub tsxGNodeScale Lib "tsxapi.dll" ( _
  963.       ByVal pGNode As Long, _
  964.       ByRef pScaleFacs As CtsxVector3f, _
  965.       ByVal frameid As Long)
  966.  
  967. '// Scale by factor UNIFORMLY along each axis, in the specified reference frame.
  968. '// Scale factor must be non-zero.
  969. 'TSXAPIFN void tsxGNodeScaleUniform(
  970.     'tsxGNODE* pGNode,
  971.     'float fScaleFac,
  972.     'tsxFRAMEID frameid
  973.     ');
  974. Declare Sub tsxGNodeScaleUniform Lib "tsxapi.dll" ( _
  975.       ByVal pGNode As Long, _
  976.       ByVal pScaleFac As Single, _
  977.       ByVal frameid As Long)
  978.       
  979. '------------------------------------------------------------------------------
  980. '//    File: tsxCamra.h
  981. '//   Descr: Interface to tsxCAMERA
  982.  
  983. '// Creates a camera at world origin, with the viewing plane on the world
  984. '// YZ plane, Z in the up direction, and pointing in the positive world X
  985. '// direction. On success, the new camera is the currently selected object.
  986. 'TSXAPIFN tsxERR tsxCameraCreateInScene();
  987. Declare Function tsxCameraCreateInScene Lib "tsxapi.dll" () As Long
  988.  
  989. '------------------------------------------------------------------------------
  990. '//    File: tsxLight.h
  991. '//   Descr: Interface to tsxLIGHT
  992.  
  993. '// Light types
  994. Enum tsxLIGHT_TYPE
  995.     e_tsxLT_UNDEF = 0
  996.     e_tsxLT_INFINITE '//Light from an very distant source
  997.     e_tsxLT_LOCAL    '//Light from a local point source
  998.     e_tsxLT_SPOT     '//A spot-light
  999. End Enum
  1000.  
  1001. '// Light intensity falloff
  1002. Enum tsxLIGHT_FALLOFF
  1003.     e_tsxLF_UNDEF = 0
  1004.     e_tsxLF_ZERO    '//No falloff
  1005.     e_tsxLF_LINEAR  '//Linear with distance
  1006.     e_tsxLF_SQUARED '//square of distance
  1007. End Enum
  1008.  
  1009. '// Shadow type
  1010. Enum tsxLIGHT_SHADOWING
  1011.     e_tsxLS_NOSHADOWS = 0
  1012.     e_tsxLS_RAYTRACE
  1013.     e_tsxLS_SHADOWMAP
  1014. End Enum
  1015.  
  1016. '// Shadow-map Size
  1017. Enum tsxLIGHT_SMSIZE
  1018.     e_tsxSMZ_UNDEF = 0
  1019.     e_tsxSMZ_LOW
  1020.     e_tsxSMZ_MEDIUM
  1021.     e_tsxSMZ_HIGH
  1022. End Enum
  1023.  
  1024. '// Shadow-map sharpness
  1025. Enum tsxLIGHT_SMSHARPNESS
  1026.     e_tsxSMS_UNDEF = 0
  1027.     e_tsxSMS_LOW
  1028.     e_tsxSMS_MEDIUM
  1029.     e_tsxSMS_HIGH
  1030. End Enum
  1031.  
  1032.  
  1033. '// Creates a Light of specified LtType at world origin,
  1034. '// with default position, orientation and attributes.
  1035. '// On success, the new Light is the currently selected object.
  1036. '// Default location: Spot, Local -- (0,0,1), Infinite -- (0,0,0).
  1037. '// Default orientation: 180 deg rotation about world X, making it
  1038. '//  point towards world origin (spot, infinite) with its Z axis.
  1039. '//  The axes are aligned as follows:
  1040. '//    X aligned with World X,
  1041. '//    Y and Z aligned with world negative Y and negative Z.
  1042. 'TSXAPIFN tsxERR tsxLightCreateInScene( tsxLIGHT_TYPE LtType );
  1043. Declare Function tsxLightCreateInScene Lib "tsxapi.dll" ( _
  1044.     ByVal LtType As tsxLIGHT_TYPE) As Long
  1045.  
  1046. '// Light type
  1047. 'TSXAPIFN tsxLIGHT_TYPE tsxLightGetType( tsxLIGHT* pLight );
  1048. Declare Function tsxLightGetType Lib "tsxapi.dll" ( _
  1049.     ByVal pLight As Long) As tsxLIGHT_TYPE
  1050.  
  1051. '// Get Light color (copied into pColor).
  1052. 'TSXAPIFN void tsxLightGetColor( tsxLIGHT* pLight, CtsxColor* pColor );
  1053. Declare Sub tsxLightGetColor Lib "tsxapi.dll" ( _
  1054.     ByVal pLight As Long, ByRef pColor As CtsxColor)
  1055.  
  1056. '// Set Light color (copied from pColor).
  1057. 'TSXAPIFN void tsxLightSetColor( tsxLIGHT* pLight, CtsxColor* pColor );
  1058. Declare Sub tsxLightSetColor Lib "tsxapi.dll" ( _
  1059.     ByVal pLight As Long, ByRef pColor As CtsxColor)
  1060.       
  1061. '// Get the light intensity. Returns -1 if not a light.
  1062. 'TSXAPIFN float tsxLightGetIntensity( tsxLIGHT* pLight );
  1063. Declare Function tsxLightGetIntensity Lib "tsxapi.dll" ( _
  1064.     ByVal pLight As Long) As Single
  1065.  
  1066. '// Set the light intensity. Returns new intensity, -1.0 if not a light.
  1067. 'TSXAPIFN float tsxLightSetIntensity( tsxLIGHT* pLight, float fNewIntens );
  1068. Declare Function tsxLightSetIntensity Lib "tsxapi.dll" ( _
  1069.     ByVal pLight As Long, ByVal fNewIntens As Single) As Single
  1070.  
  1071. '// Get the light intensity falloff type with distance.
  1072. 'TSXAPIFN tsxLIGHT_FALLOFF tsxLightGetFalloff( tsxLIGHT* pLight );
  1073. Declare Function tsxLightGetFalloff Lib "tsxapi.dll" ( _
  1074.     ByVal pLight As Long) As tsxLIGHT_FALLOFF
  1075.  
  1076. '// Set the light intensity falloff type with distance.
  1077. '// Returns new value, or tsxLF_UNDEF for invalid request.
  1078. 'TSXAPIFN tsxLIGHT_FALLOFF tsxLightSetFalloff( tsxLIGHT* pLight,
  1079. '                          tsxLIGHT_FALLOFF NewFo );
  1080. Declare Function tsxLightSetFalloff Lib "tsxapi.dll" ( _
  1081.     ByVal pLight As Long, ByVal NewFo As tsxLIGHT_FALLOFF) As tsxLIGHT_FALLOFF
  1082.  
  1083. '// Shadowing.
  1084. 'TSXAPIFN tsxLIGHT_SHADOWING tsxLightGetShadType( tsxLIGHT* pLight );
  1085. Declare Function tsxLightGetShadType Lib "tsxapi.dll" ( _
  1086.     ByVal pLight As Long) As tsxLIGHT_SHADOWING
  1087.  
  1088. '// Set shadowing type.
  1089. '// Returns new value, e_tsxLS_NOSHADOWS if not a light.
  1090. 'TSXAPIFN tsxLIGHT_SHADOWING tsxLightSetShadType(
  1091.     'tsxLIGHT* pLight,
  1092.     'tsxLIGHT_SHADOWING newShType
  1093.     ');
  1094. Declare Function tsxLightSetShadType Lib "tsxapi.dll" ( _
  1095.     ByVal pLight As Long, ByVal newShType As tsxLIGHT_SHADOWING) As tsxLIGHT_SHADOWING
  1096.  
  1097. '// True if shadow-map is image size dependent.
  1098. 'TSXAPIFN tsxBOOL tsxLightIsShadImgDep( tsxLIGHT* pLight );
  1099. Declare Function tsxLightIsShadImgDep Lib "tsxapi.dll" ( _
  1100.     ByVal pLight As Long) As tsxBool
  1101.  
  1102. '// (Un)Set shadow-map's image size dependence.
  1103. '// Returns new value, False if not a light.
  1104. 'TSXAPIFN tsxBOOL tsxLightSetShadImgDep(
  1105.     'tsxLIGHT* pLight,
  1106.     'tsxBOOL bDependent //True to make it dependent
  1107.     ');
  1108. Declare Function tsxLightSetShadImgDep Lib "tsxapi.dll" ( _
  1109.     ByVal pLight As Long, bDependent As tsxBool) As tsxBool
  1110.  
  1111. '// Get shadow-map size
  1112. 'TSXAPIFN tsxLIGHT_SMSIZE tsxLightGetShmapSize( tsxLIGHT* pLight );
  1113. Declare Function tsxLightGetShmapSize Lib "tsxapi.dll" ( _
  1114.     ByVal pLight As Long) As tsxLIGHT_SMSIZE
  1115.  
  1116. '// Set shadow-map size. Returns new value, or e_tsxSMZ_UNDEF if invalid request.
  1117. 'TSXAPIFN tsxLIGHT_SMSIZE tsxLightSetShmapSize(
  1118.     'tsxLIGHT* pLight,
  1119.     'tsxLIGHT_SMSIZE NewSz
  1120.     ');
  1121. Declare Function tsxLightSetShmapSize Lib "tsxapi.dll" ( _
  1122.     ByVal pLight As Long, ByVal NewSz As tsxLIGHT_SMSIZE) As tsxLIGHT_SMSIZE
  1123.  
  1124. '// Get shadow-map sharpness (_UNDEF if not light).
  1125. 'TSXAPIFN tsxLIGHT_SMSHARPNESS tsxLightGetShmapSharpness( tsxLIGHT* pLight );
  1126. Declare Function tsxLightGetShmapSharpness Lib "tsxapi.dll" ( _
  1127.     ByVal pLight As Long) As tsxLIGHT_SMSHARPNESS
  1128.  
  1129. '// Set shadow-map sharpness.
  1130. '// Returns new value, or tsxSMS_UNDEF for invalid request.
  1131. 'TSXAPIFN tsxLIGHT_SMSHARPNESS tsxLightSetShmapSharpness(
  1132.     'tsxLIGHT* pLight,
  1133.     'tsxLIGHT_SMSHARPNESS NewSharpness
  1134.     ');
  1135. Declare Function tsxLightSetShmapSharpness Lib "tsxapi.dll" ( _
  1136.     ByVal pLight As Long, ByVal NewSharpness As tsxLIGHT_SMSHARPNESS) As tsxLIGHT_SMSHARPNESS
  1137.  
  1138. '// Get cone angle (in radians).
  1139. '// This is the solid angle of the lit area subtended at the light source.
  1140. '// Returns -1.0 if not a spotlight.
  1141. 'TSXAPIFN float tsxLightGetSpotAngle( tsxLIGHT* pLight );
  1142. Declare Function tsxLightGetSpotAngle Lib "tsxapi.dll" ( _
  1143.     ByVal pLight As Long) As Single
  1144.  
  1145. '// Set the spotlight cone angle (in radians).
  1146. '// Returns the new angle, -1 if not a spotlight.
  1147. 'TSXAPIFN float tsxLightSetSpotAngle( tsxLIGHT* pLight, float newAngle );
  1148. Declare Function tsxLightSetSpotAngle Lib "tsxapi.dll" ( _
  1149.     ByVal pLight As Long, ByVal newAngle As Single) As Single
  1150.  
  1151. '// Get the hot-spot ratio.
  1152. '// The hot-spot in a spotlight is the inner circle of even bright light.
  1153. '// In the lit ring outside the hot-spot, the light intensity decreases
  1154. '// towards the outer edge. The hot-spot ratio is the ratio of the hot-spot
  1155. '// cone solid angle to the entire spotlight cone solid angle.
  1156. '// Returns 0.0 <= ratio <= 1.0, -1.0 if not a light.
  1157. 'TSXAPIFN float tsxLightGetSpotRatio( tsxLIGHT* pLight );
  1158. Declare Function tsxLightGetSpotRatio Lib "tsxapi.dll" ( _
  1159.     ByVal pLight As Long) As Single
  1160.  
  1161. '// Set the hot-spot ratio (see `tsxLightGetSpotRatio').
  1162. '// Returns new value, -1.0 if not a light, or invalid newRatio.
  1163. 'TSXAPIFN float tsxLightSetSpotRatio( tsxLIGHT* pLight, float newRatio );
  1164. Declare Function tsxLightSetSpotRatio Lib "tsxapi.dll" ( _
  1165.     ByVal pLight As Long, ByVal newRatio As Single) As Single
  1166.  
  1167. '------------------------------------------------------------------------------
  1168. '//    File: tsxMNode.h
  1169. '//   Descr: Definition of tsxMNODE
  1170.  
  1171. '// e_tsxTRUE if pSobj is a MNode
  1172. 'TSXAPIFN tsxBOOL tsxIsMNode( tsxSOBJ* pSobj );
  1173. Declare Function tsxIsMNode Lib "tsxapi.dll" (ByVal pSobj As Long) As tsxBool
  1174.  
  1175. '// Returns e_tsxTRUE if pMNode is Visible in a rendered scene.
  1176. '// A Group object may return TRUE even if it does not have any
  1177. '// Polyhdera descendants.
  1178. 'TSXAPIFN tsxBOOL tsxMNodeIsVisible( tsxMNODE* pMNode );
  1179. Declare Function tsxMNodeIsVisible Lib "tsxapi.dll" (ByVal pMNode As Long) As tsxBool
  1180.  
  1181. '// Makes pMNode Visible. Effect on next Draw operation.
  1182. 'TSXAPIFN void tsxMNodeSetVisible( tsxMNODE* pMNode );
  1183. Declare Sub tsxMNodeSetVisible Lib "tsxapi.dll" (ByVal pMNode As Long)
  1184.  
  1185. '// Makes pMNode Invisible. Effect on next Draw operation.
  1186. 'TSXAPIFN void tsxMNodeSetInvisible( tsxMNODE* pMNode );
  1187. Declare Sub tsxMNodeSetInvisible Lib "tsxapi.dll" (ByVal pMNode As Long)
  1188.  
  1189. '// Returns e_tsxTRUE if MNode has its Axes displayed in tS.
  1190. 'TSXAPIFN tsxBOOL tsxMNodeAreAxesVisible( tsxMNODE* pMNode );
  1191. Declare Function tsxMNodeAreAxesVisible Lib "tsxapi.dll" (ByVal pMNode As Long) As tsxBool
  1192.  
  1193. '// Toggles (On/Off) the display of the current object's axes, if applicable.
  1194. 'TSXAPIFN void tsxCurrobjToggleAxes();
  1195. Declare Sub tsxCurrobjToggleAxes Lib "tsxapi.dll" ()
  1196.  
  1197. '// Set the position of MNode's axes.
  1198. '// Does not update views.
  1199. 'TSXAPIFN void tsxMNodeSetAxesPosition( tsxMNODE* pMNode, CtsxVector3f* posn );
  1200. Declare Sub tsxMNodeSetAxesPosition Lib "tsxapi.dll" (ByVal pMNode As Long, ByRef posn As CtsxVector3f)
  1201.  
  1202. '// Set the orientation of MNode's axes.
  1203. '// `axes' must point to valid (orthogonal, unit) axes.
  1204. '// Does not update views.
  1205. 'TSXAPIFN void tsxMNodeSetAxesOrientation( tsxMNODE* pMNode, CtsxAxes3f* axes );
  1206. Declare Sub tsxMNodeSetAxesOrientation Lib "tsxapi.dll" (ByVal pMNode As Long, ByRef axes As CtsxAxes3f)
  1207.  
  1208. '------------------------------------------------------------------------------
  1209. '//    File: tsxGroup.cpp
  1210. '//   Descr: Definition of tsxGROUP
  1211.  
  1212. '// This is the same function as used in the [Glue as Child] button.
  1213. '// (Currobj = currently selected object)
  1214. '// Makes pGNode and Currobj children of a new Group obj, and
  1215. '// the Group obj is placed where Currobj was in the Scene Graph.
  1216. '// The new Group obj becomes the current selection, and acquires
  1217. '// the previous Currobj's axes position and orientation.
  1218. '// The animation timeline window is updated.
  1219. '// pGNode and Currobj must have different Roots (`tsxGNodeGetRoot').
  1220. '// Returns: 0 if no pGNode or Currobj, or not valid GNodes, or
  1221. '//            if pGNode is same as Currobj (no grouping done), else
  1222. '//          ptr to the new Group obj.
  1223. 'TSXAPIFN tsxGROUP* tsxGroupNewWithCurrobj( tsxGNODE* pGNode );
  1224. Declare Function tsxGroupNewWithCurrobj Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1225.  
  1226. '// This is the same function as used in the [Glue as Sibling] button.
  1227. '// (Currobj = currently selected object)
  1228. '// IF Currobj is a Group node,
  1229. '// THEN pGNode is added to it as another child;
  1230. '// ELSE
  1231. '//   Makes pGNode and Currobj children of a new Group obj, and
  1232. '//   the Group obj is placed where Currobj was in the Scene Graph.
  1233. '//   The new Group obj becomes the current selection, and acquires
  1234. '//   the previous Currobj's axes position and orientation.
  1235. '// The animation timeline window is updated.
  1236. '// pGNode and Currobj must have different Roots (`tsxGNodeGetRoot').
  1237. '// pGNode must be a top level object (no parent groups above it).
  1238. '// Returns: 0 if no pGNode or Currobj, or not valid GNodes, or
  1239. '//            if pGNode is same as Currobj (no grouping done), else
  1240. '//          ptr to the (new or Currobj) Group obj.
  1241. 'TSXAPIFN tsxGROUP* tsxGroupAtCurrobj( tsxGNODE* pGNode );
  1242. Declare Function tsxGroupAtCurrobj Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1243.  
  1244. '// This is the same function as used in the [Unglue] button.
  1245. '// Currobj is removed from its parent Group and added as a top level object
  1246. '// to the scene.  Current selection is updated to next available sibling.
  1247. '// Side Effect: If the Currobj has only one sibling before calling this
  1248. '//    function, then the parent GROUP object is removed and the sibling takes
  1249. '//    the place in the scene graph of the removed GROUP object. Thus this
  1250. '//    function never results in a Group object with just one child.
  1251. '// (Parent = parent GROUP of Currobj before calling this function)
  1252. '// Returns:
  1253. '//   0   on failure (e.g. No Currobj, Currobj not part of group), else
  1254. '//   ptr to oject that takes the place of Parent in the scene graph
  1255. '//   (see note on Side Effect):
  1256. '//       = Parent if it had more than 2 children before this function, else
  1257. '//       = the sibling that replaces Parent.
  1258. 'TSXAPIFN tsxGNODE* tsxGroupRemoveCurrobj();
  1259. Declare Function tsxGroupRemoveCurrobj Lib "tsxapi.dll" () As Long
  1260.  
  1261. '------------------------------------------------------------------------------
  1262. '//    File: tsxPolyh.h
  1263. '//   Descr: Definition of tsxPOLYHEDRA
  1264.  
  1265. '// Face -> Vertex data
  1266. '// Note: Use the TSXAPI memory routines (tsxMisc.h) to allocate
  1267. '//  the memory area for instances of this type.
  1268. '//  DO NOT use `new' or `malloc/calloc'!
  1269. Type CtsxFaceVx
  1270.     vix As Long          '// Index into Polyhedron's Vertex Array (see `tsxPolyhGetVxArray').
  1271.     uvix As Long         '// Index into Polyhedron's UV Array.
  1272.     nextfaceix As Long   '// Index (in Polyh) of next face containing this vertex.
  1273.                             '// Use `tsxPolyhComputeFaceAdjacency' to set this field.
  1274.     color As CtsxColor      '//IF color.alpha == 0 THEN use material color
  1275.                             '//OTHERWISE use vertex color.
  1276. End Type
  1277.  
  1278. '// Face.
  1279. '// Faces are one-sided polygons, with their vertices specified in clockwise
  1280. '// order when looking at the front of the polygon. The surface normal points
  1281. '// out of (or away from) the front.
  1282. '// Use `tsxPolyhGetFaceptrArray' to access a polyhedron's faces.
  1283. '// You must use `tsxFaceAlloc' or `tsxFaceCopy' to create instances of this type.
  1284. Type CtsxFace
  1285.     nbrVxs As Integer '//Nbr of Vertices
  1286.     pFVxs As Long     '//Array of Face-Vertex data, Vertices in clockwise order.
  1287.     r1 As Byte        '// reserved
  1288.     r2 As Byte        '// reserved
  1289.     r3 As Long        '// reserved
  1290.     normVxs(0 To 2) As Byte '//Indices into pFVxs of 3 vertices
  1291.                             '// ... to build Face Normal (see below).
  1292.     materialIdx As Integer  '//ID of Face's material
  1293. End Type
  1294.  
  1295. '// Note on the field tsxFace.normVxs ...
  1296. '// The three indices represent three face vertices in clockwise order,
  1297. '// defining two rays in the plane of the face:
  1298. '//    ORIGIN -> RAY1  and  ORIGIN -> RAY2
  1299. '// The cross-product of (ray1 x ray2) gives an unnormalized vector
  1300. '// perpendicular to the face, facing out. These vertices must not be colinear.
  1301. #Const tsx_NORM_VXS_ORIGIN = 1
  1302. #Const tsx_NORM_VXS_RAY1 = 0
  1303. #Const tsx_NORM_VXS_RAY2 = 2
  1304.  
  1305. '// Creates an empty Polyhedron (0 vertices and faces).
  1306. '// The Model-Axes are set to the World Axes.
  1307. '// The Vertex Transformation Matrix is set to the identity matrix
  1308. '// with no translation.
  1309. 'TSXAPIFN tsxERR tsxPolyhCreate( tsxPOLYHEDRON** ppPolyh );
  1310. Declare Function tsxPolyhCreate Lib "tsxapi.dll" (ByRef ppPolyh As Long) As Long
  1311.  
  1312. '// Clears a Polyhedron to 0 vertices & faces, freeing related structures.
  1313. 'TSXAPIFN void tsxPolyhClear( tsxPOLYHEDRON* pPolyh );
  1314. Declare Sub tsxPolyhClear Lib "tsxapi.dll" (ByVal ppPolyh As Long)
  1315.  
  1316. '// Tessellate the polyhedron.
  1317. '// The geometry of the polyhedron is modified so that all faces are triangles.
  1318. '// If the original polyhedron had some non-triangular faces, then the number
  1319. '// of faces will probably increase.  Actually replaces the internal face
  1320. '// and related structures.
  1321. 'TSXAPIFN tsxERR tsxPolyhTessellate( tsxPOLYHEDRON* pPolyh );
  1322. Declare Function tsxPolyhTessellate Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1323.  
  1324. '// Tell tS that this Polyhedron's Geometry has changed.
  1325. 'TSXAPIFN void tsxPolyhMarkGeomChange( tsxPOLYHEDRON* pPolyh );
  1326. Declare Sub tsxPolyhMarkGeomChange Lib "tsxapi.dll" (ByVal pPolyh As Long)
  1327.  
  1328. '// Tell tS that this Polyhedron's Topology has changed.
  1329. 'TSXAPIFN void tsxPolyhMarkTopologyChange( tsxPOLYHEDRON* pPolyh );
  1330. Declare Sub tsxPolyhMarkTopologyChange Lib "tsxapi.dll" (ByVal pPolyh As Long)
  1331.  
  1332. '// Tell tS that this Polyhedron's Material(s) have changed.
  1333. '// Use after modifying UV entries, for example.
  1334. 'TSXAPIFN void tsxPolyhMarkMaterialChange( tsxPOLYHEDRON* pPolyh );
  1335. Declare Sub tsxPolyhMarkMaterialChange Lib "tsxapi.dll" (ByVal pPolyh As Long)
  1336.  
  1337. '// Tell tS that this Polyhedron's Vertex has changed.
  1338. 'TSXAPIFN void tsxPolyhMarkVertexChange( tsxPOLYHEDRON* pPolyh , long vertex );
  1339. Declare Sub tsxPolyhMarkVertexChange Lib "tsxapi.dll" (ByVal pPolyh As Long)
  1340.  
  1341. '// Get the number of vertices (0 if not a Polyhedron).
  1342. 'TSXAPIFN int tsxPolyhGetNbrVxs( tsxPOLYHEDRON* pPolyh );
  1343. Declare Function tsxPolyhGetNbrVxs Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1344.  
  1345. '// Get pointer to the array of vertices (0 if not a Polyhedron).
  1346. '// The Vertex coordinates are in the frame defined by
  1347. '// the Vertex Transformation Matrix.
  1348. 'TSXAPIFN CtsxVector3f* tsxPolyhGetVxArray( tsxPOLYHEDRON* pPolyh );
  1349. Declare Function tsxPolyhGetVxArray Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1350.  
  1351. '// Get the Vertex Transformation Matrix. Returns pTxmx, if valid operation.
  1352. '// Note: This matrix includes scaling and shearing terms, so it is not
  1353. '// guaranteed to be orthogonal. Use `tsxUnMatrix3f' before inverting.
  1354. 'TSXAPIFN CtsxTxmx3f* tsxPolyhGetVxTxmx(
  1355.     'tsxPOLYHEDRON* pPolyh,
  1356.     'CtsxTxmx3f* pTxmx ); //ptr to Txmx where result is copied.
  1357. Declare Function tsxPolyhGetVxTxmx Lib "tsxapi.dll" ( _
  1358.      ByVal pPolyh As Long, _
  1359.      ByRef pTxmx As CtsxTxmx3f) As Long
  1360.  
  1361. '// Assign a new vertex array to the Polyhedron.
  1362. '// The corresponding field in pPolyh is set to pVxs.
  1363. '// Clears old Vx array and frees memory, if any.
  1364. '// Note: Use the TSXAPI memory routines (tsxMisc.h) to allocate
  1365. '// the memory area (pVxs) for the Vertex Array
  1366. '// -- DO NOT use `new' or `malloc/calloc'!
  1367. 'TSXAPIFN void tsxPolyhSetVxs(
  1368.     'tsxPOLYHEDRON* pPolyh,
  1369.     'int iNbrVxs,                // Number of Vxs (>= 0)
  1370.     'CtsxVector3f pVxs[] );      // ptr to Array. May be 0.
  1371. Declare Sub tsxPolyhSetVxs Lib "tsxapi.dll" ( _
  1372.      ByVal pPolyh As Long, _
  1373.      ByVal iNbrVxs As Long, _
  1374.      ByVal pVxs As Long)
  1375.  
  1376. '// Copies a new Vertex Transformation Matrix into pPolyh.
  1377. 'TSXAPIFN void tsxPolyhSetVxTxmx(
  1378. '    tsxPOLYHEDRON* pPolyh,
  1379. '    CtsxTxmx3f* pTxmx ); //ptr to new Txmx copied into Polyh.
  1380. Declare Sub tsxPolyhSetVxTxmx Lib "tsxapi.dll" ( _
  1381.      ByVal pPolyh As Long, _
  1382.      ByRef pTxmx As CtsxTxmx3f)
  1383.  
  1384. '// Allocate a new face structure
  1385. 'TSXAPIFN CtsxFace* tsxFaceAlloc();
  1386. Declare Function tsxFaceAlloc Lib "tsxapi.dll" () As Long
  1387.  
  1388. '// Delete's pFace and all related structures.
  1389. 'TSXAPIFN void tsxFaceDelete( CtsxFace* pFace );
  1390. Declare Sub tsxFaceDelete Lib "tsxapi.dll" (ByVal pFace As Long)
  1391.  
  1392. '// Allocates new Face structure, assigning it to ppFaceCopy,
  1393. '// and Copies pFace and all related structures into it.
  1394. 'TSXAPIFN tsxERR tsxFaceCopy( CtsxFace** ppFaceCopy, CtsxFace* pFace );
  1395. Declare Function tsxFaceCopy Lib "tsxapi.dll" (ByRef ppFaceCopy As Long, ByVal pFace As Long) As Long
  1396.  
  1397. '// Get the number of Faces (0 if not a Polyhedron).
  1398. 'TSXAPIFN int tsxPolyhGetNbrFaces( tsxPOLYHEDRON* pPolyh );
  1399. Declare Function tsxPolyhGetNbrFaces Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1400.  
  1401. '// Get pointer to the array of Face-ptrs (0 if not a Polyhedron).
  1402. 'TSXAPIFN CtsxFace** tsxPolyhGetFaceptrArray( tsxPOLYHEDRON* pPolyh );
  1403. Declare Function tsxPolyhGetFaceptrArray Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1404.  
  1405. '// Assign a new Face-ptr array to the Polyhedron.
  1406. '// The corresponding field in pPolyh is set to pFaces.
  1407. '// Clears old Faces and array and frees memory, if any.
  1408. '// Note: Use the TSXAPI memory routines (tsxMisc.h) to allocate
  1409. '// the memory area (pFaces) for the Face Array
  1410. '// -- DO NOT use `new' or `malloc/calloc'!
  1411. 'TSXAPIFN void tsxPolyhSetFaces(
  1412.     'tsxPOLYHEDRON* pPolyh,
  1413.     'int iNbrFaces,              // Number of Faces (>= 0)
  1414.     'CtsxFace* pFaces[] );       // Array of ptrs. May be 0.
  1415. Declare Sub tsxPolyhSetFaces Lib "tsxapi.dll" ( _
  1416.     ByVal pPolyh As Long, _
  1417.     ByVal iNbrFaces As Long, _
  1418.     ByVal pFaces As Long)
  1419.  
  1420. '// Uses pFace->normVxs to compute face normal of pFace in pPolyh.
  1421. '// Normal returned in pNorm, in the frame defined by the
  1422. '// Vertex Transformation Matrix.
  1423. 'TSXAPIFN void tsxPolyhGetFaceNormal(
  1424.     'tsxPOLYHEDRON* pPolyh,
  1425.     'CtsxFace* pFace,
  1426.     'CtsxVector3f* pNorm ); //ptr to struct where result is copied.
  1427. Declare Sub tsxPolyhGetFaceNormal Lib "tsxapi.dll" ( _
  1428.     ByVal pPolyh As Long, _
  1429.     ByVal pFace As Long, _
  1430.     ByRef pNorm As CtsxVector3f)
  1431.  
  1432. '// Sets up the `nextfaceix' fields in CtsxFaceVx structs.
  1433. '// Call after all the other Face-Vertex data has been set for all faces.
  1434. 'TSXAPIFN tsxERR tsxPolyhComputeFaceAdjacency( tsxPOLYHEDRON* pPolyh );
  1435. Declare Function tsxPolyhComputeFaceAdjacency Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1436.  
  1437. '// Get the number of entries in UV-array (0 if not a Polyhedron).
  1438. 'TSXAPIFN int tsxPolyhGetNbrUV( tsxPOLYHEDRON* pPolyh );
  1439. Declare Function tsxPolyhGetNbrUV Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1440.  
  1441. '// Get pointer to the UV-array (0 if not a Polyhedron).
  1442. 'TSXAPIFN CtsxUV* tsxPolyhGetUVArray( tsxPOLYHEDRON* pPolyh );
  1443. Declare Function tsxPolyhGetUVArray Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1444.  
  1445. '// Assign a new UV array to the Polyhedron.
  1446. '// The corresponding field in pPolyh is set to pUV.
  1447. '// Clears old Faces and array and frees memory, if any.
  1448. '// Note: Use the TSXAPI memory routines (tsxMisc.h) to allocate
  1449. '// the memory area (pUV) for the UV Array -- DO NOT use `new' or `malloc/calloc'!
  1450. 'TSXAPIFN void tsxPolyhSetUVArray(
  1451.     'tsxPOLYHEDRON* pPolyh,
  1452.     'int iNbrUV,         // Number of UV entries (>= 0)
  1453.     'CtsxUV *pUV );      // ptr to UV-Array. May be 0.
  1454. Declare Sub tsxPolyhSetUVArray Lib "tsxapi.dll" ( _
  1455.     ByVal pPolyh As Long, _
  1456.     ByVal iNbrUV As Long, _
  1457.     ByVal pUV As Long)
  1458.  
  1459. '// Assigns active material to entire Polyhedron.
  1460. '// Call this function AFTER setting/modifying a polyhedron's geometry,
  1461. '// and BEFORE painting faces or vertices.
  1462. '// Use other material functions to specify specific materials.
  1463. 'TSXAPIFN tsxERR tsxPolyhInitializeMaterials( tsxPOLYHEDRON* pPolyh );
  1464. Declare Function tsxPolyhInitializeMaterials Lib "tsxapi.dll" (ByVal pPolyh As Long) As Long
  1465.  
  1466. '// Give entire pPolyh the material pMatrl. Remove old materials.
  1467. '// Note: A copy of pMatrl is created and assigned to the Polyhedron.
  1468. '//       Caller is responsible for managing pMatrl.
  1469. 'TSXAPIFN void tsxPolyhPaint( tsxPOLYHEDRON* pPolyh, tsxMATERIAL* pMatrl );
  1470. Declare Sub tsxPolyhPaint Lib "tsxapi.dll" (ByVal pPolyh As Long, ByVal pMatrl As Long)
  1471.  
  1472. '// Paint face with a material.
  1473. '// Returns e_tsxFALSE on failure or if object not changed.
  1474. '// Note: A copy of pMatrl is created and assigned to the Polyhedron.
  1475. '//       Caller is responsible for managing pMatrl.
  1476. 'TSXAPIFN tsxBOOL tsxPolyhPaintFace(
  1477.     'tsxPOLYHEDRON* pPolyh,
  1478.     'int iFaceIndex,             //Index of face to be painted in pPolyh
  1479.     'tsxMATERIAL* pMatrl,        //New material to paint on face
  1480.     'tsxBOOL bClearVxColors      //e_tsxTRUE if Vertex colors should be cleared.
  1481.     ');
  1482. Declare Function tsxPolyhPaintFace Lib "tsxapi.dll" ( _
  1483.     ByVal pPolyh As Long, _
  1484.     ByVal iFaceIndex As Long, _
  1485.     ByVal pMatrl As Long, _
  1486.     bClearVxColors As tsxBool) As tsxBool
  1487.  
  1488. '// Paint vertex with a color.
  1489. '// Returns e_tsxFALSE on failure or if object not changed.
  1490. '// Note: A copy of pColor is created and assigned to the Polyhedron.
  1491. '//       Caller is responsible for managing pColor.
  1492. 'TSXAPIFN tsxBOOL tsxPolyhPaintVertex(
  1493.     'tsxPOLYHEDRON* pPolyh,
  1494.     'int iVxIndex,               //Index of face to be painted in pPolyh
  1495.     'CtsxColor* pColor           //New color to paint on face
  1496.     ');
  1497. Declare Function tsxPolyhPaintVertex Lib "tsxapi.dll" ( _
  1498.     ByVal pPolyh As Long, _
  1499.     ByVal iVxIndex As Long, _
  1500.     ByRef pColor As CtsxColor) As tsxBool
  1501.  
  1502. '// Use this function to access the material assigned to a face.
  1503. '// pMatrl is a pointer to a Material object created through one of the
  1504. '// tsxMaterialCreate functions. The face's material, if any, is copied
  1505. '// into this structure.
  1506. '// Returns e_tsxFALSE on failure or if face does not have a material.
  1507. 'TSXAPIFN tsxBOOL tsxPolyhGetMaterial(
  1508.     'tsxPOLYHEDRON* pPolyh,
  1509.     'unsigned short materialIdx,  //From CtsxFace.materialIdx
  1510.     'tsxMATERIAL* pMatrl          //Material copied into this structure
  1511.     ');
  1512. Declare Function tsxPolyhGetMaterial Lib "tsxapi.dll" ( _
  1513.     ByVal pPolyh As Long, _
  1514.     ByVal materialIdx As Integer, _
  1515.     ByVal pMatrl As Long) As tsxBool
  1516.  
  1517. '// Photo-render a face in the active view.
  1518. 'TSXAPIFN tsxERR tsxPolyhPhrenderFace( tsxPOLYHEDRON* pPolyh, int iFaceIndex );
  1519. Declare Function tsxPolyhPhrenderFace Lib "tsxapi.dll" (ByVal pPolyh As Long, ByVal iFaceIndex As Integer) As Long
  1520.  
  1521. '// Creates a sphere sitting on the XY plane, with Z as the vertical axis.
  1522. 'TSXAPIFN tsxPOLYHEDRON* tsxCreateSphere(
  1523.     'int NbrLongitudes,  // # Longs (Min = 3)
  1524.     'int NbrLattitudes,  // # Latts (Min = 2)
  1525.     'float radius );
  1526. Declare Function tsxCreateSphere Lib "tsxapi.dll" ( _
  1527.     ByVal NbrLongitudes As Long, _
  1528.     ByVal NbrLattitudes As Long, _
  1529.     ByVal radius As Single) As Long
  1530.  
  1531. '// Creates a Cylinder with the base in the XY plane and Z as the vertical axis.
  1532. 'TSXAPIFN tsxPOLYHEDRON* tsxCreateCylinder(
  1533.     'int NbrLongitudes,  // # Longs (Min = 3)
  1534.     'int NbrLattitudes,  // # Latts (Min = 2)
  1535.     'float topRadius,    // Top radius
  1536.     'float botRadius,    // Base radius
  1537.     'float height );
  1538. Declare Function tsxCreateCylinder Lib "tsxapi.dll" ( _
  1539.     ByVal NbrLongitudes As Long, _
  1540.     ByVal NbrLattitudes As Long, _
  1541.     ByVal topRadius As Single, _
  1542.     ByVal botRadius As Single, _
  1543.     ByVal height As Single) As Long
  1544.  
  1545. '// Creates a Cone (really a cylinder with a very very small top)
  1546. '// with the base in the XY plae, and Z as the vertical axis.
  1547. 'TSXAPIFN tsxPOLYHEDRON* tsxCreateCone(
  1548.     'int NbrLongitudes,  // # Longitudes (Min = 3)
  1549.     'int NbrLattitudes,  // # Lattitudes (Min = 2)
  1550.     'float botRadius,    // Base radius
  1551.     'float height );
  1552. Declare Function tsxCreateCone Lib "tsxapi.dll" ( _
  1553.     ByVal NbrLongitudes As Long, _
  1554.     ByVal NbrLattitudes As Long, _
  1555.     ByVal botRadius As Single, _
  1556.     ByVal height As Single) As Long
  1557.  
  1558. '// Creates a cube aligned with the World axes.
  1559. 'TSXAPIFN tsxPOLYHEDRON* tsxCreateCube(
  1560.     'int nbrSections,
  1561.     'float x,
  1562.     'float y,
  1563.     'float z );
  1564. Declare Function tsxCreateCube Lib "tsxapi.dll" ( _
  1565.     ByVal nbrSections As Long, _
  1566.     ByVal x As Single, _
  1567.     ByVal y As Single, _
  1568.     ByVal z As Single) As Long
  1569.  
  1570. '// Create a torus with Z as the axis.
  1571. 'TSXAPIFN tsxPOLYHEDRON* tsxCreateTorus(
  1572.     'int NbrLongitudes,  // # Longitudes (Min = 3)
  1573.     'int NbrLattitudes,  // # Lattitudes (Min = 3)
  1574.     'float innerRadius ); // Inner radius (0 < radius < 1.0)
  1575. Declare Function tsxCreateTorus Lib "tsxapi.dll" ( _
  1576.     ByVal NbrLongitudes As Long, _
  1577.     ByVal NbrLatitudes As Long, _
  1578.     ByVal innerRadius As Single) As Long
  1579.  
  1580. '// Creates rectangular plane in XY plane.
  1581. 'TSXAPIFN tsxPOLYHEDRON* tsxCreatePlane(
  1582.     'int nbrXrects,      // # rects in X direction (Min = 1)
  1583.     'int nbrYrects );    // # rects in Y direction (Min = 1)
  1584. Declare Function tsxCreatePlane Lib "tsxapi.dll" ( _
  1585.     ByVal nbrXrects As Long, _
  1586.     ByVal nbrYrects As Long) As Long
  1587.  
  1588. '------------------------------------------------------------------------------
  1589. '//    File: tsxSelect.h
  1590. '//   Descr: The Selection Mechanism
  1591.  
  1592. Enum tsxSELECTMODE
  1593.     e_tsxSELECT    '// Ordinary Selection of a Node.
  1594.     e_tsxERASE     '// For selecting an object after erasing curr obj.
  1595.     e_tsxGLUE      '// For selecting an object to attach to curr obj.
  1596. End Enum
  1597.  
  1598. '// e_tsxTRUE if pSobj is of supported selectable type (see doc above).
  1599. 'TSXAPIFN tsxBOOL tsxIsSelectable( tsxSOBJ* pSobj );
  1600. Declare Function tsxIsSelectable Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1601.  
  1602. '// e_tsxTRUE if pSobj is part of a selected Object/Group
  1603. 'TSXAPIFN tsxBOOL tsxIsSelected( tsxSOBJ* pSobj );
  1604. Declare Function tsxIsSelected Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1605.  
  1606. '// Get pointer to the currently selected object.
  1607. '// Note: trueSpace may select objects that are not currently supported in TSX.
  1608. 'TSXAPIFN tsxSOBJ* tsxGetCurrentSelection();
  1609. Declare Function tsxGetCurrentSelection Lib "tsxapi.dll" () As Long
  1610.  
  1611. '// Essentially same (with correct args) as picking an object with the mouse.
  1612. '// Make specified pSobj the current selection.
  1613. '// Set `bNoDraw' to e_tsxTRUE if you do not wish the object to be redrawn in
  1614. '// "selected" mode.  Use this feature carefully, as it might result in all
  1615. '// or portions of the object being erased when the next object is selected.
  1616. '// Primarily meant as a mechanism for temporarily selecting an object for
  1617. '// operations, and to be followed by a scene refresh.
  1618. 'TSXAPIFN void tsxSelectSobj(
  1619.     'tsxSOBJ* pSobj,     //Must be `tsxIsSelectable'
  1620.     'tsxSELECTMODE selmode,
  1621.     'tsxBOOL bNoDraw     //TRUE if Views should not be updated.
  1622.     ');
  1623. Declare Sub tsxSelectSobj Lib "tsxapi.dll" ( _
  1624.     ByVal pSobj As Long, _
  1625.     ByVal selmode As Long, _
  1626.     ByVal bNoDraw As tsxBool _
  1627.     )
  1628.  
  1629. '// Same function as called on the [downArrow] button.
  1630. '// Selects a child of the Currobj.
  1631. '// Views updated.
  1632. 'TSXAPIFN void tsxSelectDown();
  1633. Declare Sub tsxSelectDown Lib "tsxapi.dll" ()
  1634.  
  1635. '// Same function as called on the [upArrow] button.
  1636. '// Selects parent of Currobj.
  1637. '// Views updated.
  1638. 'TSXAPIFN void tsxSelectUp();
  1639. Declare Sub tsxSelectUp Lib "tsxapi.dll" ()
  1640.  
  1641. '// Same function as called on the <rightArrow> key.
  1642. '// Selects a sibling of the Currobj, following Currobj in the list.
  1643. '// Views updated.
  1644. 'TSXAPIFN void tsxSelectNext();
  1645. Declare Sub tsxSelectNext Lib "tsxapi.dll" ()
  1646.  
  1647. '// Same function as called on the <leftArrow> key.
  1648. '// Selects a sibling of the Currobj, preceeding Currobj in the list.
  1649. '// Views updated.
  1650. 'TSXAPIFN void tsxSelectPrev();
  1651. Declare Sub tsxSelectPrev Lib "tsxapi.dll" ()
  1652.  
  1653. '// Removes the current object and substitutes it with pNewGNode.
  1654. '// If the selected part of the current object does not include it's children,
  1655. '// the children are moved to the new object and removed from the current
  1656. '// object, leaving the children non-selected. pNewGNode is installed in
  1657. '// Currobj's location, and becomes the new Currobj. The old Currobj is deleted.
  1658. 'TSXAPIFN void tsxCurrobjReplace(
  1659.     'tsxGNODE* pNewGNode,
  1660.     'tsxBOOL bNoDraw    //TRUE if View displays should not be refreshed.
  1661.     ');
  1662. Declare Sub tsxCurrobjReplace Lib "tsxapi.dll" (ByVal pNewGNode As Long, ByVal bNoDraw As Long)
  1663.  
  1664. '// Copy curr obj and add to scene at top level, making it new currobj.
  1665. 'TSXAPIFN tsxERR tsxCurrobjCopy();
  1666. Declare Function tsxCurrobjCopy Lib "tsxapi.dll" () As Long
  1667.  
  1668. '// Draw the curr selection
  1669. 'TSXAPIFN void tsxCurrobjDraw();
  1670. Declare Sub tsxCurrobjDraw Lib "tsxapi.dll" ()
  1671.  
  1672. '// Photo-render the current object in the active view.
  1673. 'TSXAPIFN void tsxCurrobjPhrender();
  1674. Declare Sub tsxCurrobjPhrender Lib "tsxapi.dll" ()
  1675.  
  1676. '------------------------------------------------------------------------------
  1677. '//    File: tsxAnim.h
  1678. '//   Descr: Animation
  1679.  
  1680. Enum tsxKFRAME_TYPE
  1681.     e_tsxKFT_UNDEF '         // undefined
  1682.     e_tsxKFT_LOOK '          // look at object or ahead (valid only for tsxGNODE types)
  1683.     e_tsxKFT_ROTATE '        // object rotate (valid only for tsxGNODE types)
  1684.     e_tsxKFT_MOVE '          // object move (valid only for tsxGNODE types)
  1685.     e_tsxKFT_SCALE '         // object scale (valid only for tsxGNODE types)
  1686.     e_tsxKFT_DEFORM '        // object deformation (valid only for tsxLATTICE type)
  1687.     e_tsxKFT_RECT '          // material rectangle position and siza in UV space (valid only for tsxMATRECT type)
  1688.     e_tsxKFT_COLOR '         // color of material (valid only for tsxMATERIAL type)
  1689.     e_tsxKFT_SURFACE '       // shader of material (valid only for tsxMATERIAL type)
  1690.     e_tsxKFT_BUMP '          // bump mapping of material (valid only for tsxMATERIAL type)
  1691.     e_tsxKFT_TEXTURE '       // texture mapping of material (valid only for tsxMATERIAL type)
  1692.     e_tsxKFT_PROCTEX '       // procedural texture of material (valid only for tsxMATERIAL type)
  1693.     e_tsxKFT_ENVIRON '       // environment mapping of material (valid only for tsxMATERIAL type)
  1694.     e_tsxKFT_FACETCOS '      // autofacet angle of material (valid only for tsxMATERIAL type)
  1695.     e_tsxKFT_LCOLOR '        // color of light (valid only for tsxLIGHT type)
  1696.     e_tsxKFT_BACKGROUND '    // background (valid only for tsxSCENE type)
  1697.     e_tsxKFT_GLOBENV '       // global environment (valid only for tsxSCENE type)
  1698.     e_tsxKFT_FOG '           // fog (valid only for tsxSCENE type)
  1699.     e_tsxKFT_RAYTRACE '      // raytrace refraction (valid only for tsxSCENE type)
  1700.     e_tsxKFT_PLUGIN '        // Photoshop plugin (valid only for tsxPLUGIN type)
  1701.     e_tsxKFT_NAIL '          // position of nail (valid only for tsxNAIL type)
  1702.     e_tsxKFT_JOINT '         // joint parameters (valid only for tsxJOINT type)
  1703.     e_tsxKFT_KINEMATICS '    // inverse kinematics (valid only for tsxGROUP type)
  1704.     e_tsxKFT_VERTEX '        // vertex move (valid only for tsxPOLYHEDRON type)
  1705.     e_tsxKFT_INVISIBLE '     // invisibility (valid only for tsxPOLYHEDRON and tsxGROUP types)
  1706.     e_tsxKFT_END
  1707. End Enum
  1708.  
  1709.  
  1710. '// Creates and attaches a Script, if none present.
  1711. 'TSXAPIFN tsxERR tsxSobjCreateScript( tsxSOBJ* pSobj );
  1712. Declare Function tsxSobjCreateScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1713. '// Creates and attaches a Script, if none present.
  1714. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1715. 'TSXAPIFN tsxERR tsxGNodeCreateScript( tsxGNODE* pGNode );
  1716. Declare Function tsxGNodeCreateScript Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1717.  
  1718. '// Creates and attaches a Script, if none present for object and all its children
  1719. 'TSXAPIFN tsxERR tsxSobjTreeCreateScript( tsxSOBJ* pSobj );
  1720. Declare Function tsxSobjTreeCreateScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1721. '// Creates and attaches a Script, if none present for object and all its children
  1722. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1723. 'TSXAPIFN tsxERR tsxGNodeCreateScriptTree( tsxGNODE* pGNode );
  1724. Declare Function tsxGNodeCreateScriptTree Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1725.  
  1726.  
  1727. '// Deletes animation for the object
  1728. 'TSXAPIFN tsxERR tsxSobjDeleteScript( tsxSOBJ* pSobj );
  1729. Declare Function tsxSobjDeleteScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1730. '// Deletes animation for the object
  1731. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1732. 'TSXAPIFN tsxERR tsxGNodeDeleteScript( tsxGNODE* pGNode );
  1733. Declare Function tsxGNodeDeleteScript Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1734.  
  1735. '// Deletes animation for for object and all its children
  1736. 'TSXAPIFN tsxERR tsxSobjTreeDeleteScript( tsxSOBJ* pSobj );
  1737. Declare Function tsxSobjTreeDeleteScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1738. '// Deletes animation for for object and all its children
  1739. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1740. 'TSXAPIFN tsxERR tsxGNodeDeleteScriptTree( tsxGNODE* pGNode );
  1741. Declare Function tsxGNodeDeleteScriptTree Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1742.  
  1743. '// Copies animation of From object to destination To object
  1744. 'TSXAPIFN tsxERR tsxSobjCopyScript( tsxSOBJ* pSobjTo, tsxSOBJ* pSobjFrom );
  1745. Declare Function tsxSobjCopyScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1746. '// Copies animation of From object to destination To object
  1747. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1748. 'TSXAPIFN tsxERR tsxGNodeCopyScript( tsxGNODE* pGNodeTo, tsxGNODE* pGNodeFrom );
  1749. Declare Function tsxGNodeCopyScript Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  1750.  
  1751. '// Tests for an empty animation of the object
  1752. 'TSXAPIFN tsxBOOL tsxSobjEmptyScript( tsxSOBJ* pSobj );
  1753. Declare Function tsxSobjEmptyScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1754. '// Tests for an empty animation of the object and all its children
  1755. 'TSXAPIFN tsxBOOL tsxSobjTreeEmptyScript( tsxSOBJ* pSobj );
  1756. Declare Function tsxSobjTreeEmptyScript Lib "tsxapi.dll" (ByVal pSobj As Long) As Long
  1757.  
  1758. Enum tsxANIM_PLAYMODE
  1759.     e_tsxPLAY_SCENE '    // Update whole scene when ActiveTime changed.
  1760.     e_tsxPLAY_OBJECT '   // Update only selected object when ActiveTime changed.
  1761. End Enum
  1762.  
  1763. '// Set the active frame number for pGNode, related preparation.
  1764. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1765. '// Although it says that it sets frame number for specified GNode,
  1766. '// it only changes the active frame number indicator without any change
  1767. '// of GNode.
  1768. 'TSXAPIFN void tsxAnimSetActiveFrame( tsxGNODE* pGNode, float frameNbr );
  1769. Declare Sub tsxAnimSetActiveFrame Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal frameNbr As Single)
  1770.  
  1771. '// Set the active frame number.
  1772. '// It updates whole scene according the new frame number. If there is an
  1773. '// animated object in the scene, it may be changed to correspond its keyframes.
  1774. '// So if an eXtension is animating the Sobj, it should repeat following three
  1775. '// steps:
  1776. '// 1/ set the active frame number,
  1777. '// 2/ change animated attribute of Sobj (i.e. its position),
  1778. '// 3/ create keyframe of the attribute in active frame number (see below).
  1779. 'TSXAPIFN void tsxAnimSetActiveTime( float frameNbr );
  1780. Declare Sub tsxAnimSetActiveTime Lib "tsxapi.dll" (ByVal frameNbr As Single)
  1781.  
  1782. '// Get the active frame number.
  1783. 'TSXAPIFN float tsxAnimGetActiveTime( void );
  1784. Declare Function tsxAnimGetActiveTime Lib "tsxapi.dll" () As Single
  1785.  
  1786. '// Specify callback function for a change of the active frame number.
  1787. '// The function `func' will get called each time there is a change in the
  1788. '// frame number, made by the normal trueSpace animation panels or through a
  1789. '// call to one of the above functions for setting active time. Use 0 (NULL)
  1790. '// to remove an installed callback.
  1791. '// Returns the previous callback function pointer (or 0 if none).
  1792. 'TSXAPIFN tsxBasicCallbackFP tsxActiveTimeChangedCB(
  1793.     'int tsxid,                  // Id of this eXtn (see tsxGetData).
  1794.     'tsxBasicCallbackFP func     // This function gets installed as the callback.
  1795.     ');
  1796. Declare Function tsxActiveTimeChangedCB Lib "tsxapi.dll" ( _
  1797.     ByVal tsxid As Long, _
  1798.     func As Long) As Long
  1799.  
  1800. '// Set ranges for playback.
  1801. 'TSXAPIFN void tsxAnimSetPlayRanges( float start, float end );
  1802. Declare Sub tsxAnimSetPlayRanges Lib "tsxapi.dll" (ByVal pStart As Single, ByVal pEnd As Single)
  1803.  
  1804. '// Get ranges for playback.
  1805. 'TSXAPIFN void tsxAnimGetPlayRanges( float* start, float* end );
  1806. Declare Sub tsxAnimGetPlayRanges Lib "tsxapi.dll" (ByRef pStart As Single, ByRef pEnd As Single)
  1807.  
  1808. '// Set mode for playback.
  1809. 'TSXAPIFN void tsxAnimSetPlayMode( tsxANIM_PLAYMODE mode );
  1810. Declare Sub tsxAnimSetPlayMode Lib "tsxapi.dll" (ByVal mode As tsxANIM_PLAYMODE)
  1811.  
  1812. '// Get mode for playback.
  1813. 'TSXAPIFN tsxANIM_PLAYMODE tsxAnimGetPlayMode( void );
  1814. Declare Function tsxAnimGetPlayMode Lib "tsxapi.dll" () As tsxANIM_PLAYMODE
  1815.  
  1816. '// Run playback.
  1817. 'TSXAPIFN tsxERR tsxAnimPlay( void );
  1818. Declare Function tsxAnimPlay Lib "tsxapi.dll" () As Long
  1819.  
  1820. '// Get base framerate.
  1821. 'TSXAPIFN float tsxAnimGetBaseFramerate(void);
  1822. Declare Function tsxAnimGetBaseFramerate Lib "tsxapi.dll" () As Single
  1823.  
  1824. '// Create Keyframe (at curr active frame nbr) for obj, for specified attributes.
  1825. 'TSXAPIFN tsxERR tsxSobjSetFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  1826. Declare Function tsxSobjSetFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  1827. '// Create Keyframe (at curr active frame nbr) for obj, for specified attributes.
  1828. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1829. 'TSXAPIFN tsxERR tsxGNodeSetFrame( tsxGNODE* pGNode, tsxKFRAME_TYPE keyfType );
  1830. Declare Function tsxGNodeSetFrame Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  1831.  
  1832. '// Delete Keyframe (at curr active frame nbr) for obj, for specified attributes.
  1833. 'TSXAPIFN tsxERR tsxSobjUnsetFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  1834. Declare Function tsxSobjUnsetFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  1835. '// Delete Keyframe (at curr active frame nbr) for obj, for specified attributes.
  1836. '// Obsolete for tS3.1 and later versions, kept for compatibility with tS3.0
  1837. 'TSXAPIFN tsxERR tsxGNodeUnsetFrame( tsxGNODE* pGNode, tsxKFRAME_TYPE keyfType );
  1838. Declare Function tsxGNodeUnsetFrame Lib "tsxapi.dll" (ByVal pGNode As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  1839.  
  1840.  
  1841. '// Get time of the first frame for specified attribute if it exists (otherwise -1).
  1842. 'TSXAPIFN float tsxSobjGetFirstTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  1843. Declare Function tsxSobjGetFirstTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Single
  1844.  
  1845. '// Get time of the last frame for specified attribute if it exists (otherwise -1).
  1846. 'TSXAPIFN float tsxSobjGetLastTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  1847. Declare Function tsxSobjGetLastTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Single
  1848.  
  1849. '// Get time of the next frame for specified attribute if it exists (otherwise -1).
  1850. 'TSXAPIFN float tsxSobjGetNextTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, float time );
  1851. Declare Function tsxSobjGetNextTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal time As Single) As Single
  1852.  
  1853. '// Get time of the previous frame for specified attribute if it exists (otherwise -1).
  1854. 'TSXAPIFN float tsxSobjGetPrevTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, float time );
  1855. Declare Function tsxSobjGetPrevTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal time As Single) As Single
  1856.  
  1857. '// Get time of the closest next frame for specified attribute for whole tree if it exists (otherwise -1).
  1858. 'TSXAPIFN float tsxSobjTreeGetNextTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, float time );
  1859. Declare Function tsxSobjTreeGetNextTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal time As Single) As Single
  1860.  
  1861. '// Get time of the closest previous frame for specified attribute for whole tree if it exists (otherwise -1).
  1862. 'TSXAPIFN float tsxSobjTreeGetPrevTime( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, float time );
  1863. Declare Function tsxSobjTreeGetPrevTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal time As Single) As Single
  1864.  
  1865. '// Get time ranges of whole animation of Sobj.
  1866. 'TSXAPIFN tsxERR tsxSobjGetMinMaxTime( tsxSOBJ* pSobj, float* min, float* max );
  1867. Declare Function tsxSobjGetMinMaxTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByRef min As Single, ByRef max As Single) As Long
  1868.  
  1869. '// Get time ranges of whole animation of Sobj and all its children.
  1870. 'TSXAPIFN tsxERR tsxSobjTreeGetMinMaxTime( tsxSOBJ* pSobj, float* min, float* max );
  1871. Declare Function tsxSobjTreeGetMinMaxTime Lib "tsxapi.dll" (ByVal pSobj As Long, ByRef min As Single, ByRef max As Single) As Long
  1872.  
  1873. '// Create Keyframe for specified attribute.
  1874. 'TSXAPIFN tsxERR tsxFrameCreate( tsxKEYFRAME** ppKFrame, tsxKFRAME_TYPE keyfType );
  1875. Declare Function tsxFrameCreate Lib "tsxapi.dll" (ByRef ppKFrame As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  1876.  
  1877. '// Delete Keyframe.
  1878. 'TSXAPIFN void tsxFrameDelete( tsxKEYFRAME* pKFrame );
  1879. Declare Sub tsxFrameDelete Lib "tsxapi.dll" (ByVal pKFrame As Long)
  1880.  
  1881. '// Get attribute of Keyframe.
  1882. 'TSXAPIFN tsxKFRAME_TYPE tsxFrameGetType( tsxKEYFRAME* pKFrame );
  1883. Declare Function tsxFrameGetType Lib "tsxapi.dll" (ByVal pKFrame As Long) As tsxKFRAME_TYPE
  1884.  
  1885. '// Get name of attribute.
  1886. 'TSXAPIFN const char* tsxAnimGetTypeName( tsxKFRAME_TYPE keyfType );
  1887. Declare Function tsxAnimGetTypeName Lib "tsxapi.dll" (ByVal keyfType As tsxKFRAME_TYPE) As String
  1888.  
  1889. '// Copy Keyframe.
  1890. 'TSXAPIFN tsxERR tsxFrameCopy( tsxKEYFRAME* pKFrame, tsxKEYFRAME** ppKFrameCopy );
  1891. Declare Function tsxFrameCopy Lib "tsxapi.dll" (ByVal pKFrame As Long, ByRef ppKFrameCopy As Long) As Long
  1892.  
  1893. '// Add Keyframe to obj, for specified attribute (and optional segment).
  1894. 'TSXAPIFN tsxERR tsxSobjInsertFrame( tsxSOBJ* pSobj, tsxKEYFRAME* pKFrame , long segment, float time );
  1895. Declare Function tsxSobjInsertFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal pKFrame As Long, ByVal segment As Long, ByVal time As Single) As Long
  1896.  
  1897. '// Remove Keyframe from whatever list it is in.
  1898. 'TSXAPIFN void tsxFrameRemove( tsxKEYFRAME* pKFrame );
  1899. Declare Sub tsxFrameRemove Lib "tsxapi.dll" (ByVal pKFrame As Long)
  1900.  
  1901. '// Get first Keyframe of obj, for specified attribute (and optional segment).
  1902. 'TSXAPIFN tsxKEYFRAME* tsxSobjGetFirstFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment );
  1903. Declare Function tsxSobjGetFirstFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long) As Long
  1904.  
  1905. '// Get last Keyframe of obj, for specified attribute (and optional segment).
  1906. 'TSXAPIFN tsxKEYFRAME* tsxSobjGetLastFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment );
  1907. Declare Function tsxSobjGetLastFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long) As Long
  1908.  
  1909. '// Get Keyframe at specified time for specified attribute (and optional segment) if it exists.
  1910. 'TSXAPIFN tsxKEYFRAME* tsxSobjGetFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment, float time );
  1911. Declare Function tsxSobjGetFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long, ByVal time As Single) As Long
  1912.  
  1913. '// Get closest previous (to specified time) Keyframe of obj, for specified attribute (and optional segment).
  1914. 'TSXAPIFN tsxKEYFRAME* tsxSobjGetLeftFrame( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment, float time );
  1915. Declare Function tsxSobjGetLeftFrame Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long, ByVal time As Single) As Long
  1916.  
  1917. '// Get next Keyframe.
  1918. 'TSXAPIFN tsxKEYFRAME* tsxFrameGetNextFrame( tsxKEYFRAME* pKFrame );
  1919. Declare Function tsxFrameGetNextFrame Lib "tsxapi.dll" (ByVal pKFrame As Long) As Long
  1920.  
  1921. '// Get previous Keyframe.
  1922. 'TSXAPIFN tsxKEYFRAME* tsxFrameGetPrevFrame( tsxKEYFRAME* pKFrame );
  1923. Declare Function tsxFrameGetPrevFrame Lib "tsxapi.dll" (ByVal pKFrame As Long) As Long
  1924.  
  1925. '// Get frame number of Keyframe.
  1926. 'TSXAPIFN float tsxFrameGetTime( tsxKEYFRAME* pKFrame );
  1927. Declare Function tsxFrameGetTime Lib "tsxapi.dll" (ByVal pKFrame As Long) As Single
  1928.  
  1929. '// There is no symmetrical routine: tsxFrameSetTime
  1930. '// To change the time (frame number) of the keyframe use tsxSobjInsertFrame with desired time.
  1931. '// It removes the keyframe from current place and inserts it to proper place to keep
  1932. '// all keyframes sorted by time.
  1933.  
  1934. '// Get spline parameters of Keyframe.
  1935. 'TSXAPIFN tsxERR tsxFrameGetSplineParameters( tsxKEYFRAME* pKFrame, float* continuity, float* tension, float* bias );
  1936. Declare Function tsxFrameGetSplineParameters Lib "tsxapi.dll" (ByVal pKFrame As Long, ByRef continuity As Single, ByRef tension As Single, ByRef float As Single) As Long
  1937.  
  1938. '// Set spline parameters of Keyframe.
  1939. 'TSXAPIFN tsxERR tsxFrameSetSplineParameters( tsxKEYFRAME* pKFrame, float continuity, float tension, float bias );
  1940. Declare Function tsxFrameSetSplineParameters Lib "tsxapi.dll" (ByVal pKFrame As Long, ByVal continuity As Single, ByVal tension As Single, ByVal float As Single) As Long
  1941.  
  1942. '// Get length of Keyframe data.
  1943. 'TSXAPIFN long tsxFrameGetDataLength( tsxKEYFRAME* pKFrame );
  1944. Declare Function tsxFrameGetDataLength Lib "tsxapi.dll" (ByVal pKFrame As Long) As Long
  1945.  
  1946. '// Get description of Keyframe data. Returns size of description.
  1947. 'TSXAPIFN long tsxFrameGetDataDescription( tsxKEYFRAME* pKFrame, short** ppDescr );
  1948. Declare Function tsxFrameGetDataDescription Lib "tsxapi.dll" (ByVal pKFrame As Long, ByRef ppDescr As Long) As Long
  1949.  
  1950. '// Get Keyframe data.
  1951. 'TSXAPIFN long tsxFrameGetData( tsxKEYFRAME* pKFrame, void* pData, long length );
  1952. Declare Function tsxFrameGetData Lib "tsxapi.dll" (ByVal pKFrame As Long, ByVal pData As Long, ByVal length As Long) As Long
  1953.  
  1954. '// Set Keyframe data.
  1955. 'TSXAPIFN long tsxFrameSetData( tsxKEYFRAME* pKFrame, void* pData, long length );
  1956. Declare Function tsxFrameSetData Lib "tsxapi.dll" (ByVal pKFrame As Long, ByVal pData As Long, ByVal length As Long) As Long
  1957.  
  1958. '// Get interpolated data for specified attribute (and optional segment) at specified time.
  1959. 'TSXAPIFN long tsxSobjGetInterpolatedData( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment,
  1960. '                                                    float time, void* pData, long length );
  1961. Declare Function tsxSobjGetInterpolatedData Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long, _
  1962.                                                     ByVal time As Single, ByVal pData As Long, ByVal length As Long) As Long
  1963.  
  1964. '// Function for extAnimSetOriginCB and extAnimPutOriginCB.
  1965. 'typedef tsxERR (*tsxAnimOriginCallbackFP)( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType);
  1966.  
  1967. '// Function for extAnimSetFrameCB, extAnimUnSetFrameCB and extAnimPutFrameCB.
  1968. 'typedef tsxERR (*tsxAnimFrameCallbackFP)( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, float time);
  1969.  
  1970. 'typedef struct {
  1971.         '// To store original value of Attribute of Sobj (may not be specified).
  1972.         'tsxAnimOriginCallbackFP         extAnimSetOriginCB;
  1973.         '// To restore original value of Attribute of Sobj (may not be specified).
  1974.         'tsxAnimOriginCallbackFP         extAnimPutOriginCB;
  1975.         '// To create Keyframe(s) of keyfType for Sobj at specified time.
  1976.         'tsxAnimFrameCallbackFP          extAnimSetFrameCB;
  1977.         '// To delete Keyframe(s) of keyfType for Sobj at specified time (may not be specified).
  1978.         'tsxAnimFrameCallbackFP          extAnimUnSetFrameCB;
  1979.         '// To update Attribute of Sobj according Keyframes of keyfType at specified time.
  1980.         'tsxAnimFrameCallbackFP          extAnimPutFrameCB;
  1981. '} tsxAnimCallbackFP;
  1982. Type tsxAnimCallbackFP
  1983.     '// To store original value of Attribute of Sobj (may not be specified).
  1984.     extAnimSetOriginCB As Long
  1985.     '// To restore original value of Attribute of Sobj (may not be specified).
  1986.     extAnimPutOriginCB As Long
  1987.     '// To create Keyframe(s) of keyfType for Sobj at specified time.
  1988.     extAnimSetFrameCB As Long
  1989.     '// To delete Keyframe(s) of keyfType for Sobj at specified time (may not be specified).
  1990.     extAnimUnSetFrameCB As Long
  1991.     '// To update Attribute of Sobj according Keyframes of keyfType at specified time.
  1992.     extAnimPutFrameCB As Long
  1993. End Type
  1994.  
  1995.  
  1996. '// Register an attribute among attributes that may be animated.
  1997. 'TSXAPIFN tsxKFRAME_TYPE tsxAnimCreateAttribute(
  1998.         'int tsxid,                                                      // eXtension id
  1999.         'char* name,                                                     // name of the attribute (max 16 characters)
  2000.         'tsxAnimCallbackFP* attrCallback,        // callback functions for the attribute
  2001.         'long attrDataLength,                            // length of stored original data (may be 0L)
  2002.         'short* kfDataDescription,                       // description of keyframe data (see below)
  2003.         'long kfDataDescriptionSize                      // length of description array
  2004.         ');
  2005. Declare Function tsxAnimCreateAttribute Lib "tsxapi.dll" ( _
  2006.         ByVal tsxid As Long, _
  2007.         ByVal name As String, _
  2008.         ByVal attrCallback As Long, _
  2009.         ByRef kfDataDescription As Integer, _
  2010.         ByVal kfDataDescriptionSize As Long) As tsxKFRAME_TYPE
  2011.  
  2012. '// Allow an animation of specified attribute for Sobj.
  2013. 'TSXAPIFN tsxERR tsxSobjAddAttribute( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  2014. Declare Function tsxSobjAddAttribute Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  2015.  
  2016. '// Get the first attribute of Sobj.
  2017. 'TSXAPIFN tsxKFRAME_TYPE tsxSobjGetFirstAttribute( tsxSOBJ* pSobj );
  2018. Declare Function tsxSobjGetFirstAttribute Lib "tsxapi.dll" (ByVal pSobj As Long) As tsxKFRAME_TYPE
  2019.  
  2020. '// Get the next attribute of Sobj.
  2021. 'TSXAPIFN tsxKFRAME_TYPE tsxSobjGetNextAttribute( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  2022. Declare Function tsxSobjGetNextAttribute Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As tsxKFRAME_TYPE
  2023.  
  2024. '// Test for attribute of Sobj.
  2025. 'TSXAPIFN tsxBOOL tsxSobjHasAttribute( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  2026. Declare Function tsxSobjHasAttribute Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  2027.  
  2028. '// Get the first segment of attribute of Sobj.
  2029. 'TSXAPIFN long tsxSobjGetFirstSegment( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType );
  2030. Declare Function tsxSobjGetFirstSegment Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE) As Long
  2031.  
  2032. '// Get the next segment of attribute of Sobj.
  2033. 'TSXAPIFN long tsxSobjGetNextSegment( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, long segment );
  2034. Declare Function tsxSobjGetNextSegment Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long) As Long
  2035.  
  2036. '// Attribute data descriptor
  2037. '//------------------------------------------------------------------------
  2038. '// Descriptor for allowing attribute to animate over time. A structure of
  2039. '// this type is added with each attribute that the eXtension animates to
  2040. '// describe the data structure of its parameters. Specify pdOpaque for any
  2041. '// non-scalar data in the record, or data that you don't want trueSpace to
  2042. '// interpolate for you. Make the DataDescription describe all the bytes of
  2043. '// the parameter block.
  2044. '//-----------------------------------------------------------------------
  2045. '// Specifies the type of the data
  2046.  
  2047. #Const pdOpaque = 0
  2048. '// Opaque, meaning don't interpolate this. Followed by count of bytes to skip
  2049. '// with pdOpaque, eg, pdOpaque, 4
  2050. '// If it is followed by 0, it terminates the description.
  2051.  
  2052. #Const pdChar = 1
  2053. '// Interpolate as signed byte
  2054.  
  2055. #Const pdShort = 2
  2056. '// Interpolate as signed short
  2057.  
  2058. #Const pdLong = 3
  2059. '// Interpolate as signed long
  2060.  
  2061. #Const pdUnsignedChar = 4
  2062. '// Interpolate as unsigned byte
  2063.  
  2064. #Const pdUnsignedShort = 5
  2065. '// Interpolate as unsigned short
  2066.  
  2067. #Const pdUnsignedLong = 6
  2068. '// Interpolate as unsigned long
  2069.  
  2070. #Const pdDouble = 8
  2071. '// Interpolate as a double
  2072.  
  2073. #Const pdFloat = 9
  2074. '// Interpolate as a float
  2075.  
  2076. '// Get length of Attribute data.
  2077. 'TSXAPIFN long tsxSobjGetAttrDataLength( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType);
  2078. Declare Function tsxSobjGetAttrDataLength Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal segment As Long) As Long
  2079.  
  2080. '// Get Attribute data.
  2081. 'TSXAPIFN long tsxSobjGetAttrData( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, void* pData, long length);
  2082. Declare Function tsxSobjGetAttrData Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal pData As Long, ByVal length As Long) As Long
  2083.  
  2084. '// Set Attribute data.
  2085. 'TSXAPIFN long tsxSobjSetAttrData( tsxSOBJ* pSobj, tsxKFRAME_TYPE keyfType, void* pData, long length);
  2086. Declare Function tsxSobjSetAttrData Lib "tsxapi.dll" (ByVal pSobj As Long, ByVal keyfType As tsxKFRAME_TYPE, ByVal pData As Long, ByVal length As Long) As Long
  2087.  
  2088.  
  2089. '------------------------------------------------------------------------------
  2090. '//    File: tsxMisc.h
  2091. '//   Descr: Miscellaneous items
  2092.  
  2093. '//------------------------------------------------------------------------------
  2094. '//  Accessing an installed trueSpace's TSX Version Info
  2095. '//------------------------------------------------------------------------------
  2096.  
  2097. '// An eXtension may want to confirm that it is compatible with the version of
  2098. '// trueSpace it is being installed into (actually, compatible with the TSXAPI),
  2099. '// by checking the version number of tsxapi.dll .
  2100. '//
  2101. '// Note on TSX API Version numbering scheme:
  2102. '// Major is the major release version of trueSpace, in hundreds.
  2103. '// For example,
  2104. '//   for trueSpace 3, Major = 300;
  2105. '//   for trueSpace 3.5 (should there be one) Major = 350.
  2106. '// Minor is the minor release version of TSX API.
  2107. '// Negative numbers in the minor refer to pre-release (alpha, beta) versions.
  2108. '//
  2109. '// To check compatibility,
  2110. '// if a TSX requires any version on or after [baseMajor, baseMinor],
  2111. '// check for:  (Major >= baseMajor) &&
  2112. '//             (Minor >= baseMinor)
  2113.  
  2114. '// Accessing an installed trueSpace's TSX Version Info.  Values placed in
  2115. '// the arguments.
  2116. 'TSXAPIFN void tsxGetTsVersionNbrs(
  2117.     'short* pMajor,  // Major version nbr
  2118.     'short* pMinor   // Minor version nbr
  2119.     ');
  2120. Declare Sub tsxGetTsVersionNbrs Lib "tsxapi.dll" _
  2121.     (ByRef pMajor As Integer, ByRef pMinor As Integer)
  2122.     
  2123. '//------------------------------------------------------------------------------
  2124. '//  Accessing The primary view-window client area
  2125. '//------------------------------------------------------------------------------
  2126.  
  2127. '// Returns handle to the main view window.
  2128. 'TSXAPIFN HWND tsxGetMainViewHwnd(void);
  2129. Declare Function tsxGetMainViewHWND Lib "tsxapi.dll" () As Long
  2130.     
  2131.  
  2132. '//------------------------------------------------------------------------------
  2133. '//  Requesting (De)Activation
  2134. '//------------------------------------------------------------------------------
  2135.  
  2136. '// Requests a left-click action on the extension's button (see tsxOnLeftClick).
  2137. '// Useful when, e.g.,  an extension wants to leave a panel on the screen even
  2138. '// when deactivated, and then requests re-activation when a button is clicked
  2139. '// on this panel. Also useful to deactivate an active extension when user
  2140. '// exits from extensions parameter panel.
  2141. 'TSXAPIFN tsxERR tsxForceLeftClick(
  2142.     'int tsxid // extension-id (see tsxGetData)
  2143.     ');
  2144. Declare Function tsxForceLeftClick Lib "tsxapi.dll" (ByVal tsxid As Long) As Long
  2145.  
  2146.  
  2147. '//------------------------------------------------------------------------------
  2148. '//  Heap Memory
  2149. '//------------------------------------------------------------------------------
  2150.  
  2151. '// Use these memory routines when allocating memory for trueSpace,
  2152. '// e.g. vertex-array for Polyhedra (tsxPolyh.h).
  2153.  
  2154. 'TSXAPIFN void* tsxMalloc( unsigned int size );
  2155. Declare Function tsxMalloc Lib "tsxapi.dll" (ByVal size As Long) As Long
  2156. 'TSXAPIFN void* tsxCalloc( unsigned int num, unsigned int size );
  2157. Declare Function tsxCalloc Lib "tsxapi.dll" (ByVal num As Long, ByVal size As Long) As Long
  2158. '// You MUST use the following two functions to reallocate or free
  2159. '// memory blocks allocated by the above functions.
  2160. 'TSXAPIFN void* tsxRealloc( void* memblock, unsigned int size );
  2161. Declare Function tsxRealloc Lib "tsxapi.dll" (ByVal memblock As Long, ByVal size As Long) As Long
  2162. 'TSXAPIFN void tsxFree( void* memblock );
  2163. Declare Sub tsxFree Lib "tsxapi.dll" (ByVal memblock As Long)
  2164.  
  2165. '------------------------------------------------------------------------------
  2166. '//    File: tsxMouse.h
  2167. '//   Descr: Interface to the Mouse
  2168.  
  2169. '// This is the interface to the Mouse-Tool in trueSpace.
  2170. '// For an extension to receive mouse action messages, it must install
  2171. '// the mouse-tool (using tsxMtoolInstall).
  2172. '// See also picking functions in "tsxAView.h".
  2173.  
  2174. '//------------------------------------------------------------------------------
  2175. '//      Related Types and Definitions
  2176. '//------------------------------------------------------------------------------
  2177.  
  2178. '// Internal data structure for managing the mouse tool.
  2179. 'struct tsxMousetool {};
  2180.  
  2181. '// Callback type for mouse-tool message
  2182. 'typedef BOOL (*tsxMtoolMsg)(
  2183.     'tsxMousetool *mt,
  2184.     'short msg,  //see mouse-tool messages, below.
  2185.     'short x,    //mouse position on screen, viewport X coordinate.
  2186.     'short y,    //mouse position on screen, viewport Y coordinate.
  2187.     'short data  //additional data depending upon msg.
  2188.     ');
  2189. '// Callback type for mouse events
  2190. 'typedef BOOL (*tsxMtoolClick)(
  2191.     'tsxMousetool *mt,
  2192.     'short x,    //mouse position on screen, viewport X coordinate.
  2193.     'short y,    //mouse position on screen, viewport Y coordinate.
  2194.     'short flags //see mouse event flags, below.
  2195.     ');
  2196.  
  2197. '// Mouse-tool messages
  2198. #Const tsxMTM_ACTIVATE = 1  '//Mousetool is being activated.
  2199. #Const tsxMTM_DEACTIVATE = 2 '//Mousetool is being deactivated.
  2200. #Const tsxMTM_DESELECT = 3  '//Current object is being deselected.
  2201. #Const tsxMTM_SELECT = 4    '//New current object has been selected.
  2202. #Const tsxMTM_KEY = 5       '//Key has been pressed: char is in `data'.
  2203.                             '// Return FALSE if key is used.
  2204. #Const tsxMTM_CREATE = 6    '//Mousetool has been created.
  2205. #Const tsxMTM_DESTROY = 7   '//Mousetool is being destroyed.
  2206. #Const tsxMTM_ERASE = 8     '//Erase requested on currently selected object.
  2207.                             '// If TRUE is returned the current object is deleted.
  2208. #Const tsxMTM_CHECKCURSOR = 9 '//Called on WM_MOUSEMOVE, WM_KEYUP, WM_KEYDOWN.
  2209.                              '// `data' contains mouse event flags.
  2210.                              '// For Mouse-move, mouse coordinates are passed.
  2211.  
  2212. '// Mouse event flags
  2213. #Const tsxMTF_RIGHT = 1      '//Right mouse button clicked
  2214. #Const tsxMTF_LEFT = 2       '//Left mouse button clicked
  2215. #Const tsxMTF_SHIFT = 4      '//Shift key is pressed
  2216. #Const tsxMTF_CTRL = 8       '//Control key is pressed
  2217. #Const tsxMTF_OUTSIDE = 16384 '//Mouse is outside window (for drag operations)
  2218. #Const tsxMTF_DBLCLK = 32768  '//Mouse button was double-clicked
  2219.  
  2220.  
  2221. '//------------------------------------------------------------------------------
  2222. '//      Management
  2223. '//------------------------------------------------------------------------------
  2224.  
  2225. '// When a new mouse-tool is installed, `pMtoolMsgFunc' is called with the
  2226. '// message tsxMTM_CREATE, and then with tsxMTM_ACTIVATE. The eXtension
  2227. '// MUST be active at this time.
  2228. '// A mouse-tool installed by an extension is removed before the extension is
  2229. '// deactivated. It is also removed when trueSpace receives a new install request.
  2230. '// Before a mouse-tool is removed, its message function `pMtoolMsgFunc' is
  2231. '// called first with the message tsxMTM_DEACTIVATE and then with tsxMTM_DESTROY.
  2232. '//
  2233. '// Typical sequence of events:
  2234. '//    - User selects eXtn
  2235. '//    - eXtn is activated
  2236. '//    - eXtn installs mouse-tool
  2237. '//    - pMtoolMsgFunc called with message tsxMTM_CREATE
  2238. '//    - pMtoolMsgFunc called with message tsxMTM_ACTIVATE
  2239. '//    - ... handle mouse events ...
  2240. '//    - user selects another tS tool
  2241. '//    - pMtoolMsgFunc called with message tsxMTM_DEACTIVATE
  2242. '//    - pMtoolMsgFunc called with message tsxMTM_DESTROY
  2243. '//    - eXtn is deactivated (tsxDeactivate)
  2244. '//    - control switches to the new tool selected by user
  2245.  
  2246. '// Installs the mouse-tool if the eXtension is active.
  2247. '// Function pointers cannot be NULL.
  2248. 'TSXAPIFN tsxERR tsxMtoolInstall(
  2249.     'int tsxid,                     // extension-id (see tsxGetData)
  2250.     'tsxMtoolMsg pMtoolMsgFunc,     // mouse-tool-message callback
  2251.     'tsxMtoolClick pMtoolEventFunc  // mouse-event callback
  2252.     ');
  2253. Declare Function tsxMtoolInstall Lib "tsxapi.dll" ( _
  2254.     ByVal tsxid As Long, _
  2255.     ByVal tsxMtoolMsg As Long, _
  2256.     ByVal tsxMtoolClick As Long _
  2257.     ) As Long
  2258.  
  2259. '// Removes the mouse-tool installed by this extension, if any.
  2260. '// Extension must be active.
  2261. 'TSXAPIFN void tsxMtoolRemove( int tsxid );
  2262. Declare Sub tsxMtoolRemove Lib "tsxapi.dll" (ByVal tsxid As Long)
  2263.  
  2264.  
  2265. '------------------------------------------------------------------------------
  2266. '//    File: tsxAView.h
  2267. '//   Descr: Interface to the Active View
  2268.  
  2269. '// This is the interface to the active viewport and its "eye" attributes.
  2270. '// The Active Viewport is the currently active view into the scene.
  2271. '// Eye attributes:
  2272. '// - Position
  2273. '// - Bank angle w.r.t. the world X axis
  2274. '// - "Look at" direction
  2275. '// - Zoom
  2276. '// The eye's frame is similar to that of a Camera, with the Z axis pointing
  2277. '// out into the scene, and the Y axis pointing up.
  2278. '// See also "tsxCamra.h" and "tsxMouse.h".
  2279.  
  2280. '//------------------------------------------------------------------------------
  2281. '//      Related Types
  2282. '//------------------------------------------------------------------------------
  2283.  
  2284. '// Rendering modes
  2285. Enum tsxRENDERMODE
  2286.     e_tsxRM_UNDEF
  2287.     e_tsxRM_WIRE   '//Wire-frame
  2288.     e_tsxRM_3DR    '//3DR
  2289.     e_tsxRM_D3D    '//Direct3D
  2290. End Enum
  2291.  
  2292. '// Viewing modes
  2293. Enum tsxVIEWMODE
  2294.     e_tsxVM_PERSPECTIVE
  2295.     e_tsxVM_TOP
  2296.     e_tsxVM_FRONT
  2297.     e_tsxVM_LEFT
  2298.     e_tsxVM_CAMERA '//Look through an object or camera
  2299. End Enum
  2300.  
  2301. '//------------------------------------------------------------------------------
  2302. '//      Refreshing the Active View
  2303. '//------------------------------------------------------------------------------
  2304.  
  2305. '// Use this function to refresh the active view of the scene after changing
  2306. '// the view's attributes.
  2307. 'TSXAPIFN void tsxAViewRefresh();
  2308. Declare Sub tsxAViewRefresh Lib "tsxapi.dll" ()
  2309.  
  2310. '//------------------------------------------------------------------------------
  2311. '//      Refreshing All Views Simultaneously
  2312. '//------------------------------------------------------------------------------
  2313.  
  2314. '// Use this function to refresh all views of the scene simultaneously
  2315. 'TSXAPIFN void tsxAllViewsRefresh();
  2316. Declare Sub tsxAllViewsRefresh Lib "tsxapi.dll" ()
  2317.  
  2318. '//------------------------------------------------------------------------------
  2319. '//      Render and View Mode
  2320. '//------------------------------------------------------------------------------
  2321.  
  2322. '// Get the rendering mode of the active view.
  2323. 'TSXAPIFN tsxRENDERMODE tsxAViewGetRenderMode();
  2324. Declare Function tsxAViewGetRenderMode Lib "tsxapi.dll" () As tsxRENDERMODE
  2325.  
  2326. '// Get the view mode for the active view.
  2327. 'TSXAPIFN tsxVIEWMODE tsxAViewGetViewMode();
  2328. Declare Function tsxAViewGetViewMode Lib "tsxapi.dll" () As tsxVIEWMODE
  2329.  
  2330. '// Change the view mode for teh active view.
  2331. '// If newmode is e_tsxVM_CAMERA, it is set to look through the currently
  2332. '// selected object, if any. Useful with Cameras and Lights.
  2333. '// Returns: e_tsxTRUE if there is a change in mode.
  2334. 'TSXAPIFN tsxBOOL tsxAViewSetViewMode( tsxVIEWMODE newmode );
  2335. Declare Function tsxAViewSetViewMode Lib "tsxapi.dll" (ByVal newmode As tsxVIEWMODE) As Long
  2336.  
  2337. '// Make the active view look through an object (pGNode), until further notice.
  2338. '// In this mode, any changes to the eye's position, orientation and direction
  2339. '// will also be transmitted to the object.
  2340. 'TSXAPIFN tsxERR tsxAViewSetCameraMode( tsxGNODE* pGNode );
  2341. Declare Function tsxAViewSetCameraMode Lib "tsxapi.dll" (ByVal pGNode As Long) As Long
  2342.  
  2343. '// Turn off the camera mode, removing the constraint on the active view
  2344. '// to look through an object. The current view of the scene is not changed.
  2345. 'TSXAPIFN void tsxAViewUnsetCameraMode();
  2346. Declare Sub tsxAViewUnsetCameraMode Lib "tsxapi.dll" ()
  2347.  
  2348. '// Get pointer to the object that the active view is currently constrained
  2349. '// to look through, if any.
  2350. 'TSXAPIFN tsxSOBJ* tsxAViewGetCameraObj();
  2351. Declare Function tsxAViewGetCameraObj Lib "tsxapi.dll" () As Long
  2352.  
  2353. '//------------------------------------------------------------------------------
  2354. '//      Eye attributes
  2355. '//------------------------------------------------------------------------------
  2356.  
  2357. '// Get the eye position (copied into `posn') in world coordinates
  2358. 'TSXAPIFN void tsxAViewGetPosition( CtsxVector3f* posn );
  2359. Declare Sub tsxAViewGetPosition Lib "tsxapi.dll" (ByRef posn As CtsxVector3f)
  2360.  
  2361. '// Get the direction in which the view is pointed, as a normalized
  2362. '// vector relative to its position (copied into `dirn')
  2363. 'TSXAPIFN void tsxAViewGetDirection( CtsxVector3f* dirn );
  2364. Declare Sub tsxAViewGetDirection Lib "tsxapi.dll" (ByRef dirn As CtsxVector3f)
  2365.  
  2366. '// Get the Bank angle
  2367. 'TSXAPIFN float tsxAViewGetBankAngle();
  2368. Declare Function tsxAViewGetBankAngle Lib "tsxapi.dll" () As Single
  2369.  
  2370. '// Get the Zoom
  2371. 'TSXAPIFN float tsxAViewGetZoom();
  2372. Declare Function tsxAViewGetZoom Lib "tsxapi.dll" () As Single
  2373.  
  2374. '// Use this function to change the position and direction of the active
  2375. '// view's "eye".  A NULL value for `pEyePosn' or `pLookAt' indicates no
  2376. '// change in that parameter.
  2377. 'TSXAPIFN void tsxAViewSetView(
  2378.     'CtsxVector3f* pEyePosn, //New position of eye, in world coordinates
  2379.     'CtsxVector3f* pLookAt,  //New point at which eye should point, in world coord
  2380.     'tsxBOOL bLevelIt        //e_tsxTRUE if eye's horizontal axis should be made
  2381.                             '// parallel to world X, otherwise current bank angle
  2382.                             '// with world-X is maintained.
  2383.     ');
  2384. Declare Sub tsxAViewSetView Lib "tsxapi.dll" ( _
  2385.     ByRef pEyePosn As CtsxVector3f, _
  2386.     ByRef pLookAt As CtsxVector3f, _
  2387.     bLevelIt As Long)
  2388.  
  2389. '// Change the bank angle between the view's horizontal axis and the world X axis.
  2390. 'TSXAPIFN void tsxAViewSetBank( float bankAngle );
  2391. Declare Sub tsxAViewSetBank Lib "tsxapi.dll" (ByVal bankAngle As Single)
  2392.  
  2393. '// Change the active view's zoom (clamped to allowed min/max values).
  2394. '// Returns: the new zoom value.
  2395. 'TSXAPIFN float tsxAViewSetZoom( float newzoom );
  2396. Declare Function tsxAViewSetZoom Lib "tsxapi.dll" (ByVal newzoom As Single) As Single
  2397.  
  2398.  
  2399. '//------------------------------------------------------------------------------
  2400. '//      Frame relationships
  2401. '//------------------------------------------------------------------------------
  2402.  
  2403. '// Matrix for transforming world coordinates to viewport (screen) coordinates.
  2404. '// Returns: pTxmx.
  2405. 'TSXAPIFN CtsxTxmx3f* tsxAViewGetWorld2VportTxmx( CtsxTxmx3f* pTxmx );
  2406. Declare Function tsxAViewGetWorld2VportTxmx Lib "tsxapi.dll" (ByRef pTxmx As CtsxTxmx3f) As Long
  2407.  
  2408. '// Matrix for transforming world coordinates to view's Eye coordinates.
  2409. '// Returns: pTxmx.
  2410. 'TSXAPIFN CtsxTxmx3f* tsxAViewGetWorld2EyeTxmx( CtsxTxmx3f* pTxmx );
  2411. Declare Function tsxAViewGetWorld2EyeTxmx Lib "tsxapi.dll" (ByRef pTxmx As CtsxTxmx3f) As Long
  2412.  
  2413. '// Matrix for transforming view's Eye coordinates to world coordinates
  2414. '// (inverse of the World-to-Eye matrix).
  2415. '// Returns: pTxmx.
  2416. 'TSXAPIFN CtsxTxmx3f* tsxAViewGetEye2WorldTxmx( CtsxTxmx3f* pTxmx );
  2417. Declare Function tsxAViewGetEye2WorldTxmx Lib "tsxapi.dll" (ByRef pTxmx As CtsxTxmx3f) As Long
  2418.  
  2419. '// Computes a ray pointing from the eye's viewpoint through the mouse point.
  2420. '// The ray is returned in pRayOrigin and pRayDirn, the latter giving the
  2421. '// direction as a normalized vector pointing from pRayOrigin.
  2422. '// Any of the output arguments may be NULL, if that value is not desired.
  2423. 'TSXAPIFN void tsxAViewGetMouseRay(
  2424.     'short mousePtX, //IN: mouse X coordinate (in screen space)
  2425.     'short mousePtY, //IN: mouse Y coordinate
  2426.     'CtsxVector3f* pRayOrigin, //OUT: Eye location for active view
  2427.     'CtsxVector3f* pRayDirn    //OUT: Normalized direction from pRayOrigin
  2428.     ');
  2429. Declare Sub tsxAViewGetMouseRay Lib "tsxapi.dll" ( _
  2430.     ByVal mousePtX As Integer, _
  2431.     ByVal mousePtY As Integer, _
  2432.     ByRef pRayOrigin As CtsxVector3f, _
  2433.     ByRef pRayDirn As CtsxVector3f _
  2434.     )
  2435.  
  2436.  
  2437. '//------------------------------------------------------------------------------
  2438. '//      Picking
  2439. '//------------------------------------------------------------------------------
  2440.  
  2441. '// Pick the Root object in scene containing the object under the mouse.
  2442. '// A Root object has the scene as its parent.
  2443. '// Returns: e_tsxTRUE on successful pick.
  2444. 'TSXAPIFN tsxBOOL tsxAViewPickRoot(
  2445.     'short x, //Screen coordinates of mouse
  2446.     'short y,
  2447.     'tsxSOBJ** ppSobj //OUT: Ptr to root object containing picked object.
  2448.     ');
  2449. Declare Function tsxAViewPickRoot Lib "tsxapi.dll" ( _
  2450.     ByVal x As Integer, _
  2451.     ByVal y As Integer, _
  2452.     ByRef ppSobj As Long _
  2453.     ) As Long
  2454.  
  2455. '// Picking nearest one of MNode's vertices under the mouse, if any.
  2456. '// If pMNode is 0 (null) then all objects in scene are tested.
  2457. '// Returns: e_tsxTRUE on successful pick.
  2458. 'TSXAPIFN tsxBOOL tsxAViewPickVertex(
  2459.     'tsxMNODE* pMNode,   //Must be a Group or Polyhedron. 0 = all objs in scene.
  2460.     'short x,            //Screen coordinates of mouse
  2461.     'short y,
  2462.     'tsxPOLYHEDRON** ppPolyh, //OUT: Polyhderon whose vertex picked
  2463.     'int* pVxIndex            //OUT: Index of picked vertex in pPolyh
  2464.     ');
  2465. Declare Function tsxAViewPickVertex Lib "tsxapi.dll" ( _
  2466.     ByVal pMNode As Long, _
  2467.     ByVal x As Integer, _
  2468.     ByVal y As Integer, _
  2469.     ByRef ppPolyh As Long, _
  2470.     ByRef pVxIndex As Long _
  2471.     ) As Long
  2472.  
  2473. '// Picks nearest one of MNode's faces under the mouse, if any.
  2474. '// If pMNode is 0 (null) then all objects in scene are tested.
  2475. '// Returns: e_tsxTRUE on successful pick.
  2476. 'TSXAPIFN tsxBOOL tsxAViewPickFace(
  2477.     'tsxMNODE* pMNode,   //Must be a Group or Polyhedron. 0 = all objs in scene.
  2478.     'short x,            //Screen coordinates of mouse
  2479.     'short y,
  2480.     'tsxPOLYHEDRON** ppPolyh, //OUT: Polyhderon whose face picked
  2481.     'int* pFxIndex,           //OUT: Index of picked face in pPolyh
  2482.     'float* pFxDist           //OUT: Distance to picked face
  2483.     ');
  2484. Declare Function tsxAViewPickFace Lib "tsxapi.dll" ( _
  2485.     ByVal pMNode As Long, _
  2486.     ByVal x As Integer, _
  2487.     ByVal y As Integer, _
  2488.     ByRef ppPolyh As Long, _
  2489.     ByRef pFxIndex As Long, _
  2490.     ByRef pFxDist As Single _
  2491.     ) As Long
  2492.  
  2493.  
  2494. '//------------------------------------------------------------------------------
  2495. '//      Miscellaneous
  2496. '//------------------------------------------------------------------------------
  2497.  
  2498. '// Handle to the active view's window
  2499. 'TSXAPIFN HWND tsxAViewGetHwnd();
  2500. Declare Function tsxAViewGetHwnd Lib "tsxapi.dll" () As Long
  2501.  
  2502. '------------------------------------------------------------------------------
  2503.  
  2504.