home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / tema / TS3 / Caligari / pluSpack1 / primitiveitch / factory / tsxfd31.exe / TsxApi.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-22  |  97.4 KB  |  2,726 lines

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