57671b2
M Cuboid, M Geneque, M Houll, A Pyramid-freeze-race - ddnet-mapsDrawCircle
,
my guess at what its doing is that it draws a number (Segments/2) of triangles and rotates them around the centre to draw a circle,
the for loop is i += 2, because because each triangle puts two points into the circumference
the rotation of the triangle is achieved by cos and sin using a rotation matrix
is this correct?
i dont really understand what the a1, a2, a3 resemble, what formula is used to calculate them and why would FSegments be doubled?
thanks for help
here is the code for DrawCircle:
void CRenderTools::DrawCircle(float x, float y, float r, int Segments)
{
IGraphics::CFreeformItem Array[32];
int NumItems = 0;
float FSegments = (float)Segments;
for(int i = 0; i < Segments; i += 2)
{
float a1 = i / FSegments * 2 * pi;
float a2 = (i + 1) / FSegments * 2 * pi;
float a3 = (i + 2) / FSegments * 2 * pi;
float Ca1 = cosf(a1);
float Ca2 = cosf(a2);
float Ca3 = cosf(a3);
float Sa1 = sinf(a1);
float Sa2 = sinf(a2);
float Sa3 = sinf(a3);
Array[NumItems++] = IGraphics::CFreeformItem(
x, y,
x + Ca1 * r, y + Sa1 * r,
x + Ca3 * r, y + Sa3 * r,
x + Ca2 * r, y + Sa2 * r);
if(NumItems == 32)
{
Graphics()->QuadsDrawFreeform(Array, 32);
NumItems = 0;
}
}
if(NumItems)
Graphics()->QuadsDrawFreeform(Array, NumItems);
}
gnome-tweaks-tools
, although I don't think that applies to electron appsvoid CGraphics_Threaded::LinesEnd()
, void CGraphics_Threaded::LinesBegin()
(edited)void CGraphics_Threaded::LinesDraw(const CLineItem *pArray, int Num)
? (edited)if(NumItems == 32)
{
Graphics()->QuadsDrawFreeform(Array, 32);
NumItems = 0;
}
}
if(NumItems)
Graphics()->QuadsDrawFreeform(Array, NumItems);
how is there an if statement with no condition? if(NumItems != NULL)
is that the readable version then?#include <iostream>
int main() {
int a[] = {10, 20, 30};
std::cout << 2[a] << std::endl;
}
#include <iostream>
int main() {
int a[] = {10, 20, 30};
std::cout << 2[a] << std::endl;
}
a[b]
is just syntax sugar for *(a + b)
SERVER_DEMO_CLIENT
.VERBOSE=1
to the make command line?make VERBOSE=1