<commit_before>[back to index](./)
# Glam.FlatMaterial
## [material/flat](https://github.com/glamjs/glam/tree/master/lib/material/flat)

The most basic of materials, a flat color.

## Example

```js
import Mesh       from "glam/lib/mesh"
import Material   from "glam/lib/material/flat"
import Geometry   from "glam/lib/geometry"
import Bunny      from 'bunny'


var material = Material()
var geometry = Geometry( Bunny )
var mesh     = Mesh( material, geometry )

material.shading.color = [0.1,0.3,0.4]
```

### Live Examples

* [Flat Blue Bunny](http://glamjs.github.io/glam/examples/02-fog/)
* [Flat Bunny with Fog Augment][example-fog] ([source][source-fog])

[example-hello-world]: http://requirebin.com/?gist=TatumCreative/40970c039f8c0ce44ae2
[example-fog]: http://requirebin.com/?gist=TatumCreative/c96e48648794a7565fcc

## Supported Augments

* [FogAugment](./material-augment-fog.md)

## API

### Material( data )

The default exported function creates the `flatMaterial` object. 

| arg  | type   | description |
| -----| ------ | ----------- |
| data | object | The data to use. |


### `flatMaterial` Object

| property      | type      | description |
| ------------- | --------- | ----------- |
| fragSource    | text      | The fragment shader source |
| vertSource    | text      | The vertex shader source |
| shader        | [gl-shader](https://github.com/stackgl/gl-shader) | An instance of [gl-shader](https://github.com/stackgl/gl-shader). This is created by the first render. It can be created manually. Make sure and change the recompile flag to false. |
| mode          | string    | The shader rendering style. It defaults to `"TRIANGLES"`, but the possible values are `"POINTS"`, `"LINES"`, `"LINE_STRIP"`, `"LINE_LOOP"`, `"TRIANGLES"`, `"TRIANGLE_STRIP"`, and `"TRIANGLE_FAN"`. These correspond to the [gl drawing mode](https://msdn.microsoft.com/en-us/library/dn302395(v=vs.85).aspx). |
| flags         | object    | Boolean flags for rendering options. `{ visible, transparent, recompile }` |
| shading       | object    | An object containing the shading options. `{ color, opacity }` |
| setUniforms   | function  | see below |<commit_msg>Links in readme are hard<commit_after>[back to index](./)
# Glam.FlatMaterial
## [material/flat](https://github.com/glamjs/glam/tree/master/lib/material/flat)

The most basic of materials, a flat color.

## Example

```js
import Mesh       from "glam/lib/mesh"
import Material   from "glam/lib/material/flat"
import Geometry   from "glam/lib/geometry"
import Bunny      from 'bunny'


var material = Material()
var geometry = Geometry( Bunny )
var mesh     = Mesh( material, geometry )

material.shading.color = [0.1,0.3,0.4]
```

### Live Examples

* [Flat Blue Bunny][example-hello-world]
* [Flat Bunny with Fog Augment][example-fog]

[example-hello-world]: http://requirebin.com/?gist=TatumCreative/40970c039f8c0ce44ae2
[example-fog]: http://requirebin.com/?gist=TatumCreative/c96e48648794a7565fcc

## Supported Augments

* [FogAugment](./material-augment-fog.md)

## API

### Material( data )

The default exported function creates the `flatMaterial` object. 

| arg  | type   | description |
| -----| ------ | ----------- |
| data | object | The data to use. |


### `flatMaterial` Object

| property      | type      | description |
| ------------- | --------- | ----------- |
| fragSource    | text      | The fragment shader source |
| vertSource    | text      | The vertex shader source |
| shader        | [gl-shader](https://github.com/stackgl/gl-shader) | An instance of [gl-shader](https://github.com/stackgl/gl-shader). This is created by the first render. It can be created manually. Make sure and change the recompile flag to false. |
| mode          | string    | The shader rendering style. It defaults to `"TRIANGLES"`, but the possible values are `"POINTS"`, `"LINES"`, `"LINE_STRIP"`, `"LINE_LOOP"`, `"TRIANGLES"`, `"TRIANGLE_STRIP"`, and `"TRIANGLE_FAN"`. These correspond to the [gl drawing mode](https://msdn.microsoft.com/en-us/library/dn302395(v=vs.85).aspx). |
| flags         | object    | Boolean flags for rendering options. `{ visible, transparent, recompile }` |
| shading       | object    | An object containing the shading options. `{ color, opacity }` |
| setUniforms   | function  | see below |
{'fraction_non_alphanumeric': 0.16480706648070664, 'fraction_numerical': 0.019525801952580194, 'mean_word_length': 3.2269155206286837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '473120', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1403, 'n_words': 365}