File formats anyflo

FILE FORMAT function
FILE FORMAT ASCII
IMAGE FILE FORMATS
FORMAT DES FICHIERS zbuf
FILE FORMATS SENSOR
BINARY FILE FORMAT
WAV FILE FORMAT

















































FILE FORMAT function

function      ascii      image      zbuffer      sensor      binary

La commande write func

         write func("A"); write all functions in file A.func

La commande read func

         read func("A"); loads functions from file A.func

Format des fichiers .fon

         They obey the syntax simplified and generalized language anyflo.
They include:
         1) Comments
         /* comments ... */
         2) Functions
         name(liste of formal parameters separated by comas)
         {
         text of the function...
         }
         They are editable in any text editor.

FILE FORMAT ASCII

Commande write ascii

         write ascii obj("nnn"); saves objects type obj in file nnn.ascii.obj
Examples:
         write ascii vol("A"); saves all volumes in file A.ascii.vol
         write ascii view("VIEW1"); saves all views in file VIEW1.ascii.view
         etc...

La commande read ascii

         read ascii obj("nnn"); loads objects type obj from file nnn.
Examples:
         read ascii light("L"); loads the lights described in file L.ascii.view
         read ascii fog("BB"); loads the fogs described in file BB.ascii.fog
         etc...

File format *. Ascii *.

OBJECT
OBJECT
...
with OBJECT of forme:
         TYPE
         {
         BLOCK
         BLOCK
         ...
         }
         with TYPE = type of an object anyflo written in uppercases FOG,LIGHT,VOL,...
         BLOCK is a property block of form:
         PROPERTY
         {
         values
         values
         ...
         }
         with PROPERTY = type of an anyflo property written in uppercases COL,FAC,...
Remarques          1) new lines are not meaningful.
         So:
         NUMBER
         {
         1
         }
         Can be written:
         NUMBER { 1 }
         2) If a property is followed only a single value, you can omit the braces.
         So:
         NUMERO { 1 }
         Peut s´écrire:
         NUMERO 1
         3) The braces can be omitted if there is no ambiguity.
         So:
         FAC
         {
         1 2 3 4
         5 6 7
         }
         Can be written:
         FAC
         1 2 3 4
         5 6 7
         However, for compatibility reasons, it is not recommended to use this tolerance.
         3) Any property can be encoded by:
         NNN1 NNN2 ...
         {
         list of parameters
         ...
         }
         where NNN is a command name written in uppercases.
Example:
         COL SOM
         {
         1 .75 .5 color of vertex 1
         0 1 .75 color of vertex 2
         * no color assigned to vertex 3
         ...
         }
Exemple 1
VOL
         {
         NUMBER{1}
         FAC
         {
         1 2 6 5
         2 3 7 6
         3 4 8 7
         4 1 5 8
         5 6 7 8
         4 3 2 1
         }
         POI
         {
         -100 100 -100
         100 100 -100
         100 100 100
         -100 100 100
         -100 -100 -100
         100 -100 -100
         100 -100 100
         -100 -100 100
         }
         }
Defines the cube number 1 and edge 200.
Exemple 3
LIGHT
         {
         NUMBER{1}
         POI
         {
         -750 -500 -1000
         }
         COL
         {
         1 1 1
         }
         }
         LIGHT
         {
         NUMBER{2}
         POI
         {
         -500 -300 -750
         }
         COL
         {
         0 1 0
         }
         }
Defines light 1 by default and light 2 positionned in (-500,-300,-750) and green color.

IMAGE FILE FORMATS

Commande write image

        
         write image(id)name("A"); saves image id inn compressed format in file A.ima
         write image(id)name("A.jpg"); saves image id in compressed JPEG format in file A.jpg
         write image(id)name("A.rgb"); under UNIX of SGI saves image id in rgb format in file A.rgb (on SGI).
         write image(id)name("A.bmp"); under WINDOWS saves image id in bmp format in file A.bmp
         write image(id)name("A.raw"); saves image idien raw format in file A.raw
This format, reading very fast, is used by the commands:
interaction read image number
image read number write number ext format
         write image(id)name("A.tga"); under WINDOWS saves image id in tga format in file A.tga. Thealpha layer can be filled by:
image(num)generate format("A").

La commande read image

read image("A.ext");
         fills image in memory with file A.ext
Note:
ext=ima: anyflo format
ext=jpg: Jpeg format
ext=rgb: rgb format
ext=bmp: bmp format
ext=raw: raw format
etc...
read image(id)name("A.ext")
         fills image id with file A.ext

