# Interface DrawableDescriptor

Used for containing the required information to compile drawables into shader code.

Each [[Drawable]] must have a static property of this type, called descriptor.

For more information on how to create your own DrawableDescriptor-s, look at the code of [[CircleFactory]] or [[InvertedTunnelFactory]].

interface DrawableDescriptor {
empty: Drawable;
objectCountScaler?: number;
propertyUniformMapping: { [property: string]: string };
sdf?: {
distanceFunctionName: string;
isInverted?: boolean;
shader: string;
};
shaderCombinationSteps: number[];
uniformCountMacroName: string;
}

- Defined in drawables/drawable-descriptor.ts:12

##### Index

### Properties

empty
objectCountScaler?
propertyUniformMapping
sdf?
shaderCombinationSteps
uniformCountMacroName

## Properties

### `Readonly` empty

empty: Drawable

When no shaderCombinationStep matches the current number of drawables exactly, the value of `empty` is used to pad out arrays.

- Defined in drawables/drawable-descriptor.ts:73

### `Optional` objectCountScaler

objectCountScaler?: number

Calculating the number of objects to be drawn is done using the following pseudo-formula:

objectCountScaler * propertyUniformMapping[0].length

By default, its value is 1

- Defined in drawables/drawable-descriptor.ts:57

### propertyUniformMapping

propertyUniformMapping: { [property: string]: string }

An object describing the relationship between the object returned by a [[Drawable]]'s getObjectToSerialize and the name of the arrays used in the GLSL code.

- Defined in drawables/drawable-descriptor.ts:17

### `Optional` sdf

sdf?: { distanceFunctionName: string; isInverted?: boolean; shader: string }

Required property for shapes having physical dimensions.

#### Type Declaration

- ##### distanceFunctionName: string

  The name of the function defined in the value of `shader`. Its signature should look like this:

       float (in vec2 target, out float colorIndex)

- ##### `Optional` isInverted?: boolean

  By default, drawables are not inverted.

- ##### shader: string

  The actual GLSL code for observing the drawables represented by this descriptor.

  Your code should work with both version 100 and version 300 es

- Defined in drawables/drawable-descriptor.ts:28

### shaderCombinationSteps

shaderCombinationSteps: number[]

Number of possible drawables around each tile.

For each step, a shader will be generated. And at runtime the closes matching shader will be used to render a given part of the scene.

Must contain 0 as a value.

- Defined in drawables/drawable-descriptor.ts:67

### uniformCountMacroName

uniformCountMacroName: string

The name of the uniform int used in the code to refer to the number of drawables of this type.

- Defined in drawables/drawable-descriptor.ts:23