How Editor Works

Editor Format

Here is a sample file:

box1_1=-1 -1 -1
box1_2=-1 1 -1
box1_3=1 1 -1
box1_4=1 -1 -1
box2_1=-.5 -.5 1
box2_2=-.5 .5 1
box2_3=.5 .5 1
box2_4=.5 -.5 1
pyrbase_1=-1 1 -1
pyrbase_2=1 1 -1
pyrbase_3=1 1 1
pyrbase_4=-1 1 1
pyrapex=0 2 0
relocate=0 0 -3

box1=extr -2 $box1_1 $box1_2 $box1_3 $box1_4
box2=extr -1 $box2_1 $box2_2 $box2_3 $box2_4
box3=dupl @box2 $relocate
pyramid=pyr $pyrapex $pyrbase_1 $pyrbase_2 $pyrbase_3 $pyrbase_4

There are 3 main sections, the point definitions, then the object definitions, object modifiers. These three sections are divided by a blank line in the file.

Defining points

Points are defined with space separated x,y,z values. So

0 0 0

defines a point at the origin. If we want to give this point a name, we specify the variable name with a <name>=(point) syntax:

origin=0 0 0

Defining objects

Objects are defined by a set of predefined commands for constructing primatives. You can refer to a point either by name (with a leading "$") or by index (0, 1, 2 -- line number from beginning of file) in order. You can refer back to previously created solids also either by name (a trailing "@" this time), or by index again (0,1,2 - line number from beginning of section). Comments can be added in this section as well -- just start the line with a "#", and the line will not be parsed. These commands are listed below:

Extrude (extr)
extrude a planar solid (defined by a collection of points) a distance. Syntax is: extr (distance) $point1 $point2 $point3 ...
Pyramid (pyr)
create a pyramidal solid by a collection of points and a top vertex. Syntax is: pyr $apex $base_point1 $base_point2 $base_point3 ...
Duplicate (dupl)
duplicate a previously created solid at a different location. Note that the scale argument is optional, and works by multiplying each vertex in the solid by the components of the specified point. This can be used to make simple reflections quite easily. Syntax is: dupl @objectName $location $scale

Modifying objects

Objects are modfied with a command (so far only color), the object's name, and the attribute. It is worth mentioning here that colors are defined with 3 numbers in the points section, (red, green, blue), 0-255.

Color (color)
assign a color to the object to be named. Syntax is: color @objectName $colorName
Move (move)
move an object to another location, and optionally scale it. Syntax is: move @objectName $location $scale

== Some samples==

H. E. C. T. O. R.

blue=0 0 240
noOffset=0 0 0
reflect=-1 1 1
basePyr11=1.25 0 0
basePyr12=1 0 .5
basePyr13=1.5 0 .5
basePyr14=1.5 0 0
apexPyr1=1.25 -2 -1
apexPyr2=1.25 1.75 -1
side_1=.75 2 -2
side_2=1.25 2 0
side_3=1 3.5 -.25
side_apex= 1.5 2.5 -1
cockpit_1=0 2 -1.8
cockpit_2=.9 2.6 -.6
cockpit_3=0 3.25 .2
cockpit_4=-.9 2.6 -.6
gun_1=.6 1.9 -2.5
gun_2=.7 2.0 -2.5
gun_3=.6 2.1 -2.5
gun_4=.5 2.0 -2.5

py1=pyr $apexPyr1 $basePyr11 $basePyr12 $basePyr13
py2=pyr $apexPyr2 $basePyr11 $basePyr12 $basePyr13
side=pyr $side_apex $side_1 $side_2 $side_3
cockpit=extr .25 $cockpit_1 $cockpit_2 $cockpit_3 $cockpit_4
gun=extr 1.7 $gun_1 $gun_2 $gun_3 $gun_4
dupl @gun $noOffset $reflect
dupl @py1 $noOffset $reflect
dupl @py2 $noOffset $reflect
dupl @side $noOffset $reflect

color @cockpit $blue

Recent Changes

I have recently begun to add error checking into the editor application. Currently it is able to recover from most syntactical errors, and highlight the line at which the error has occurred. More useful feedback is spat out to stdout, and I have plans to add this information to the user-interface of the editor (which needs work).

see screenshot for current UI:

-- RussChou?, ElliotKroo? - 08 Jun 2007

Attachments