Format des fichiers *.ima

(Leading)(Buffer)
         Leading = (dim,IMAGE,num,code,dimx,dimy,dimt), 7 integers (32 bits).
         dim = siz of the file (32 bits).
         IMAGE = (code)
         num = image number.
         code = 0: uncompressed, 1: compressed.
         dimx = image width (pixels)
         dimy = image height (pixels)
         dimt = 3 * dimx * dimy = number of the components of the image
         Si code = 0: uncompressed image:
         Buffer = (L1) ... (Ldimy): dimy lines encoding the pixels
         (Li) = ri,gi,bi
         ri = dimx unsigned char encoding the red components
         gi = dimx unsigned char encoding the green components
         bi = dimx unsigned char encoding the blue components
         If code = 1: compressed image:
         Buffer = (L1) ... (Ln) 0
         (Li) = encoding a line (shorts):
         Li = (dim,y)(R)(V)(B)
         R = (ns,S1,S2,...,Sns): ns descriptions of segments
         If = (ad,1,nss)(k1,k2,...,knss)
         ad = x (short)
         nss = number of contiguous pixels of different colors ki
         or Si = (ad,0,nss)(SS1)(SS2)...(SSnss)
         SSi = (np,k)
         np = number of pixels (short) of same color k
         k = color (unsigned char)

Format des fichiers *.raw


octets [0,3] ascii coding of width dimx
octets [4,7] ascii coding of height dimy
dimx*dimy (4 bytes rvba) encoding, red,green,bleu,alpha each of the pixels of the image.

FORMAT DES FICHIERS zbuf

Commande write zbuf

         write zbuf("A"); saves the zbuffer in file A.zbuf
         write(1)zbuf("A"); saves the zbuffer in compressed file A.zbuf

Commande read zbuf

         read zbuf("A"); loads zbuffer with file A.zbuf

File format *.zbuf

(Leading)(Buffer)
         Leading = (dim,ZBUF,num,code,dimx,dimy): 6 integers (32 bits)
         dim = size of the file (32 bits)
         ZBUF = (code)
         num (no meaning)
         code > 0: uncompressed:
         code = 1: 16 bits (short)
         Buffer = dimt shorts
         code = 2: 32 bits (float)
         Buffer = dimt float
         code < 0: compressed:
         code = -1: 16 bits (short)
         Buffer encoded as images
         code = -2: 32 bits (float)
         Buffer encoded as images
         dimx = width (pixels)
         dimy = height (pixels)

FILE FORMATS SENSOR

Format .cap ascii

File size sensors ascii (np captures of n sensors):
         c_1_1 c_1_2 … c_1_nc
         c_2_1 c_2_2 … c_2_nc
         …
         c_np_1 _cnp … c_np_nc

Format .per binaire

Sensor file nn.per in binary format anyflo :
     4 longs : np records dimp float values
         total dimension=4+np
         type=A_FLOAT
         number of records=np
         record dimension=dimp
     np*dimp floats : sensor values
         c_1_1 c_1_2 … c_1_dimp
         c_2_1 c_2_2 … c_2_dimp
       …
         c_np_1 c_np_2 … c_np_dimp
Such file nn.per can be generated by:
     interaction stock(np)name(«nn »)device ;
and read by:
     interaction play(«nn »)device ;
soliciting a sensor to determine dimp.

BINARY FILE FORMAT

Save some interpreter informations

Save some anyflo informations

WAV FILE FORMAT

wav file = header + datas

header

[0,3]: "RIFF" (4 octets)
[4,7]: file size (long 4 octets)
[8,11]: "WAVE" '(4 octets)
[12,15]: "fmt " '(4 octets)
[16,19]: format size (long)
[20,21]: format (long) (1)
[22,23]: channel (short 2 octets) (1,2)
[24,27]; sample rate (long) (44100,...)
[28,31]; byte rate (long) (176400)
[32,33]: block align (short) (8,16,32) (bits_per_sample*channels)/8=1,4,8 */
[34,35]: bits per sample (short) (8,16,32)
...
"data"
octets number (long) = file size - header size

datas

channel = 1
       data size = 1
              char ([-127,128]
       data size = 2
              short ([-32765,32766]
channel = 2
       data size = 1
              (char ([-127,128]) , (char ([-127,128])
       data size = 2
              (short ([-32765,32766]), (short ([-32765,32766])