class enum(object): def __len__(self): return len([x for x in dir(self) if x[0] != '_']) def __iter__(self): for name in sequence(self): yield getattr(self, name) def index(enumobj, name): return getattr(enumobj, name) def reverse(enumobj, value): for name in dir(enumobj): if name[0] == '_': continue if value == getattr(enumobj, name): return name return None def sequence(enumobj): retlist = [] for name in dir(enumobj): if name[0] == '_': continue retlist.append((getattr(enumobj, name), name)) return [x[1] for x in sorted(retlist)] # render types (for model.renderable_layer) rt = enum() rt.model = 0 # a 3d model made out of triangles, go figure! rt.sprite = 1 # a 2d texture applied to a 2d plane. rt.beam = 2 # a 2d plane between two points, similar to a sprite # rendering billboard modes (for model.renderable_layer) rtbb = enum() rtbb.none = 0 # not billboarded, has its own independent rotation rtbb.full = 1 # the sprite always squarely faces the camera with no rotation, only its position is relevant rtbb.yaxis = 2 # pitch and yaw axes are available for rotation, but rotation around the roll axis is always fixed to face the camera. # coordinate mode cm = enum() cm.universe = 0 cm.camera = 1 cm.relative = 2 cm.aa_relative = 3 # log level logl = enum() logl.debug = 9 logl.info = 8 logl.warn = 4 logl.err = 2 logl.crit = 0 # pipelines pl = enum() pl.camera = 0 pl.player = 1 pl.model = 2 pl.shadow = 3 pl.particle = 4 pl.sprite = 5 pl.composite1 = 6 pl.composite2 = 7 tt = enum() tt.diffuse = 0 # the diffuse texture sets the colors and general brightness of the texture. if the same texture is used as the emissive texture, the model is effectively "fullbright" tt.emissive = 1 # this texture is blended with the diffuse texture as the light level drops (this can be used to add running lights or glow to a ship, or light up the dark side of a planet, otherwise pure "black" is a good choice) tt.specular = 2 # adding a specular map allows you to add areas of low or high reflectivity to your texture tt.normal = 3 # normal maps allow bump mapping and other tweaks, with each channel representing the direction of the normal (red = -1x to 1x, green = -1y to 1y, blue = 0z to 1z)