home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / t / texturegnd / Docs / Language < prev    next >
Text File  |  1996-11-30  |  66KB  |  1,897 lines

  1.  
  2.          Texture Garden texture generation language specification
  3.          ========================================================
  4.  
  5.     This file documents version 1.00 of the texture generation language
  6.           This is distributed with Texture Garden version 1.00.
  7.  
  8. 1.00 Introduction
  9. 1.10 The format of this file
  10. 2.00 Writing textures
  11. 2.10 Syntactic considerations
  12. 3.00 Command summary (commands grouped by class)
  13. 4.00 Command details (commands grouped by class)
  14.  
  15. 1.00 Introduction
  16. ~~~~~~~~~~~~~~~~~
  17. The Language:
  18.  
  19. When editing texture generation programs, some syntactical rules need to be
  20. borne in mind.  The language is a compromise between three design criteria:
  21.  
  22. 1: That it should be readable by a human
  23. 2: That it should be editable by the computer.
  24. 3: That it should go like the clappers.
  25.  
  26. Compactness was not considered to be particularly important. 
  27. Characteristically commands are verbose.  It is recommended that typing in
  28. commands using longhand is to be avoided and that cut and paste facilities
  29. are employed wherever possible.
  30.  
  31. When loaded, commands are translated into an internal format and the original
  32. textfile is discarded.  Loaded files may contain command names in any case,
  33. truncated names, commands optionally abbreviated with the "." character,
  34. confused and confusing punctuation and mismatched brackets.  When the file is
  35. saved, it is cleaned up, reformatted and expanded into a standard format. 
  36. Unless you know what you are doing, keeping copies of the original files is
  37. recommended, as What The Computer Thinks You Are Talking About may initially
  38. differ from What You Are Trying To Say.
  39.  
  40. Error checking is currently implemented mainly at the parsing stage.  If the
  41. program you feed the computer contains errors, a message will tell you
  42. which line they are found on.  These messages should be helpful in the
  43. process of tracking down mistakes.  Runtime error messages are also possible,
  44. but should occur rarely in practise.
  45.  
  46. If your version of this program is unregistered, then you will probably
  47. experience difficulties in changing existing textures or getting your own
  48. textures to be displayed.  Please refer to the "Register" document for
  49. details of why this occurs.
  50.  
  51. Resources:
  52.  
  53. There are currently several main resources available for use in generating
  54. textures.  The texture generation program "sees" a virtual machine with a
  55. variety of storage media and one primary output channel.
  56.  
  57. There are three one dimensional buffers of &400 16-bit values which may be
  58. manipulated.   One two dimensional buffer is provided, with dimensions
  59. controlled by the size of the sprite to be generated.  A buffer for storing
  60. colourmaps exists and there is space reserved for the manipulation of &400
  61. variables.  These contain unspecified values on entry to the routine.
  62.  
  63. Texture generation programs are entered when a texture is required.  Their
  64. execution begins at their first line.
  65.  
  66. 1.10 The format of this file
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. In the command summary which follows, each command is named and then it is
  69. followed by a string in brackets indicating what kind of parameters it takes.
  70. If there are no brackets then the command takes no parameters.  In the second
  71. part of the document, descriptions of the operation of each of the commands
  72. are also given.
  73.  
  74. Comments are considered to be anything after a "|" character.  Comments in
  75. If...Then...Else lines are treated using the same conventions as in Obey
  76. files, i.e. "If 1 = 2 THEN |ECHO Equal! ELSE ECHO Not_Equal!" would print
  77. "Not_Equal!" in an Obey file, despite the earlier "|".
  78.  
  79. 2.00 Writing textures
  80. ~~~~~~~~~~~~~~~~~~~~~
  81. Conventions:
  82.  
  83. All textures should begin with a definition of their primary palette enclosed
  84. by the commands "StartColourDefinition" and "EndColourDefinition".
  85.  
  86. Textures terminate when they reach the "End" command.  It is conventional to
  87. place subroutine definitions after the "End" so they are separate from the
  88. main program.  The mutator may rely on this in the future.
  89.  
  90. 2.00 Syntactic considerations
  91. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. Essentially, the syntax of the language is simple.  
  93.  
  94. Everything falls into one of four categories.
  95.  
  96. These four categories are: Comments, Commands, Functions and Parameters.
  97.  
  98. Comments are simple: they are considered to be anything after a "|"
  99. character.
  100.  
  101. Commands come in three types: Conditional, Ordinary and Branch commands.
  102.  
  103. Conditionals have the form: "If <Condition> Then <Command> Else <Command>". 
  104. The "Until <Condition>" command also comes into this category.
  105.  
  106. Ordinary commands normally appear at the start of each line.  They may have
  107. zero or more parameters.  If they have parameters then these are enclosed in
  108. brackets.
  109.  
  110. Branch related commands come in several types.  "Define <DefinitionMarker>"
  111. sets a named mark at a point in the file, "Call <DefinitionMarker>" calls the
  112. relevant "Define" and continues until a "Return" is encountered. 
  113. "Goto <DefinitionMarker>" simply continues execution from the relevant
  114. "Define".
  115.  
  116. Functions may be given instead of parameters.  They should never appear at
  117. the start of a line.  Functions are defined over the domain (&0000-&FFFF). 
  118. They generally range over (&0000-&FFFF).  That they have the same range as
  119. their domains means that it is convenient to feed the results of functions
  120. to other functions as parameters.
  121.  
  122. Parameters may cover the range from &0000 to &FFFF.  They may be given as
  123. signed or unsigned, decimal or hexadecimal (with a preceding "&") integers. 
  124. Where a parameter is required, this may be given as a constant numerical
  125. value or as a function.  Variables may be used and are implemented as simple
  126. functions.
  127.  
  128. Textures are not especially sensitive to punctuation mistakes, spaces, or
  129. other idiosyncrasies.  If brackets are mismatched, the program guesses where
  130. they should be and inserts them.  This is useful when editing textures in a
  131. text editor.
  132.  
  133. 3.00 Command summary (commands grouped by class)
  134. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135. Index
  136. ~~~~~
  137. 01 Functions
  138. 02 Types
  139. 03 Constants
  140. 04 Variables
  141. 05 Section of Functions of X and Y
  142. 06 Miscellaneous
  143. 07 Conditional
  144. 08 Mutation
  145. 09 Animation
  146. 10 Graphical output
  147. 11 Fourier Transform related
  148. 12 Variable Setting
  149. 13 Dithering
  150. 14 Processing
  151. 15 Linear segments
  152. 16 Shifting
  153. 17 Rotation
  154. 18 Loops
  155. 19 Buffer manipulation
  156. 20 Waves and Distortions
  157. 21 Colour related
  158. 22 Mirroring, Flipping and Shearing
  159. 23 Blobbing
  160. 24 Branching
  161. 25 Light sources and bump maps
  162.  
  163. Main List
  164. ~~~~~~~~~
  165.  
  166. 01 Functions
  167. ~~~~~~~~~~~~
  168. Combine(Type,A,B)
  169. Add(A,B)
  170. Subtract(A,B)
  171. Max(A,B)
  172. Min(A,B)
  173. Multiply(A,B)
  174. ScaledMultiply(A,B)
  175. ScaledSignedMultiply(A,B)
  176. SignedMultiply(A,B)
  177. PartlyScaledSignedMultiply(A,B)
  178. PartlyScaledMultiply(A,B)
  179. Divide(Numerator,Denominator)
  180. Eor(A,B)
  181. And(A,B)
  182. Or(A,B)
  183. Absolute(A)
  184. LogicalShiftLeft(A,Exponent)
  185. LogicalShiftRight(A,Exponent)
  186. ArithmeticShiftLeft(A,Exponent)
  187. ArithmeticShiftRight(A,Exponent)
  188. Variable(Variable_Number)
  189. Random(And_value,Eor_value)
  190. Sin(Theta)
  191. Cos(Theta)
  192. SignedSin(Theta)
  193. SignedCos(Theta)
  194. SquareRoot(Value)
  195.  
  196. 02 Types
  197. ~~~~~~~~
  198. SimpleAddition
  199. UnboundedAddition
  200. CeilingAddition
  201. HalvingAddition
  202. SimpleSubtraction
  203. UnboundedSubtraction
  204. FloorSubtraction
  205. HalvingSubtraction
  206. Maximise
  207. Minimise
  208. Overwrite
  209. PositiveOverwrite
  210. Preserve
  211. Multiplication
  212. ScaledMultiplication
  213. Zeroise
  214.  
  215. 03 Constants
  216. ~~~~~~~~~~~~
  217. True
  218. False
  219. Zero
  220. Ninety
  221. OneHundredAndEighty
  222. TwoHundredandSeventy
  223. FloydSteinberg
  224. RGB
  225. HSV
  226. CIE
  227. Gourad
  228. Phong
  229. Specular
  230. SpecularPhong
  231.  
  232. 04 Variables
  233. ~~~~~~~~~~~~
  234. X
  235. Y
  236. Z
  237. Size
  238. LogSize
  239. LogBitsPerPixel
  240. AnimationFrameNumber
  241. AnimationType(Frequency)
  242. Registered
  243.  
  244. 05 Section of Functions of X and Y
  245. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246. Noise(Intensity,MaximumFrequency)
  247. PinkNoise(Intensity,MaximumFrequency)
  248. QuickNoise(Intensity,MaximumFrequency)
  249. BandpassNoise(Intensity,MinimumFrequency,MaximumFrequency)
  250. BandpassQuickNoise(Intensity,MinimumFrequency,MaximumFrequency)
  251. FractalNoise(MaximumIntensity,FractalDimension)
  252. ShiftedSymmetricNoise(Intensity,MaximumFrequency,X,Y)
  253. ShiftedSymmetricPinkNoise(Intensity,MaximumFrequency,X,Y)
  254. ShiftedNoise(Intensity,MaximumFrequency,X,Y)
  255. ShiftedPinkNoise(Intensity,MaximumFrequency,X,Y)
  256. ShiftedSymmetricQuickNoise(Intensity,MaximumFrequency,X,Y)
  257. ShiftedQuickNoise(Intensity,MaximumFrequency,X,Y)
  258. ShiftedSymmetricFractalNoise(MaximumIntensity,FractalDimension,X,Y)
  259. ShiftedFractalNoise(Intensity,MaximumFrequency,X,Y)
  260.  
  261. TwoDimensionalPoint(X,Y)
  262. OneDimensionalPoint(X)
  263. OneDimensionalPointOne(X)
  264. OneDimensionalPointTwo(X)
  265. QuickTwoDimensionalPoint(X,Y)
  266. QuickOneDimensionalPoint(X)
  267. QuickOneDimensionalPointOne(X)
  268. QuickOneDimensionalPointTwo(X)
  269.  
  270. 06 Miscellaneous
  271. ~~~~~~~~~~~~~~~~
  272. Percentage(Percentage)
  273. AddToPercentage(DeltaPercentage)
  274. Beep
  275. Bell
  276. End
  277. Checksum(Value)
  278. Error(Value)
  279. ErrorText <string>
  280. ReportText <string>
  281. UnknownCommand
  282.  
  283. 07 Conditional
  284. ~~~~~~~~~~~~~~
  285. If <Condition> Then <Command> Else <Command>...
  286.  
  287. IsLessThan(A,B)
  288. IsGreaterThan(A,B)
  289. IsLessThanOrEqualTo(A,B)
  290. IsGreaterThanOrEqualTo(A,B)
  291. SignedIsLessThan(A,B)
  292. SignedIsGreaterThan(A,B)
  293. SignedIsLessThanOrEqualTo(A,B)
  294. SignedIsGreaterThanOrEqualTo(A,B)
  295. IsEqualTo(A,B)
  296. IsNotEqualTo(A,B)
  297.  
  298. 08 Mutation
  299. ~~~~~~~~~~~
  300. StopMutating
  301. StartMutating
  302.  
  303. 09 Animation
  304. ~~~~~~~~~~~~
  305. StartAnimating
  306. StopAnimating
  307.  
  308. 10 Graphical output
  309. ~~~~~~~~~~~~~~~~~~~
  310. MakeSprite
  311. AddToSprite
  312. MakeVirtualSprite(Type_R,Type_G,Type_B)
  313. MakeSpriteFromVirtualSprite
  314. TruncateSpriteVertically(Bottom,Top)
  315. TruncateSpriteHorizontally(Left,Right)
  316. ResizeSprite(XFactor,YFactor)
  317.  
  318. 11 Fourier Transform related
  319. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  320. CreateTwoDimensionalFilter(Filter_Description)
  321. TwoDimensionalTransform
  322. SmoothTwoDimensionalTransform
  323. CreateOneDimensionalFilter(Filter_Description)
  324. OneDimensionalTransform
  325. SmoothOneDimensionalTransform
  326.  
  327. 12 Variable Setting
  328. ~~~~~~~~~~~~~~~~~~~
  329. SetVariable(Variable_Number,Value)
  330. SetAnimationFrameNumber(Value)
  331.  
  332. Seed(Value)
  333. RestoreArtefactsFlags
  334. Phase(Value)
  335. NoiseToBeFiltered(Value)
  336. CreateCosineSymmetry
  337. CreateSineSymmetry
  338. CreateCosineArtefacts(Value)
  339. CreateSineArtefacts(Value)
  340. AbandonCosinePhase
  341. AbandonSinePhase
  342.  
  343. 13 Dithering
  344. ~~~~~~~~~~~~
  345. Dithering(Value)
  346. DitheringOne(Value)
  347. DitheringTwo(Value)
  348. ScaledDithering(Value)
  349.  
  350. 14 Processing
  351. ~~~~~~~~~~~~~
  352. OneDimensionalProcess(X1,X2,Function,Type)
  353. TwoDimensionalProcess(X1,X2,Y1,Y2,Function,Type)
  354. OneDimensionalFilter(Left,Centre,Right,Type)
  355. TwoDimensionalFilter(Top_Left,Top_Centre,Top_Right,Middle_Left,Middle_Centre,
  356.   Middle_Right,Bottom_Left,Bottom_Centre,Bottom_Right,Type)
  357. TwoDimensionalContrast(Value)
  358. OneDimensionalContrast(Value)
  359. OneDimensionalFlood(Threshold,Multiplier,Value,Type)
  360. TwoDimensionalFlood(Threshold,Multiplier,Value,Type)
  361. OneDimensionalEqualization
  362. TwoDimensionalEqualization
  363. TwoDimensionalInversion
  364. OneDimensionalInversion
  365. GenerateOneDimensionalDust(Threshold,NewValue,Type)
  366. GenerateTwoDimensionalDust(Threshold,NewValue,Type)
  367. TwoDimensionalClear
  368. OneDimensionalClear
  369. DefineSolidBlock(Block_Description)
  370. Sculpture(Path_of_X,Path_of_Y,Path_of_Z)
  371. Resize(XFactor,YFactor)
  372. ResizeBumpMap(XFactor,YFactor)
  373.  
  374. 15 Linear segments
  375. ~~~~~~~~~~~~~~~~~~
  376. LinearField(Y1,Y2)
  377. LinearSegment(X1,X2,H1,H2,Type)
  378. LinearFieldSegment(H1,H2,X1,X2,Type)
  379. Rectangle(I,X1,X2,Y1,Y2,Type)
  380.  
  381. 16 Shifting
  382. ~~~~~~~~~~~
  383. OneDimensionalShift(Delta_X,Type)
  384. TwoDimensionalShift(Delta_X,Delta_Y,Type)
  385.  
  386. 17 Rotation
  387. ~~~~~~~~~~~
  388. QuickRotate(Theta,Type)
  389. Rotate(Theta,Type)
  390. SlowRotate(Theta,Type)
  391. RotateAbout(Theta,X,Y,Type)
  392. SlowRotateAbout(Theta,X,Y,Type)
  393.  
  394. 18 Loops
  395. ~~~~~~~~
  396. Repeat
  397. Until(Condition)
  398. For(Number_of_times_to_loop)
  399. Next
  400.  
  401. 19 Buffer manipulation
  402. ~~~~~~~~~~~~~~~~~~~~~~
  403. OneDimensionalStoreBufferOne
  404. OneDimensionalStoreBufferTwo
  405. OneDimensionalSwapBufferOne
  406. OneDimensionalSwapBufferTwo
  407. OneDimensionalMaskBufferOne(Type)
  408. TwoDimensionalStore
  409. TwoDimensionalSwap
  410. TwoDimensionalMask(Type)
  411.  
  412. 20 Waves and Distortions
  413. ~~~~~~~~~~~~~~~~~~~~~~~~
  414. VerticalDistortion(Type)
  415. HorizontalDistortion(Type)
  416. HorizontalWaveWarp(Type)
  417. VerticalWaveWarp(Type)
  418. HorizontalWaves(Type)
  419. VerticalWaves(Type)
  420.  
  421. 21 Colour related
  422. ~~~~~~~~~~~~~~~~~
  423. StartColourDefinition
  424. EndColourDefinition
  425. CreateColours(ColourModel)
  426. CreateColoursUsingRGBData
  427. CreateColoursUsingHSVData
  428. CreateColoursUsingCIEData
  429.  
  430. 22 Mirroring, Flipping and Shearing
  431. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  432. HorizontalMirror(Type)
  433. VerticalMirror(Type)
  434. LeadingDiagonalMirror(Type)
  435. TrailingDiagonalMirror(Type)
  436. HorizontalShear(Size,Type)
  437. VerticalShear(Size,Type)
  438.  
  439. 23 Blobbing
  440. ~~~~~~~~~~~
  441. Ripples(Intensity,Radius,X,Y,Type)
  442. Radials(Intensity,Radius,X,Y,Type,TypeTwo)
  443.  
  444. 24 Branching
  445. ~~~~~~~~~~~~
  446. Define <DefinitionMarker>
  447. Goto <DefinitionMarker>
  448. Call <DefinitionMarker>
  449. Return
  450.  
  451. 25 Light sources and bump maps
  452. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  453. DefineLightSource(LightModel,Theta,Phi)
  454. ShineLightOnVirtualSprite
  455.  
  456.  
  457. 4.00 Command details (commands grouped by class)
  458. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  459.                        01 Section of Functions
  460.                        =======================
  461.  
  462. Combine(Type,A,B)
  463. ~~~~~~~~~~~~~~~~~
  464. This function combines the values of A and B according to the rule described
  465. by the "Type" given.  This type may be expressed as one of the following:
  466.  
  467. SimpleAddition, UnboundedAddition, CeilingAddition, HalvingAddition,
  468. SimpleSubtraction, UnboundedSubtraction, FloorSubtraction,
  469. HalvingSubtraction, Maximise, Minimise, Overwrite, PositiveOverwrite,
  470. Preserve, Multiplication or ScaledMultiplication.
  471.  
  472. These are described in the section on types below.  Alternatively, A number
  473. or expression may be given.  Please refer to the types section which contains
  474. technical details on this.
  475.  
  476. Add(A,B)
  477. ~~~~~~~~
  478. Equivalent and preferred to the Combine function using combination type
  479. UnboundedAddition.
  480. Returns (A + B) And &FFFF.
  481.  
  482. Subtract(A,B)
  483. ~~~~~~~~~~~~~
  484. Equivalent and preferred to the Combine function using combination type 
  485. UnboundedSubtraction.
  486. Returns (A - B) And &FFFF.
  487.  
  488. Max(A,B)
  489. ~~~~~~~~
  490. Equivalent and preferred to the Combine function using combination type
  491. Maximise.
  492. Returns the greater of A and B (A and B are considered unsigned).
  493.  
  494. Min(A,B)
  495. ~~~~~~~~
  496. Equivalent and preferred to the Combine function using combination type
  497. Minimise.
  498. Returns the greater of A and B (A and B are considered unsigned).
  499.  
  500. Multiply(A,B)
  501. ~~~~~~~~~~~~~
  502. Equivalent and preferred to the Combine function using combination type
  503. Multiplication.
  504. Returns A * B And &FFFF.
  505.  
  506. ScaledMultiply(A,B)
  507. ~~~~~~~~~~~~~~~~~~~
  508. Equivalent and preferred to the Combine function using combination type
  509. ScaledMultiplication.
  510. Returns ((A * B) DIV &10000) And &FFFF.
  511.  
  512. ScaledSignedMultiply(A,B)
  513. ~~~~~~~~~~~~~~~~~~~~~~~~~
  514. Function returning the value of (A * B) << 16, treating A and B as signed
  515. integers.
  516.  
  517. SignedMultiply(A,B)
  518. ~~~~~~~~~~~~~~~~~~~
  519. Function returning the value of A * B, treating A and B as signed integers.
  520.  
  521. PartlyScaledSignedMultiply(A,B)
  522. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  523. Function returning the value of (A * B) << 8, treating A and B as signed
  524. integers.
  525.  
  526. PartlyScaledMultiply(A,B)
  527. ~~~~~~~~~~~~~~~~~~~~~~~~~
  528. Function returning the value of (A * B) << 8.
  529.  
  530. Divide(Numerator,Denominator)
  531. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  532. Function returning the value of Integer(Numerator / Denominator)
  533.  
  534. Eor(A,B)
  535. ~~~~~~~~
  536. Function returning the value of A Exclusive_Or B.
  537.  
  538. And(A,B)
  539. ~~~~~~~~
  540. Function returning the value of A And B (bitwise AND).
  541.  
  542. Or(A,B)
  543. ~~~~~~~
  544. Function returning the value of A Or B (bitwise OR).
  545.  
  546. Absolute(A)
  547. ~~~~~~~~~~~
  548. IF A < &8000 THEN returns A ELSE returns A Exclusive_Or &FFFF.
  549.  
  550. LogicalShiftLeft(A,Exponent)
  551. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  552. Function returning the value of A * 2^Exponent (A << Exponent).
  553.  
  554. LogicalShiftRight(A,Exponent)
  555. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  556. Function returning the value of Integer(A / 2^Exponent) (A >> Exponent).
  557.  
  558. ArithmeticShiftLeft(A,Exponent)
  559. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  560. Function returning the value of A * 2^Exponent (A << Exponent).
  561.  
  562. ArithmeticShiftRight(A,Exponent)
  563. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  564. Function returning the value of A / 2^Exponent treating A as a signed
  565. integer.
  566.  
  567. Variable(Variable_Number)
  568. ~~~~~~~~~~~~~~~~~~~~~~~~~
  569. Returns the value of the <Variable_Number>th system variable.
  570.  
  571. Random(And_value,Eor_value)
  572. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  573. Function returning the value of a 16-bit system random number generator ANDed
  574. with <And_value> and then EORed with <Eor_value>.
  575.  
  576. Sin(Theta)
  577. ~~~~~~~~~~
  578. Returns ((Sin of <Theta>) + 0.5) * &8000.
  579.  
  580. Cos(Theta)
  581. ~~~~~~~~~~
  582. Returns ((Sin of <Theta>) + 0.5) * &8000.
  583.  
  584. SignedSin(Theta)
  585. ~~~~~~~~~~~~~~~~
  586. Returns (Sin of <Theta>) * &8000.
  587.  
  588. SignedCos(Theta)
  589. ~~~~~~~~~~~~~~~~
  590. Returns (Sin of <Theta>) * &8000.
  591.  
  592. SquareRoot(Value)
  593. ~~~~~~~~~~~~~
  594. Returns the square root of Value.
  595.  
  596.                       02 Section of Types
  597.                       ===================
  598.  
  599. Types govern how two parameters are combined with one another.  Precicely
  600. which two parameters it refers to depends on the function using it.  Often, a
  601. process will perform some calculation on the value of a function at a point
  602. and then recombine this with the original value at that point before using
  603. its result.
  604.  
  605. In the following description of the common Types, A and B are used to
  606. describe the two values to be combined.
  607.  
  608. SimpleAddition
  609. ~~~~~~~~~~~~~~
  610. IF A + B < &10000 THEN returns (A + B) ELSE returns &20000 - (A + B).
  611.  
  612. This produces an effect like a ball bouncing off a ceiling (ahem).
  613.  
  614. UnboundedAddition
  615. ~~~~~~~~~~~~~~~~~
  616. Returns (A + B) And &FFFF.
  617.  
  618. CeilingAddition
  619. ~~~~~~~~~~~~~~~
  620. IF A + B < &10000 THEN returns (A + B) ELSE returns &FFFF.
  621.  
  622. HalvingAddition
  623. ~~~~~~~~~~~~~~~
  624. Returns (A + B) DIV 2 (A and B are considered unsigned).
  625.  
  626. SimpleSubtraction
  627. ~~~~~~~~~~~~~~~~~
  628. IF A - B > 0 THEN returns (A - B) ELSE returns (B - A).
  629.  
  630. This produces an effect like a ball bouncing off a floor.
  631.  
  632. UnboundedSubtraction
  633. ~~~~~~~~~~~~~~~~~~~~
  634. Returns (A - B) And &FFFF.
  635.  
  636. FloorSubtraction
  637. ~~~~~~~~~~~~~~~~
  638. IF A - B > 0 THEN returns (A - B) ELSE returns 0.
  639.  
  640. HalvingSubtraction
  641. ~~~~~~~~~~~~~~~~~~
  642. Returns (A - B) DIV 2 (A and B are considered unsigned).
  643.  
  644. Maximise
  645. ~~~~~~~~
  646. Returns the greater of A and B (A and B are considered unsigned).
  647.  
  648. Minimise
  649. ~~~~~~~~
  650. Returns the lesser of A and B (A and B are considered unsigned).
  651.  
  652. Overwrite
  653. ~~~~~~~~~
  654. Returns B.
  655.  
  656. PositiveOverwrite
  657. ~~~~~~~~~~~~~~~~~
  658. Returns (B EOR &8000).
  659.  
  660. Preserve
  661. ~~~~~~~~
  662. Returns A.
  663.  
  664. Multiplication
  665. ~~~~~~~~~~~~~~
  666. Returns A * B And &FFFF.
  667.  
  668. ScaledMultiplication
  669. ~~~~~~~~~~~~~~~~~~~~
  670. Returns ((A * B) DIV &10000) And &FFFF.
  671.  
  672. Zeroise
  673. ~~~~~~~
  674. Returns 0.
  675.                          03 Section of Constants
  676.                          =======================
  677.  
  678. True
  679. ~~~~
  680. Returns &FFFF.
  681.  
  682. False
  683. ~~~~~
  684. Returns 0.
  685.  
  686. Zero
  687. ~~~~
  688. Returns 0.
  689.  
  690. Ninety
  691. ~~~~~~
  692. Returns &4000.
  693.  
  694. OneHundredAndEighty
  695. ~~~~~~~~~~~~~~~~~~~
  696. Returns &8000.
  697.  
  698. TwoHundredandSeventy
  699. ~~~~~~~~~~~~~~~~~~~~
  700. Returns &C000.  These commands are useful in connection with "Rotate".  They
  701. are not affected by the mutation engine.
  702.  
  703. FloydSteinberg
  704. ~~~~~~~~~~~~~~
  705. Returns &FEBE (from "FloydstEinBErg"). Used with the "Dithering" command.
  706.  
  707. RGB
  708. ~~~
  709. Returns 0.  Usually used as a description of a colour model.
  710.  
  711. HSV
  712. ~~~
  713. Returns 1.  Usually used as a description of a colour model.
  714.  
  715. CIE
  716. ~~~
  717. Returns 2.  Usually used as a description of a colour model.
  718.  
  719. Gourad
  720. ~~~~~~
  721. Returns 0.  Usually used as a lightsource type.
  722.  
  723. Phong
  724. ~~~~~
  725. Returns 1.  Usually used as a lightsource type.
  726.  
  727. Specular
  728. ~~~~~~~~
  729. Returns 2.  Usually used as a lightsource type.
  730.  
  731. SpecularPhong
  732. ~~~~~~~~~~~~~
  733. Returns 3.  Usually used as a lightsource type.
  734.  
  735.                           04 Section of Variables
  736.                           =======================
  737.  
  738. X
  739. ~
  740. Y
  741. ~
  742. Z
  743. ~
  744. Return X, Y, and Z in appropriate situations.  In OneDimensional commands, Y
  745. is always 0.  Z should not be used, except in "DefineSolidBlock" commands.
  746.  
  747. Size
  748. ~~~~
  749. Returns the size at which the texture is being generated.  This should not
  750. normally be referred to.
  751.  
  752. LogSize
  753. ~~~~~~~
  754. Returns the size at which the texture is being generated.  This should not
  755. normally be referred to.
  756.  
  757. LogBitsPerPixel
  758. ~~~~~~~~~~~~~~~
  759. Returns the log in base 2 of the number of bits-per-pixel in the screen mode
  760. in which the texture is being generated.  This may be usefully referred to
  761. when choosing dithering patterns for the texture: e.g.
  762.  
  763. AnimationFrameNumber
  764. ~~~~~~~~~~~~~~~~~~~~
  765. Returns the number of the animation frame currently being generated.
  766. This is only of interest if the texture is to be animated.
  767.  
  768. AnimationType(Frequency)
  769. ~~~~~~~~~~~~~~~~~~~~~~~~
  770. Returns the value of the corresponding value to Frequency in the buffer
  771. controlling the type of animation to be used.  This buffer can be thought of
  772. as containing 1024 signed 4-bit values, controlling the way in which various
  773. frequencires in the texture are animated.  This should only normally be
  774. referred to if the texture is to be animated.  If the texture is not being
  775. animated and the "Use animation type" option is not on then it returns 0.
  776.  
  777. Registered
  778. ~~~~~~~~~~
  779. Returns 0 if the user has the Freeware demonstration version of
  780. Texture Garden: some non-zero value otherwise.
  781.  
  782.                   05 Section of Functions of X and Y
  783.                   ==================================
  784.  
  785. These functions are functions of X and Y as well as of their parameters.
  786. They are mainly used for describing filters by using a command like
  787. "CreateTwoDimensionalFilter".  Filters are usually used to filter random
  788. noise prior to this result then being inverse-fourier-transform'd.  The
  789. descriptions of the functions describe what they look like when viewed in the
  790. frequency domain.  Descriptions in three dimensions use the convention of
  791. describing the value of the function at a position (X,Y) as its "height" at
  792. that point.
  793.  
  794. Noise(Intensity,MaximumFrequency)
  795. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  796. The plan view of this function looks like a circle about the origin.  In
  797. three dimensions it looks like a cylindrical tin can of height H = Intensity.
  798.  
  799. PinkNoise(Intensity,MaximumFrequency)
  800. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  801. The plan view of this function looks like a circle about the origin.  It
  802. fades towards the edges and may be visualised in three dimensions as a cone
  803. or "witches hat" of height H = Intensity.
  804.  
  805. QuickNoise(Intensity,MaximumFrequency)
  806. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  807. The plan view of this function looks like a square about the origin.  In
  808. three dimensions it looks like  a square office block of height
  809. H = Intensity.
  810.  
  811. BandpassNoise(Intensity,MinimumFrequency,MaximumFrequency)
  812. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  813. The plan view of this function looks like a circle about the origin with its
  814. centre hollowed out.  In three dimensions it looks like a doughnut of height
  815. H = Intensity with sharp corners.
  816.  
  817. BandpassQuickNoise(Intensity,MinimumFrequency,MaximumFrequency)
  818. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  819. The plan view of this function looks like a square about the origin with its
  820. centre hollowed out.  In three dimensions it looks like a square office block
  821. with a square central courtyard.
  822.  
  823. FractalNoise(MaximumIntensity,FractalDimension)
  824. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  825. This function looks like a mountain whose sides follow the function
  826. H = FractalDimension/(RxR) where R is the distance from the origin.  The
  827. mountain is truncated at H = MaximumIntensity.
  828.  
  829. ShiftedNoise(Intensity,MaximumFrequency,X,Y)
  830. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831. The plan view of this function looks like a circle centred at (X,Y).  In
  832. three dimensions it looks like a cylindrical tin can of height H = Intensity.
  833.  
  834. ShiftedPinkNoise(Intensity,MaximumFrequency,X,Y)
  835. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  836. The plan view of this function looks like a circle centred at (X,Y).  It
  837. fades towards the edges and may be visualised in three dimensions as a cone
  838. or "witches hat" of height H = Intensity.
  839.  
  840. ShiftedQuickNoise(Intensity,MaximumFrequency,X,Y)
  841. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  842. The plan view of this function looks like a square centred at (X,Y).  In
  843. three dimensions it looks like  a square office block of height
  844. H = Intensity.
  845.  
  846. ShiftedFractalNoise(Intensity,MaximumFrequency,X,Y)
  847. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  848. This function looks like a mountain whose sides follow the function
  849. H = FractalDimension/(RxR) where R is the distance from the point (X,Y).  The
  850. mountain is truncated at H = MaximumIntensity.
  851.  
  852. ShiftedSymmetricNoise(Intensity,MaximumFrequency,X,Y)
  853. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  854. The plan view of this function looks like four circles centred at (X,Y),
  855. (-X,Y), (X,-Y) and (-X,-Y).  In three dimensions it looks like four
  856. cylindrical tin cans of height H = Intensity.
  857.  
  858. ShiftedSymmetricPinkNoise(Intensity,MaximumFrequency,X,Y)
  859. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  860. The plan view of this function looks like four circles centred at (X,Y),
  861. (-X,Y), (X,-Y) and (-X,-Y).  They fade towards their edges and may be
  862. visualised in three dimensions as four cones or "witches hats" of height
  863. H = Intensity.
  864.  
  865. ShiftedSymmetricQuickNoise(Intensity,MaximumFrequency,X,Y)
  866. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  867. The plan view of this function looks like four squares centred at (X,Y),
  868. (-X,Y), (X,-Y) and (-X,-Y).  In three dimensions they look like four square
  869. office blocks of height H = Intensity.
  870.  
  871. ShiftedSymmetricFractalNoise(MaximumIntensity,FractalDimension,X,Y)
  872. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  873. This function looks like four mountains whose sides follow the function
  874. H = FractalDimension/(RxR) where R is the distance from the point (X,Y).  The
  875. mountains are symmetrical about the lines X = 0 and Y = 0.  The mountains are
  876. truncated at H = MaximumIntensity.
  877.  
  878. TwoDimensionalPoint(X,Y)
  879. ~~~~~~~~~~~~~~~~~~~~~~~~
  880. Returns the value or "height" at the point (X,Y).  This command and the three
  881. that follow it employ an anti-aliising technique to smooth sharp edges.
  882.  
  883. OneDimensionalPoint(X)
  884. ~~~~~~~~~~~~~~~~~~~~~~ Returns the value or "height" at the point (X) in the
  885. main one-dimensional buffer.
  886.  
  887. OneDimensionalPointOne(X)
  888. ~~~~~~~~~~~~~~~~~~~~~~~~~
  889. Returns the value or "height" at the point (X) in the first one-dimensional
  890. buffer.
  891.  
  892. OneDimensionalPointTwo(X)
  893. ~~~~~~~~~~~~~~~~~~~~~~~~~
  894. Returns the value or "height" at the point (X) in the second one-dimensional
  895. buffer.
  896.  
  897. QuickTwoDimensionalPoint(X,Y)
  898. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  899. QuickOneDimensionalPoint(X)
  900. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  901. QuickOneDimensionalPointOne(X)
  902. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  903. QuickOneDimensionalPointTwo(X)
  904. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  905. These four commands are identical to the four above them, except for the fact
  906. that they do not employ any anti-aliasing techniques.
  907.  
  908.                           06 Miscellaneous commands
  909.                           =========================
  910.  
  911. Percentage(Percentage)
  912. ~~~~~~~~~~~~~~~~~~~~~~
  913. Displays the percentage of the texture completed using the hourglass.
  914. The "Percentage" parameter's domain may be considered as being either from
  915. &0 to &63 (99) or from &80 to &63FF (100 * 256 - 1).  Using Percentage(&FFFF)
  916. turns off the percentage display.
  917.  
  918. AddToPercentage(DeltaPercentage)
  919. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  920. Adds the value of DeltaPercentage to the current hourglass percentage.
  921.  
  922. Beep
  923. ~~~~
  924. Bell
  925. ~~~~
  926. These produce a short beep using an equivalent to VDU 7.
  927.  
  928. UnknownCommand
  929. ~~~~~~~~~~~~~~
  930. This is not a command that should ever appear in a file, bit is inserted
  931. whenever a command is not recognised.  If a texture does not form, and saving
  932. the texture as a textfile contains this command, then probably some mistake
  933. has been make in the typing of new commands.
  934.  
  935. End
  936. ~~~
  937. This command should always be included at the end of the texture file and
  938. before any subroutines are declared.  It should always be present, by
  939. convention.
  940.  
  941. Checksum(Value)
  942. ~~~~~~~~~~~~~~~
  943. This command is included as a marketing device for the program.  It enables
  944. distribution of a version of the program that can read and display textures,
  945. and allow their saving as bitmaps, while not allowing unregistered users to
  946. edit the programs that generate these textures.
  947.  
  948. In unregistered versions of the program, textures which do not contain the
  949. correct value in their checksum or contain no checksum at all are rejected by
  950. the program and not displayed.  This limits the extent to which unregistered
  951. users may manipulate their textures.
  952.  
  953. In registered versions, an additional module is supplied which will enable
  954. the program (and all future upgrades of it) to read textures independently of
  955. the checksum.
  956.  
  957. A site license or Super-user version will also display whether the checksum
  958. is correct, and will write texture files with correct checksums, enabling
  959. people other than the author to distribute textures readable by the freeware
  960. distributed version of the program.
  961.  
  962. Error(Value)
  963. ~~~~~~~~~~~~
  964. This is provided for debugging purposes.  When it is executed, texture
  965. generation is terminated and control is returned to the user.  The "Value"
  966. is reported to the user.
  967.  
  968. Report(Value)
  969. ~~~~~~~~~~~~
  970. This is provided for debugging purposes.  When it is executed, the value of 
  971. "Value" is sent via WIMP messages to a program such as my own !Zephyr, which
  972. keeps a scrolling window of text for the purposes of debugging WIMP
  973. applications.  Message number &804C0 is used.
  974.  
  975. ErrorText <string>
  976. ~~~~~~~~~~~~~~~~~~
  977. When executed, texture generation is terminated and control is returned to
  978. the user with the <string> reported as an error message.
  979.  
  980. ReportText <string>
  981. ~~~~~~~~~~~~~~~~~~~
  982. When executed, <string> is sent via WIMP message to a WIMP debugging program
  983. such as my own !Zephyr.  Message number &804C0 is used with a block
  984. containing the raw text to be sent.
  985.  
  986. UnknownCommand
  987. ~~~~~~~~~~~~~~
  988. This is for internal use only and should not be used.
  989.  
  990.                        07 Conditional commands
  991.                        =======================
  992.  
  993. If <Condition> Then <Command> Else <Command>...
  994. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  995. This command is unusual in that it does not require brackets for its
  996. parameters.  The syntax is identical to the way if statements are used in
  997. Obey files. The commands may optionally contain further If statements. 
  998. Comments are treated as they would be in Obey files, i.e. "If 1 = 2 THEN
  999. |ECHO Equal! ELSE ECHO Not_Equal!" would print "Not_Equal!" in an Obey file,
  1000. despite the earlier "|".
  1001.  
  1002. Digression beginning...
  1003.  
  1004. "If ... Then ... If ... Then ... Else" constructs currently treat the Else as
  1005. belonging to BOTH "If"s.  One can't help thinking that "If ... Then ... If
  1006. ... Then ... Else ... Else" should make sense - i.e. the "Else" should belong
  1007. to the nearest "If".  Unless the "Ifs" are nested in this manner one of them
  1008. cannot have an "Else" without the other one getting it too.  However, BASIC
  1009. does not agree (and that's BBC BASIC, the official Englishman's dialect).  No
  1010. doubt the Germans would have implemented it as they are used to recursively
  1011. peeling verbs from their sentences and correlating them with earlier nouns. 
  1012. Still, the sentence "The boy, the girl, the man, kissed, hit, ran" is reputed
  1013. to be good English, though no-one seems quite to be able to get their head
  1014. 'round it.  I suppose it is possible to invert the first condition so that
  1015. the "If" comes after the "Else" instead of after the Then (unless the command
  1016. required there is another "If" statement).
  1017.  
  1018. Obey files don't seem to like their "If"s nested either (programmers must
  1019. find it easier to just look for the next "Else" than to count the
  1020. intermediate "If"s), and so neither does Texture Garden (which tries to
  1021. follow the Obey file syntax, so its files can be displayed in Obey file
  1022. syntax-colouring modes in text editors).
  1023.  
  1024. ...digression end.
  1025.  
  1026. As <Condition>s you cannot use "<", "=", ">=" "!=" etc.  A list of conditions
  1027. that are acceptable follows:
  1028.  
  1029. IsLessThan(A,B)
  1030. ~~~~~~~~~~~~~~~
  1031. IsGreaterThan(A,B)
  1032. ~~~~~~~~~~~~~~~~~~
  1033. IsLessThanOrEqualTo(A,B)
  1034. ~~~~~~~~~~~~~~~~~~~~~~~~
  1035. IsGreaterThanOrEqualTo(A,B)
  1036. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1037. SignedIsLessThan(A,B)
  1038. ~~~~~~~~~~~~~~~~~~~~~
  1039. SignedIsGreaterThan(A,B)
  1040. ~~~~~~~~~~~~~~~~~~~~~~~~
  1041. SignedIsLessThanOrEqualTo(A,B)
  1042. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1043. SignedIsGreaterThanOrEqualTo(A,B)
  1044. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1045. IsEqualTo(A,B)
  1046. ~~~~~~~~~~~~~~
  1047. IsNotEqualTo(A,B)
  1048. ~~~~~~~~~~~~~~~~~
  1049. These functions are fairly self explanatory, and I hope a single example will
  1050. suffice:
  1051.  
  1052. IsLessThan(A,B) returns TRUE (&FFFF or -1) if A is less than B, otherwise it
  1053. returns FALSE (0).
  1054.  
  1055.                         08 Mutation Commands
  1056.                         ====================
  1057.  
  1058. StopMutating
  1059. ~~~~~~~~~~~~
  1060. This command effectively stops the system from mutating until the next
  1061. StartMutating command.  This has the effect of stopping any intervening
  1062. commands from being affected by any mutations or sexual recombination that
  1063. may occur.  This may be of use when stopping mutations affecting parts of the
  1064. texture whose structural integrity is important.
  1065.  
  1066. StartMutating
  1067. ~~~~~~~~~~~~~
  1068. Reverses the effect of the last "StopMutating" command.
  1069.  
  1070.                       09 Animation Commands
  1071.                       =====================
  1072.  
  1073. StopAnimating
  1074. ~~~~~~~~~~~~~
  1075. This command effectively stops the system variable "AnimationFrameNumber"
  1076. from affecting the texture until the next StartAnimating command.  This has
  1077. the effect of stopping any intervening commands from being affected by any
  1078. animation that is occuring.  This may be of use when stopping palettes which
  1079. are declared using Fourier transforms from being "animated" causing the
  1080. palette to change then this is considered undesirable.
  1081.  
  1082. StartAnimating
  1083. ~~~~~~~~~~~~~~
  1084. Reverses the effect of the last "StopAnimating" command.
  1085.  
  1086. See also:
  1087. SetAnimationFrameNumber, AnimationFrameNumber and AnimationType(Frequency).
  1088.  
  1089.                    10 Graphical output commands
  1090.                    ============================
  1091.  
  1092. MakeSprite
  1093. ~~~~~~~~~~
  1094. Creates a sprite in the current mode using the current colourmap.
  1095.  
  1096. AddToSprite
  1097. ~~~~~~~~~~~
  1098. Adds to an existing sprite using the current colourmap.  The existing sprite
  1099. is written to only at the points where the value at (X,Y) is non-zero.
  1100.  
  1101. MakeVirtualSprite(Type_R,Type_G,Type_B)
  1102. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1103. This makes a 24-bit colour virtual sprite.
  1104.  
  1105. This is useful when creating images by using multiple layers of texture.
  1106.  
  1107. "Type_R", "Type_G" and "Type_B" are the combination-types to be used when
  1108. adding to an existing sprite for red, green and blue components respectively.
  1109.  
  1110. The virtual sprite should not be assumed to be blank when it is created
  1111. and so the first occurrence of this command should normally use
  1112. "Overwrite,Overwrite,Overwrite" as its parameters.
  1113.  
  1114. MakeSpriteFromVirtualSprite
  1115. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1116. This command makes a RISC OS sprite from the 24-bit virtual sprite created
  1117. by a previous "MakeVirtualSprite" command.
  1118.  
  1119. FloydSteinberg dithering may be applied, but will only produce noticable
  1120. effects if the texture is rendered in 16, 256 or 32K modes.  In 16M modes,
  1121. FloydSteinberg dithering is not required.
  1122.  
  1123. The "MakeSpriteFromVirtualSprite" command usually leaves the virtual sprite
  1124. unaffected, but if FloydSteinberg dithering is being used, it is altered to
  1125. the dithered version of the sprite in the selected mode.
  1126.  
  1127. One point to note is that dithering should always be set either to "Zero"
  1128. or to "FloydSteinberg" before this command is executed.  As the dithering
  1129. command is affected by the mutator this should not be as a raw number, but as
  1130. one of the strings mentioned above.
  1131.  
  1132. This is for compatibility with other possible future dithering routines.
  1133.  
  1134. TruncateSpriteVertically(Bottom,Top)
  1135. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1136. Truncates the top and bottom edges from the sprite. * #
  1137.  
  1138. TruncateSpriteHorizontally(Left,Right)
  1139. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1140. Truncates the left- and right-hand edges from the sprite. * #
  1141.  
  1142. ResizeSprite(XFactor,YFactor)
  1143. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1144. Performs "TruncateSpriteHorizontally(0,XFactor)" and
  1145. "TruncateSpriteVertically(0,YFactor)".  This is the method used by
  1146. Texture Garden's front-end to resize textures.
  1147.  
  1148. * Note that with these commands, the sprite may not subsequently be added
  1149.   to.  These operations may stop the resulting sprite from tessellating.
  1150.  
  1151. # These commands should only be used when resizing the texture using the
  1152.   front-end is not necessary, as they will stop textures from being resized.
  1153.  
  1154.                     11 Fourier Transform related commands
  1155.                     =====================================
  1156.  
  1157. CreateTwoDimensionalFilter(Filter_Description)
  1158. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1159. This function is a function of X and Y as well as of its parameter
  1160. "Filter_Description".  It generates a field of values in the main two
  1161. dimensional working buffer.  These form a "Filter" which is usually used to
  1162. filter random noise with the result then being inverse-fourier-transform'd. 
  1163. The functions commonly used are described in a different section.  Filters
  1164. may be defined in other ways, if so desired, but this is the main recommended
  1165. method.
  1166.  
  1167. TwoDimensionalTransform
  1168. ~~~~~~~~~~~~~~~~~~~~~~~
  1169. This and the command that follow it perform a series of operations on the
  1170. main two dimensional working buffer.  First, the contents of the buffer are
  1171. used as a filter to filter a spectrum of random white noise.
  1172.  
  1173. What noise is used and how the filtering is performed is affected by the
  1174. following commands: Seed(Value), Phase(Value), NoiseToBeFiltered(Value),
  1175. CreateCosineSymmetry, CreateSineSymmetry, CreateCosineArtefacts(Value),
  1176. CreateSineArtefacts(Value), AbandonCosinePhase, and AbandonSinePhase.
  1177.  
  1178. Exactly how these commands affect the filtering of the noise is partially
  1179. described elsewhere.
  1180.  
  1181. Next the resulting spectrum is exposed to an two-dimensional inverse fast
  1182. fourier transform.  This is an elaborate function that is capable of
  1183. converting a signal from the frequency domain into the space/time domain.  I
  1184. refer you to signal processing textbooks for further details.  Finally the
  1185. resultant vectors are converted to a series of amplitudes by squaring, adding
  1186. and then square-rooting their components.
  1187.  
  1188. SmoothTwoDimensionalTransform
  1189. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1190. This is identical to the above command, except the resulting values are
  1191. centred about &8000, eliminating the "spiky artefacts" that occur near H = 0
  1192. when the plain "TwoDimensionalTransform" is used.
  1193.  
  1194. CreateOneDimensionalFilter(Filter_Description)
  1195. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1196. See above description of this function in two dimensions.  The main one
  1197. dimensional buffer is used.  The filter is calculated only over the range
  1198. where Y = 0.
  1199.  
  1200. OneDimensionalTransform
  1201. ~~~~~~~~~~~~~~~~~~~~~~~
  1202. See above description of this function in two dimensions.The main one
  1203. dimensional buffer is used.
  1204.  
  1205. SmoothOneDimensionalTransform
  1206. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1207. See above description of this function in two dimensions.
  1208. The main one dimensional buffer is used.
  1209.  
  1210.                        12 Variable Setting commands
  1211.                        ============================
  1212.  
  1213. SetVariable(Variable_Number,Value)
  1214. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1215. This sets variable number (Variable_Number MOD &400) to be equal to <Value>.
  1216.  
  1217. SetAnimationFrameNumber(Value)
  1218. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1219. This sets the system variable "AnimationFrameNumber" to be equal to <Value>.
  1220. This not normally be referred to.  If the texture is to be animated manually
  1221. using batch files, then it may be used in conjunction with the "Use Animation
  1222. type" option.
  1223.  
  1224. Seed(Value)
  1225. ~~~~~~~~~~~
  1226. Sets the seed to be used in the random number generators.
  1227.  
  1228. RestoreArtefactsFlags
  1229. ~~~~~~~~~~~~~~~~~~~~~
  1230. Resets the "AbandonCosinePhase", "AbandonSinePhase", "CreateCosineSymmetry"
  1231. and "CreateSineSymmetry" flags to off.
  1232.  
  1233. Sets the values of "AbandonCosinePhase", "AbandonSinePhase",
  1234. "CreateCosineArtefacts" and "CreateSineArtefacts" to zero.
  1235.  
  1236. Phase(Value)
  1237. ~~~~~~~~~~~~
  1238. Sets the phase to be used in the filtering of the random white noise to
  1239. <Value>.  This phase affects all frequencys equally.  Changing it smoothly
  1240. produces similar effects to animating the texture using the "Positive.Boring"
  1241. animation pattern.
  1242.  
  1243. NoiseToBeFiltered(Value)
  1244. ~~~~~~~~~~~~~~~~~~~~~~~~
  1245. Sets the amplitude of the random white noise used in the filtering to
  1246. <Value>.
  1247.  
  1248. CreateCosineSymmetry
  1249. ~~~~~~~~~~~~~~~~~~~~
  1250. When filtering white noise, eliminate all sin components.  This produces a
  1251. pattern guaranteed to at its maximum at its centre, with a rotational
  1252. symmetry of two.
  1253.  
  1254. CreateSineSymmetry
  1255. ~~~~~~~~~~~~~~~~~~
  1256. When filtering white noise, eliminate all cosine components.  This produces a
  1257. pattern guaranteed to be zero at its centre, with a rotational symmetry of
  1258. two.
  1259.  
  1260. CreateCosineArtefacts(Value)
  1261. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1262. When filtering white noise, this eliminates all cosine components with an
  1263. amplitude less than a certain value.  Its effect is like "CreateSineSymmetry"
  1264. but not as extreme.
  1265.  
  1266. CreateSineArtefacts(Value)
  1267. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1268. When filtering white noise, this eliminates all sine components with an
  1269. amplitude less than a certain value.  Its effect is like
  1270. "CreateCosineSymmetry" but not as extreme.
  1271.  
  1272. AbandonCosinePhase
  1273. ~~~~~~~~~~~~~~~~~~
  1274. When filtering white noise, this eliminates the effect of the noise on the
  1275. cosine components of the result.  Instead of white noise, "bright white
  1276. light" may be thought of as being used.
  1277.  
  1278. AbandonSinePhase
  1279. ~~~~~~~~~~~~~~~~
  1280. See "AbandonCosinePhase" substituting "Sine" for "Cosine".
  1281.  
  1282.                       13 Dithering commands
  1283.                       =====================
  1284.  
  1285. The next three commands affect the way dithering is used in the generation of
  1286. palettes and sprites.
  1287.  
  1288. Dithering0 affects the red component of palettes defined using RGB data, the
  1289. "hue" component of palettes defined using HSV data and general
  1290. (within-palette) dithering when making Sprites.
  1291.  
  1292. Dithering1  affects the green component of palettes defined using RGB data
  1293. and the "saturation" component of palettes defined using HSV data.
  1294.  
  1295. Dithering2  affects the blue component of palettes defined using RGB data and
  1296. the "value" component of palettes defined using HSV data.
  1297.  
  1298. Floyd-Steinberg dithering is available if virtual sprites are being used
  1299. through the "Dithering(FloydSteinberg)" command.  Note that
  1300. "ScaledDithering(FloydSteinberg)" will not usually work.
  1301.  
  1302. Dithering(Value)
  1303. ~~~~~~~~~~~~~~~~
  1304. Sets Dithering0, Dithering1 and Dithering2 to be equal to <Value>.
  1305.  
  1306. DitheringOne(Value)
  1307. ~~~~~~~~~~~~~~~~~~~
  1308. Sets Dithering1 to be equal to <Value>.
  1309.  
  1310. DitheringTwo(Value)
  1311. ~~~~~~~~~~~~~~~~~~~
  1312. Sets Dithering2 to be equal to <Value>.
  1313.  
  1314. ScaledDithering(Value)
  1315. ~~~~~~~~~~~~~~~~~~~~~~
  1316. Sets Dithering0 to be equal to a value which depends on the colour depth of
  1317. the mode being used.  The precise Value given to Dithering0 varies as
  1318. follows:
  1319.  
  1320. Depth Result
  1321.  16M  0
  1322.  32K  Value * 3 / 8
  1323.  256  Value / 2
  1324.   16  Value
  1325.    4  Value * 2
  1326.    2  Value * 4
  1327.  If the result is greater than &FFFF, then it is set to this ceiling.
  1328.  
  1329.                     14 Processing commands
  1330.                     ======================
  1331.  
  1332. OneDimensionalProcess(X1,X2,Function,Type)
  1333. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1334. The section of the main one dimensional buffer defined by (X1,X2) is
  1335. processed according to "Function" and combined with its original self using
  1336. combination-type "Type".  "Function" may usefully contain commands such as
  1337. "OneDimensionalPoint(X)".
  1338.  
  1339.  
  1340. TwoDimensionalProcess(X1,Y1,X2,Y2,Function,Type)
  1341. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1342. The rectangle in the main two dimensional buffer defined by opposing corners
  1343. at (X1,Y1) and (X2,Y2) is processed according to "Function" and combined with
  1344. its original self using combination-type "Type".  "Function" may usefully
  1345. contain commands such as "TwoDimensionalPoint(X,Y)".
  1346.  
  1347. OneDimensionalFilter(Left,Centre,Right,Type)
  1348. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1349. Each point in the one dimensional buffer is processed by adding the values of
  1350. its two neighbours and itself (multiplied by one of three multipliers) and
  1351. dividing by &100 before combining it with its original self using
  1352. combination-type "Type".  The following diagram describes the position of the
  1353. relevant multipliers.
  1354.  
  1355.                 -------------
  1356.                 | L | C | R |
  1357.                 -------------
  1358.  
  1359. TwoDimensionalFilter(Top_Left,Top_Centre,Top_Right,
  1360.                      Middle_Left,Middle_Centre,Middle_Right,
  1361.                      Bottom_Left,Bottom_Centre,Bottom_Right,Type)
  1362. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1363. Each point in the two dimensional buffer is processed by adding the values of
  1364. its eight neighbours and itself (multiplied by a series of multipliers) and
  1365. dividing by &100 before combining it with its original self using
  1366. combination-type "Type".  The following diagram describes the position of the
  1367. relevant multipliers.
  1368.  
  1369.                   ----------------
  1370.                   | TL | TC | TR |
  1371.                   ----------------
  1372.                   | ML | MC | MR |
  1373.                   ----------------
  1374.                   | BL | BC | BR |
  1375.                   ----------------
  1376.  
  1377. OneDimensionalContrast(Value)
  1378. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1379. Multiplies the entire contents of the main one dimensional buffer by <Value>,
  1380. divides by &100 and then truncates any high bit "spillage".
  1381.  
  1382. TwoDimensionalContrast(Value)
  1383. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1384. Multiplies the entire contents of the main two dimensional buffer by <Value>,
  1385. divides by &100 and then truncates any high bit "spillage".
  1386.  
  1387. OneDimensionalFlood(Threshold,Multiplier,Value,Type)
  1388. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1389. If the contents of the main one dimensional buffer at any point is less than
  1390. <Threshold>, this command multiplies it by <Multiplier>, divides by &100 and
  1391. then combines it with <Value> using combination-type "Type".
  1392.  
  1393. TwoDimensionalFlood(Threshold,Multiplier,Value,Type)
  1394. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1395. If the contents of the main one dimensional buffer at any point is less than
  1396. <Threshold>, this command multiplies it by <Multiplier>, divides by &100 and
  1397. then combines it with <Value> using combination-type "Type".
  1398.  
  1399. OneDimensionalEqualization
  1400. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1401. This expands the range of the contents of the main one dimensional buffer
  1402. until it covers the range &0000-&FFFF by using linear scaling.
  1403.  
  1404. TwoDimensionalEqualization
  1405. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1406. This expands the range of the contents of the main two dimensional buffer
  1407. until it covers the range &0000-&FFFF by using linear scaling.
  1408.  
  1409. One of the problems with this command (and the one above) emerges when
  1410. textures using it are animated.  Because the height of the highest mountain
  1411. and the floor of the deepest valley (so to speak) determine the scaling
  1412. factor to be used, this will be a different factor for different animation
  1413. frames.  An especially high mountain will produce a "freak" low gain value. 
  1414. This will have the effect of making the rest of the texture appear lower than
  1415. it would normally be.  Depending on the colouring scheme used, this can
  1416. result in an unsightly flashing effect in the resultant animation.  There is
  1417. no simple fix for this, but truncating high mountains, and using a fixed gain
  1418. contrast command are both possible.
  1419.  
  1420. GenerateOneDimensionalDust(Threshold,Function,Type)
  1421. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1422. Processes the contents of the main one dimensional buffer by comparing it to
  1423. a bank of white noise and combining those values exceeded by some threshold
  1424. (<Threshold>) by the function (of X) "Function" using combination-type
  1425. "Type".
  1426.  
  1427. GenerateTwoDimensionalDust(Threshold,Function,Type)
  1428. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1429. Similar to above using the main two dimensional buffer.
  1430.  
  1431. TwoDimensionalInversion
  1432. ~~~~~~~~~~~~~~~~~~~~~~~
  1433. Inverts (EORs with &FFFF) the main two dimensional buffer.
  1434.  
  1435. OneDimensionalInversion
  1436. ~~~~~~~~~~~~~~~~~~~~~~~
  1437. Inverts (EORs with &FFFF) the main one dimensional buffer.
  1438.  
  1439. TwoDimensionalClear
  1440. ~~~~~~~~~~~~~~~~~~~
  1441. Clears the main two dimensional buffer with zeros.
  1442.  
  1443. OneDimensionalClear
  1444. ~~~~~~~~~~~~~~~~~~~
  1445. Clears the main one dimensional buffer with zeros.
  1446.  
  1447. DefineSolidBlock(Block_Description)
  1448. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1449. This command defines a solid block of texture in three dimensions.  Its
  1450. single parameter, "Block_Description" is a function of X,Y, and Z.  This
  1451. function usually refers to the various buffers using the
  1452. "TwoDimensionalPoint" commands.
  1453.  
  1454. Sculpture(Path_of_X,Path_of_Y,Path_of_Z)
  1455. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1456. This command sculpts a solid shape from the solid block of texture described
  1457. in the last "DefineSolidBlock" command.  The parameters, "Path_of_X",
  1458. "Path_of_Y", "Path_of_Z", define a mapping between X and Y and the three
  1459. dimensional space.  They are all functions of X and Y.  The resulting shape
  1460. is stored in the main two dimensional buffer.
  1461.  
  1462. Resize(XFactor,YFactor)
  1463. ~~~~~~~~~~~~~~~~~~~~~~~
  1464. Resizes the texture by XFactor and YFactor.
  1465. Actually performs something similar to:
  1466. "TwoDimensionalShift(&8000,&8000,Overwrite)"
  1467. "TwoDimensionalProcess(0,0,XFactor,YFactor,TwoDimensionalPoint(
  1468.    Combine(Multiplication,&40000 DIV XFactor,LogicalShiftRight(X,&6)),
  1469.    Combine(Multiplication,&40000 DIV YFactor,LogicalShiftRight(Y,&6))),
  1470.    Overwrite)".
  1471. "TwoDimensionalShift(&8000,&8000,Overwrite)"
  1472.  
  1473. ResizeBumpMap(XFactor,YFactor)
  1474. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1475. This command is used in a similar context to the "Resize(XFactor,YFactor)"
  1476. command.  It is intended for use in resizing bump maps.  The front end
  1477. assumes that if the two dimensional map has been changed since the last
  1478. virtual sprite was made, then this command has been inserted at the
  1479. appropriate point.
  1480.  
  1481. If called with XFactor and YFactor both equal to &FFFF this command does
  1482. no processing.  Otherwise it performs the action of
  1483. "Resize(XFactor,YFactor)".
  1484.  
  1485.                      15 Linear segment commands
  1486.                      ==========================
  1487.  
  1488. LinearField(H1,H2)
  1489. ~~~~~~~~~~~~~~~~~~
  1490. Creates a linear field over the entire domain of the main one dimensional
  1491. buffer.  It ranges from H1 ay X = 0 to H2 at X = &FFFF. *
  1492.  
  1493. LinearSegment(X1,X2,H1,H2,Type)
  1494. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1495. Creates a linear field over the domain (X = X1 to X = X2) in
  1496. the main one dimensional buffer.  It ranges from Y = H1 at X = X1 to Y = H2
  1497. at X = X2. *
  1498.  
  1499. LinearFieldSegment(H1,H2,X1,X2,Type)
  1500. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1501. Creates a linear field over the domain (X = &FFFF - X2 to X = &FFFF - X1) in
  1502. the main one dimensional buffer.  It ranges from Y = H2 at X = &FFFF - X2 to
  1503. Y = H1 at X = &FFFF - X1.  The behaviour of the command when X1 is greater
  1504. than X2 is always produces a repeatable result, but it is beyond the scope
  1505. of this document to describe its exact effect.  In particular, it should not
  1506. be assumed that when X1 is greater than X2 this command affects this domain.
  1507.  
  1508. This ridiculous specification of the syntax of this command is a legacy from
  1509. Texture Garden's developmental days.  It has been retained to enable old
  1510. textures to be generated correctly.  The command
  1511. "LinearSegment(X1,X2,H1,H2,Type)" should now be used preferentially. *
  1512.  
  1513. * Note that by virtue of its nature, the previous three commands may destroy
  1514.   the ability of textures using it to tessellate.
  1515.  
  1516. Rectangle(I,X1,Y1,X2,Y2,Type)
  1517. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1518. Simply creates a rectangle in the main two dimensional buffer.  Of "height"
  1519. <I> and opposing corners at (X1,Y1) and (X2,Y2), the rectangle is combined
  1520. with the existing pattern using combination-type "Type".
  1521.  
  1522.                         16 Shifting commands
  1523.                         ====================
  1524.  
  1525. OneDimensionalShift(Delta_X,Type)
  1526. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1527. The main one dimensional buffer is shifted by <Delta_X> and combined with its
  1528. original self using combination-type "Type".
  1529.  
  1530. TwoDimensionalShift(Delta_X,Delta_Y,Type)
  1531. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1532. The main two dimensional buffer is shifted by (<Delta_X>,<Delta_Y>) and
  1533. combined with its original self using combination-type "Type".
  1534.  
  1535.                          17 Rotation commands
  1536.                          ====================
  1537.  
  1538. QuickRotate(Theta,Type)
  1539. ~~~~~~~~~~~~~~~~~~
  1540. The main two dimensional buffer is rotated by <Theta> rounded to the nearest
  1541. multiple of 90 degrees and combined with its original self using
  1542. combination-type "Type".  Usually <Theta> is one of "Zero", "Ninety",
  1543. "OneHundredAndEighty" and "TwoHundredAndSeventy".
  1544.  
  1545. Rotate(Theta,Type)
  1546. ~~~~~~~~~~~~~~~~~~
  1547. The main two dimensional buffer is rotated by <Theta> rounded to the nearest
  1548. multiple of 1/3 of a degree and combined with its original self using
  1549. combination-type "Type". *
  1550.  
  1551. SlowRotate(Theta,Type)
  1552. ~~~~~~~~~~~~~~~~~~~~~~
  1553. Same as Rotate but with sub-pixel anti-aliasing. *
  1554.  
  1555. RotateAbout(Theta,X,Y,Type)
  1556. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1557. Similar to Rotate, but the rotation is about an arbitrary point.  This is not
  1558. equivalent to a Shift, Rotate and Shift because of the location of the
  1559. introduced discontinuities. * #
  1560.  
  1561. SlowRotateAbout(Theta,X,Y,Type)
  1562. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1563. Same as RotateAbout but with sub-pixel anti-aliasing. *
  1564.  
  1565. * Note that by virtue of the nature of its action, this command may destroy
  1566.   the ability of the texture to tessellate unless <Theta> is one of "Zero",
  1567.   "Ninety", "OneHundredAndEighty" and "TwoHundredAndSeventy" (in which case
  1568.   "QuickRotate" should be used).  The discontinuities are introduced at what
  1569.   would normally turn into the edges of the sprite.  However, further
  1570.   processing may alter their location.  The command is also a bit quick and
  1571.   dirty in that no anti-aliasing techniques are used to smooth the rotation. 
  1572.   If multiple rotations are used then this might become a problem, though it
  1573.   may also produce some interesting effects as the number of iterations
  1574.   reaches 100.
  1575.  
  1576. # Note that there is no QuickRotateAbout as this can be accomplished with a
  1577.   QuickRotate and a TwoDimensionalShift.
  1578.  
  1579.                       18 Loops
  1580.                       ========
  1581. Repeat
  1582. ~~~~~~
  1583. Sets up a "Repeat"-type loop.
  1584.  
  1585. Until(Condition)
  1586. ~~~~~~~~~~~~~~~~
  1587. Loops to the matching "Repeat" until <Condition> is non-zero.
  1588.  
  1589. For(Number_of_times_to_loop)
  1590. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1591. Sets up a "For"-type loop to be executed <Number_of_times_to_loop> times.
  1592.  
  1593. Next
  1594. ~~~~
  1595. Loops to the matching "For" for the specified number of times.
  1596.  
  1597.                   19 Buffer manipulation commands
  1598.                   ===============================
  1599.  
  1600. OneDimensionalStoreBufferOne
  1601. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1602. Stores the contents of the main one dimensional buffer in the first one
  1603. dimensional buffer, overwriting its contents.
  1604.  
  1605. OneDimensionalStoreBufferTwo
  1606. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1607. Stores the contents of the main one dimensional buffer in the second one
  1608. dimensional buffer, overwriting its contents.
  1609.  
  1610. OneDimensionalSwapBufferOne
  1611. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1612. Swaps the contents of the main one dimensional buffer with the contents of
  1613. the first one dimensional buffer.
  1614.  
  1615. OneDimensionalSwapBufferTwo
  1616. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1617. Swaps the contents of the main one dimensional buffer with the contents of
  1618. the second one dimensional buffer.
  1619.  
  1620. OneDimensionalMaskBufferOne(Type)
  1621. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1622. Combines the contents of the main one dimensional buffer with the contents of
  1623. the first one dimensional buffer using combination-type "Type".
  1624.  
  1625. TwoDimensionalStore
  1626. ~~~~~~~~~~~~~~~~~~~
  1627. Stores the contents of the main two dimensional buffer in the first two
  1628. dimensional buffer, overwriting its contents. *
  1629.  
  1630. TwoDimensionalSwap
  1631. ~~~~~~~~~~~~~~~~~~
  1632. Swaps the contents of the main two dimensional buffer with the contents of
  1633. the first two dimensional buffer. *
  1634.  
  1635. TwoDimensionalMask(Type)
  1636. ~~~~~~~~~~~~~~~~~~~~~~~~
  1637. Combines the contents of the main two dimensional buffer with the contents of
  1638. the first two dimensional buffer using combination-type "Type". *
  1639.  
  1640. * Note that the memory used in manipulating the first two dimensional buffer
  1641.   is not allocated by default, and this will cause the process of texture
  1642.   generation to use more memory than normal.  This is only important in
  1643.   if textures are to be generated in low-memory environments.
  1644.   
  1645.                      20 Wavey and Distorting commands
  1646.                      ================================
  1647.  
  1648. VerticalDistortion(Type)
  1649. ~~~~~~~~~~~~~~~~~~~~~~~~
  1650. Applies a series of vertical displacements to the contents of the main two
  1651. dimensional buffer according to the contents of the main one dimensional
  1652. buffer.  The maximum displacement is twice the dimensions of the main two
  1653. dimensional buffer.  Combination-type "Type" is used.
  1654.  
  1655. HorizontalDistortion(Type)
  1656. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1657. See "VerticalDistortion" which is similar.
  1658.  
  1659. HorizontalWaveWarp(Type)
  1660. ~~~~~~~~~~~~~~~~~~~~~~~~
  1661. Applies a "shaped smear" of waves to the contents of the main two dimensional
  1662. buffer whose horizontal displacements vary according to the contents of the
  1663. main one dimensional buffer.  The exact form of the smear is controlled by
  1664. the first one dimensional buffer.  The maximum amplitude of the waves is
  1665. twice the dimensions of the main two dimensional buffer.  Combination-type
  1666. "Type" is used.
  1667.  
  1668. VerticalWaveWarp(Type)
  1669. ~~~~~~~~~~~~~~~~~~~~~
  1670. See "HorizontalWaveWarp" which is similar.
  1671.  
  1672. HorizontalWaves(Type)
  1673. ~~~~~~~~~~~~~~~~~~~~~
  1674. Applies a "smear" of waves to the contents of the main two dimensional
  1675. buffer.  The exact form of the smear is controlled by the main one
  1676. dimensional buffer.  The maximum amplitude of the waves is twice the
  1677. dimensions of the main two dimensional buffer.  Combination-type "Type" is
  1678. used.
  1679.  
  1680. VerticalWaves(Type)
  1681. ~~~~~~~~~~~~~~~~~~~
  1682. See "HorizontalWaves" which is similar.
  1683.  
  1684. GenerateOneDimensionalDust(Threshold,Function,Type)
  1685. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1686. Processes the contents of the main one dimensional buffer by comparing it to
  1687. a bank of white noise and combining those values exceeded by some threshold
  1688. (<Threshold>) by the function (of X) "Function" using combination-type
  1689. "Type".
  1690.  
  1691. GenerateTwoDimensionalDust(Threshold,Function,Type)
  1692. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1693. Similar to above using the main two dimensional buffer.
  1694.  
  1695. TwoDimensionalInversion
  1696. ~~~~~~~~~~~~~~~~~~~~~~~
  1697. Inverts (EORs with &FFFF) the main two dimensional buffer.
  1698.  
  1699. OneDimensionalInversion
  1700. ~~~~~~~~~~~~~~~~~~~~~~~
  1701. Inverts (EORs with &FFFF) the main one dimensional buffer.
  1702.  
  1703.                   21 Colour related commands
  1704.                   ==========================
  1705.  
  1706. StartColourDefinition
  1707. ~~~~~~~~~~~~~~~~~~~~~
  1708. This should occur at the start of every palette definition.  It is a marker
  1709. used by the front end to manipulate texture texts.
  1710.  
  1711. EndColourDefinition
  1712. ~~~~~~~~~~~~~~~~~~~
  1713. This should occur at the end of every palette definition.  It is a marker
  1714. used by the front end to manipulate texture texts.
  1715.  
  1716. SetColour(ColourModel,Component1,Component2,Component3)
  1717. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1718. Selects the current colour to the one specified by "Component1",
  1719. "Component2" and "Component3" as set out in the "CreateColours(ColourModel)"
  1720. command (see below).
  1721.  
  1722. CreateColours(ColourModel)
  1723. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1724. This command sets up a field of 24 bit RGB values describing the palette
  1725. which will be used in any "MakeSprite", "AddToSprite" or "MakeVirtualSprite"
  1726. commands.  The "ColourModel" may be one of "RGB", "HSV" or "CIE".  This
  1727. command represents the preferred method of performing these actions.
  1728.  
  1729. The three one-dimensional buffers are used to supply the colour's components.
  1730.  
  1731. With the "RGB" ColourModel, buffer two contains the red component, buffer
  1732. one contains the green component, and the main buffer containing the blue
  1733. component.
  1734.  
  1735. With the "HSV" ColourModel, buffer two contains the red component, buffer
  1736. one contains the green component, and the main buffer containing the blue
  1737. component.
  1738.  
  1739. With the "HSV" ColourModel, buffer two contains the "hue" component, buffer
  1740. one contains the "saturation" component, and the main buffer contains the
  1741. "value" component.
  1742.  
  1743. With the "HSV" ColourModel, buffer two contains the "X" component, buffer one
  1744. contains the "Y" component, and the main buffer contains the "Z" component.
  1745.  
  1746. CreateColoursUsingRGBData
  1747. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1748. Performs "CreateColours(RGB)".  
  1749.  
  1750. CreateColoursUsingHSVData
  1751. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1752. Performs "CreateColours(HSV)".
  1753.  
  1754. CreateColoursUsingCIEData
  1755. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1756. Performs "CreateColours(CIE)".
  1757.  
  1758.              22 Mirroring, Flipping and Shearing commands
  1759.              ============================================
  1760.         
  1761. Caution should be exercised when using the leading-diagonal and
  1762. trailing-diagonal versions of the mirror and flip commands as they may
  1763. prevent the resulting texture from tessellating correctly.  The shear
  1764. commands may also appear to produce different effects at different
  1765. resolutions unless the absolute size of their parameter is kept quite small.
  1766.  
  1767. The following commands all combine the main two dimensional buffer with its
  1768. mirror image in the specified axis before combining it with its original self
  1769. using combination-type "Type".
  1770.  
  1771. HorizontalMirror(Type)
  1772. ~~~~~~~~~~~~~~~~~~~~~~
  1773. VerticalMirror(Type)
  1774. ~~~~~~~~~~~~~~~~~~~~
  1775. LeadingDiagonalMirror(Type)
  1776. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1777. TrailingDiagonalMirror(Type)
  1778. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1779. The following "Flip" commands are similar to the "Mirror" commands.  However,
  1780. the result is no longer guaranteed to be symmetrical.  They take fractionally
  1781. longer to perform.
  1782.  
  1783. HorizontalFlip(Type)
  1784. ~~~~~~~~~~~~~~~~~~~~
  1785. VerticalFlip(Type)
  1786. ~~~~~~~~~~~~~~~~~~
  1787. LeadingDiagonalFlip(Type)
  1788. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1789. TrailingDiagonalFlip(Type)
  1790. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1791. Shears combine a sheared image of the main two dimensional buffer with its
  1792. original self using combination-type "Type".  A shear of Size 1 produces a 45
  1793. degree shear; higher numbers may be thought of as representing  the effect of
  1794. repeated shears.
  1795.  
  1796. HorizontalShear(Size,Type)
  1797. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1798. VerticalShear(Size,Type)
  1799. ~~~~~~~~~~~~~~~~~~~~~~~~
  1800.                   23 Blobbing commands
  1801.                   ====================
  1802.  
  1803. Ripples(Intensity,Radius,X,Y,Type)
  1804. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1805. This produces a circular effect in the main two dimensional buffer.  The
  1806. effect is centred at (X,Y) and is of radius <Radius> and height <Intensity>. 
  1807. The effect is composed of concentric ripples modulated by the contents of the
  1808. main one dimensional buffer.
  1809.  
  1810. Radials(Intensity,Radius,X,Y,Type,TypeTwo)
  1811. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1812. This produces a near-circular effect in the main two dimensional buffer.  The
  1813. effect is centred at (X,Y) and is of radius <Radius> and height <Intensity>. 
  1814. The effect is composed of distorted ripples combined with radial lines
  1815. modulated by the contents of the one dimensional buffers.  The main one
  1816. dimensional buffer affects the distortion, the first buffer affects the
  1817. ripples and the second affects the radial lines and their distribution.
  1818. "Type" affects the way the radial lines are combined with the background and
  1819. "TypeTwo" affects the way the ripples are combined with the resultant.
  1820.  
  1821.                      24 Branching
  1822.                      ============
  1823.  
  1824. Define <DefinitionMarker>
  1825. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1826. Places a marker in the program and gives it a name.  This name may contain
  1827. any characters, but top-bit-set (> &7F), low values (< &20), ")", "|" and
  1828. "," should not be used for compatibility with future versions of the
  1829. program.
  1830.  
  1831. Goto <DefinitionMarker>
  1832. ~~~~~~~~~~~~~~~~~~~~~~~
  1833. Jumps directly to the named marker.
  1834.  
  1835. Call <DefinitionMarker>
  1836. ~~~~~~~~~~~~~~~~~~~~~~~
  1837. Calls a routine at the named marker, setting up a return address.
  1838. Calls and Jumps may not currently be used as functions or as parameters to
  1839. functions.  They may be used as commands in conditional statements.
  1840.  
  1841. Return
  1842. ~~~~~~
  1843. Returns from the most recent call.
  1844.  
  1845.                    25 Light sources and bump maps
  1846.                    ==============================
  1847.  
  1848. DefineLightSource(LightModel,Theta,Phi)
  1849. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1850. Sets up a light source.  This comes from angle Theta in the horizontal plane
  1851. (&0 = East, &4000 = North, etc.) and elevation Phi (&0 = on the horizon,
  1852. &FFFF = at the zenith).
  1853.  
  1854. The colour is defined as the current colour (i.e. the one last defined with
  1855. a "SetColour" command).
  1856.  
  1857. If the lighting model requires it, the current dithering will be used to
  1858. define the specular constant.
  1859.  
  1860. The lighting model may currently be one of "Gourad", "Phong", "Specular" or
  1861. "SpecularPhong".
  1862.  
  1863. If you use more than one light source, it is easy to saturate the resulting
  1864. texture, which will appear to have uniform blobs of colour, usually white.
  1865.  
  1866. This may also happen when shining bright light souces from near the horizon.
  1867. Because many bump maps will have tall narrow peaks, shining a light from the
  1868. side will produce significantly more illumination than shining one from
  1869. near the zenith.
  1870.  
  1871. To stop this from happening, either reduce the intensity of the lights being
  1872. used, shine them more from overhead, or reduce the bumpiness of the map
  1873. being used.
  1874.  
  1875. Currently, only the first eight lightsources are recognised.
  1876.  
  1877. ShineLightOnVirtualSprite
  1878. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1879. This performs the computation using the main two dimensional buffer as the
  1880. data for the bumpmap, and the previously defined light sources to specify
  1881. the lighting.
  1882.  
  1883. The virtual sprite contains the data which is to be illuminated, and is used
  1884. to store the result.
  1885.  
  1886. NOTES:
  1887.  
  1888.   1. In order to cooperate with future front ends to this feature, the
  1889.      "DefineLightSource" commands, the "SetColour" commands and the
  1890.      "ShineLightOnVirtualSprite" command should all be grouped together in
  1891.      one section, with a "ResizeBumpMap" at the beginning if appropriate.
  1892.  
  1893.   2. The "ResizeBumpMap" should always be used if the bumpmap is altered
  1894.      since the last MakeVirtualSprite command.  It should be placed after
  1895.      the bumpmap has been created, and directly before any SetColour
  1896.      commands.  If this is not done, the texture may not resize properly.
  1897.