MCPcopy
hub / github.com/EngoEngine/engo / colorToFloat32

Function colorToFloat32

common/render_shaders.go:90–103  ·  view source on GitHub ↗

colorToFloat32 returns the float32 representation of the given color

(c color.Color)

Source from the content-addressed store, hash-verified

88
89// colorToFloat32 returns the float32 representation of the given color
90func 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.

Callers 4

generateBufferContentMethod · 0.85
generateBufferContentMethod · 0.85
generateBufferContentMethod · 0.85
generateBufferContentMethod · 0.85

Calls 1

Float32frombitsFunction · 0.92

Tested by

no test coverage detected