MCPcopy Create free account
hub / github.com/assaultcube/AC / createexpmodtex

Function createexpmodtex

source/src/renderparticles.cpp:54–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54GLuint createexpmodtex(int size, float minval)
55{
56 uchar *data = new uchar[size*size], *dst = data;
57 loop(y, size) loop(x, size)
58 {
59 float dx = 2*float(x)/(size-1) - 1, dy = 2*float(y)/(size-1) - 1;
60 float z = max(0.0f, 1.0f - dx*dx - dy*dy);
61 if(minval) z = sqrtf(z);
62 else loopk(2) z *= z;
63 *dst++ = uchar(max(z, minval)*255);
64 }
65 GLuint tex = 0;
66 glGenTextures(1, &tex);
67 createtexture(tex, size, size, data, 3, true, false, GL_ALPHA);
68 delete[] data;
69 return tex;
70}
71
72static struct expvert
73{

Callers 1

setupexplosionFunction · 0.85

Calls 2

createtextureFunction · 0.85
loopFunction · 0.70

Tested by

no test coverage detected