style keyword

Syntax

  • style style-id
  • style style-id extends base-style-id

A style is a set of rules and attributes. Every rule file implicitly has a default style called "Default". Thus every rule and attribute written in a rule file automatically belongs to the default style. Through the "style" statement, a new style can be defined. Every style which is not the default style has to be based on an existing style. In its simplest form, the "style" statement creates a new style based on the "Default" style. If a style has to be defined on a different style than the default style, the second form of the "style" statements allows to explicitly name a base style by "base-style-id". Thus the first form is completely equivalent (or just a shorthand) for "style style-id extends Default". Within a style, rules and attributes of the base style can be redefined as well as new rules and attributes can be added. Together with the import statement styles give a new design dimension for organizing your rule files.

Examples

Defining Styles

# define "color" attribute (green)
attr color = "#00ff00"

# create a green cube
Shape-->color(color) primitiveCube()


#define a new style "Blue_Bunny"
style Blue_Bunny

# re-define "color" attribute (blue)
attr color = "#0000ff"

# creates a blue bunny
Shape-->color(color) i("bunny.obj")


#define a new style "Red_Bull"
style Red_Bull

# re-define "color" attribute (red)
attr color = "#ff0000"

# creates a red bull
Shape-->color(color) i("bull.obj")

In this topic