> For the complete documentation index, see [llms.txt](https://docs.quickclient.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quickclient.cc/ui/render-3d.md).

# 3D-рендер

Линии, коробки, трейсеры и меши прямо в мире через Render3D.

Боксы вокруг игроков, трейсеры, значки над головой и всё остальное, что рисуется прямо в мире, выводится через `Render3D`.

Он приходит в `onRender3D(Render3D)` каждый кадр, пока скрипт включён и игрок находится в мире. Координаты передаются мировые, позицию камеры Quick вычитает сам. Последний аргумент почти у всех методов называется `throughWalls`: если он `true`, фигура видна сквозь блоки.

```java
@Override
public void onRender3D(Render3D render) {
    Entity target = entities().target();
    if (target == null) return;
    render.entityBox(target, 0xFFFF3B30, true);
    Point p = target.position(render.delta());
    render.tracer(p.x(), p.y() + target.height() / 2, p.z(), 0x80FF3B30, true);
}
```

Как это работает:

* Берётся текущая цель. Если её нет, рисовать нечего.
* Её хитбокс обводится красным и виден даже сквозь стены.
* К середине её тела идёт полупрозрачный трейсер. Позиция берётся с `render.delta()`, чтобы линия не дёргалась.

## Фигуры

| Метод                                                                | Описание                                                                  |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `line(x1, y1, z1, x2, y2, z2, color, throughWalls)`                  | отрезок                                                                   |
| `box(minX, minY, minZ, maxX, maxY, maxZ, color, throughWalls)`       | коробка, только рёбра                                                     |
| `filledBox(minX, minY, minZ, maxX, maxY, maxZ, color, throughWalls)` | залитая коробка                                                           |
| `entityBox(entity, color, throughWalls)`                             | рёбра хитбокса по плавной позиции сущности                                |
| `filledEntityBox(entity, color, throughWalls)`                       | залитый хитбокс                                                           |
| `tracer(x, y, z, color, throughWalls)`                               | линия от центра экрана до точки в мире                                    |
| `triangle(points, color, throughWalls)`                              | залитый треугольник; `points` это девять чисел                            |
| `polygon(points, color, throughWalls)`                               | веер треугольников от первой точки; точки идут тройками `x, y, z`         |
| `additive(additive)`                                                 | включает сложение цветов для всех следующих фигур, они начинают светиться |

При аддитивном смешивании складывается цвет, умноженный на альфу. Поэтому прозрачные места не светятся, а мягкость свечения задаётся альфой.

## Меши в мире

Меш собирается один раз через `gpu()`, после чего его можно рисовать каждый кадр без пересборки. Подробнее на странице [Своя геометрия](/ui/gpu.md).

| Метод                                                                                 | Описание                                                                   |
| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `billboard(mesh, x, y, z, scale, tint, throughWalls)`                                 | меш, который всегда повёрнут к камере, например значок над головой         |
| `billboard(mesh, texture, x, y, z, scale, tint, throughWalls)`                        | билборд с текстурой из `resources/`                                        |
| `mesh(mesh, x, y, z, scale, tint, throughWalls)`                                      | меш, выровненный по осям мира                                              |
| `mesh(mesh, texture, x, y, z, scale, tint, throughWalls)`                             | то же с текстурой                                                          |
| `mesh(mesh, x, y, z, scale, yaw, pitch, tint, throughWalls)`                          | меш с поворотом                                                            |
| `mesh(mesh, [shader,] texture, x, y, z, scale, yaw, pitch, tint, blend, depth, cull)` | все параметры задаются вручную: смешивание, тест глубины, отсечение граней |
| `billboard(mesh, [shader,] texture, x, y, z, scale, tint, blend, depth, cull)`        | то же для билборда                                                         |

`tint` это множитель цвета `0xAARRGGBB`, `-1` означает «как есть». `scale` задаётся в блоках.

| Группа  | Значения                                                                                        |
| ------- | ----------------------------------------------------------------------------------------------- |
| `blend` | `NORMAL`, `ADDITIVE`, `OVERWRITE`                                                               |
| `depth` | `NO_DEPTH` видно сквозь всё, `DEPTH` с тестом глубины, `DEPTH_WRITE` с тестом и записью глубины |

## Камера

| Метод                                 | Тип      | Описание                                                 |
| ------------------------------------- | -------- | -------------------------------------------------------- |
| `delta()`                             | `float`  | доля тика к этому кадру, её передают в `position(delta)` |
| `cameraX()`, `cameraY()`, `cameraZ()` | `double` | где находится камера                                     |
| `cameraYaw()`, `cameraPitch()`        | `float`  | куда направлена камера                                   |

Позицию сущности нужно брать через `entity.position(render.delta())`. С обычной позицией фигура будет прыгать от тика к тику.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.quickclient.cc/ui/render-3d.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
