контора пидорасов
-
Автор темы
- #1
daсурс легендвара?
фнкция рендера круга мб поломана
void render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)в draw_manager.cpp
где рендерится круг вроде бы надо заменить
auto на static auto
а нет, вот static auto -> auto
void render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)void render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)
{
static auto prevScreenPos = ZERO; //-V656
static auto step = M_PI * 2.0f / 72.0f;
auto screenPos = ZERO;
auto screen = ZERO;
if (!math::world_to_screen(origin, screen))
return;
for (auto rotation = 0.0f; rotation <= M_PI * 2.0f; rotation += step) //-V1034
{
Vector pos(radius * cos(rotation) + origin.x, radius * sin(rotation) + origin.y, origin.z);
if (math::world_to_screen(pos, screenPos))
{
if (!prevScreenPos.IsZero() && prevScreenPos.IsValid() && screenPos.IsValid() && prevScreenPos != screenPos)
{
line(prevScreenPos.x, prevScreenPos.y, screenPos.x, screenPos.y, color);
triangle(Vector2D(screen.x, screen.y), Vector2D(screenPos.x, screenPos.y), Vector2D(prevScreenPos.x, prevScreenPos.y), Color(color.r(), color.g(), color.b(), color.a() / 2));
}
prevScreenPos = screenPos;
}
}
}
Это эти круги а че тут не так?
void render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)
{
auto prevScreenPos = ZERO; //-V656
auto step = M_PI * 2.0f / 72.0f;
auto screenPos = ZERO;
auto screen = ZERO;
if (!math::world_to_screen(origin, screen))
return;
for (auto rotation = 0.0f; rotation <= M_PI * 2.0f; rotation += step) //-V1034
{
Vector pos(radius * cos(rotation) + origin.x, radius * sin(rotation) + origin.y, origin.z);
if (math::world_to_screen(pos, screenPos))
{
if (!prevScreenPos.IsZero() && prevScreenPos.IsValid() && screenPos.IsValid() && prevScreenPos != screenPos)
{
line(prevScreenPos.x, prevScreenPos.y, screenPos.x, screenPos.y, color);
triangle(Vector2D(screen.x, screen.y), Vector2D(screenPos.x, screenPos.y), Vector2D(prevScreenPos.x, prevScreenPos.y), Color(color.r(), color.g(), color.b(), color.a() / 2));
}
prevScreenPos = screenPos;
}
}
}
вот так
Вставить кодvoid render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)
{
static auto prevScreenPos = ZERO; //-V656
static auto step = M_PI * 2.0f / 72.0f;
auto screenPos = ZERO;
auto screen = ZERO;
if (!math::world_to_screen(origin, screen))
return;
for (auto rotation = 0.0f; rotation <= M_PI * 2.0f; rotation += step) //-V1034
{
Vector pos(radius * cos(rotation) + origin.x, radius * sin(rotation) + origin.y, origin.z);
if (math::world_to_screen(pos, screenPos))
{
if (!prevScreenPos.IsZero() && prevScreenPos.IsValid() && screenPos.IsValid() && prevScreenPos != screenPos)
{
line(prevScreenPos.x, prevScreenPos.y, screenPos.x, screenPos.y, color);
triangle(Vector2D(screen.x, screen.y), Vector2D(screenPos.x, screenPos.y), Vector2D(prevScreenPos.x, prevScreenPos.y), Color(color.r(), color.g(), color.b(), color.a() / 2));
}
prevScreenPos = screenPos;
}
}
}
Это эти круги а че тут не так?
зачем ты тут убрал статик? тут не нужно было.auto step = M_PI * 2.0f / 72.0f;
void render::Draw3DFilledCircle(const Vector& origin, float radius, Color color)
{
auto prevScreenPos = ZERO;
static auto step = M_PI * 2.0f / 72.0f;
auto screenPos = ZERO;
auto screen = ZERO;
if (!math::world_to_screen(origin, screen))
return;
for (auto rotation = 0.0f; rotation <= M_PI * 2.0f; rotation += step)
{
Vector pos(radius * cos(rotation) + origin.x, radius * sin(rotation) + origin.y, origin.z);
if (math::world_to_screen(pos, screenPos))
{
if (!prevScreenPos.IsZero() && prevScreenPos.IsValid() && screenPos.IsValid() && prevScreenPos != screenPos)
{
line(prevScreenPos.x, prevScreenPos.y, screenPos.x, screenPos.y, color);
triangle(Vector2D(screen.x, screen.y), Vector2D(screenPos.x, screenPos.y), Vector2D(prevScreenPos.x, prevScreenPos.y), Color(color.r(), color.g(), color.b(), color.a() / 2));
}
prevScreenPos = screenPos;
}
}
}
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz