colorToFloat32 returns the float32 representation of the given color
(c color.Color)
| 88 | |
| 89 | // colorToFloat32 returns the float32 representation of the given color |
| 90 | func colorToFloat32(c color.Color) float32 { |
| 91 | colorR, colorG, colorB, colorA := c.RGBA() |
| 92 | colorR >>= 8 |
| 93 | colorG >>= 8 |
| 94 | colorB >>= 8 |
| 95 | colorA >>= 8 |
| 96 | |
| 97 | red := colorR |
| 98 | green := colorG << 8 |
| 99 | blue := colorB << 16 |
| 100 | alpha := colorA << 24 |
| 101 | |
| 102 | return math.Float32frombits((alpha | blue | green | red) & 0xfeffffff) |
| 103 | } |
| 104 | |
| 105 | // AddShader adds a shader to the list of shaders for initalization. They should |
| 106 | // be added before the Rendersystem is added, such as in the scene's Preload. |
no test coverage detected