c0db40f624
Пункт ноль плана: клиент теперь просит контекст 3.3 в режиме совместимости, а не тот, что выпадал по умолчанию. Зачем: дальний вид будет писаться шейдером GLSL 330, и контекст должен гарантированно быть не ниже 3.3. В профиле совместимости работают и шейдеры игры (#version 120, их 34 штуки), и наши 330-е. LWJGL 2.9.4 выше 3.3 контекст не заказывает - ограничение в его конструкторе, а не в драйвере. Драйвер при этом дает 4.6, и расширение GL_EXT_gpu_shader4, которое просит FXAA-шейдер игры, в этом контексте на месте. Замер кадров теперь пишется в лог каждую секунду: средний, медиана, 1% и 0.1% low. Одного среднего мало: клиент, который идет со 60 кадрами и дважды в секунду проваливается в 10, в среднем остается 60 и ощущается как slideshow. Медленные кадры - это то, что чувствует игрок, поэтому окно держит все времена кадров и говорит про хвост. Среднее и процентили видны и в HUD, так что их не надо вылавливать из скриншотов. Замер: 307 fps | med 2.9 ms | 1% 6.0 ms | 0.1% 18.1 ms.
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
package net.rustnotmc.api.client;
|
|
|
|
/**
|
|
* The client the mod is running in.
|
|
*
|
|
* This is the whole surface a client mod gets, and it is deliberately small: it
|
|
* describes what the client shows, what the keyboard and mouse are doing, and
|
|
* where to add commands. There is no path from here to a block, an item, a
|
|
* player or a packet, because the server owns those and a client mod is not
|
|
* allowed to decide them.
|
|
*
|
|
* A mod that needs something genuinely outside this boundary is expected to say
|
|
* so, and reach for the reflective escape hatch deliberately, with the operator's
|
|
* consent, rather than finding a back door.
|
|
*/
|
|
public interface ClientServices {
|
|
|
|
/** The display state, never null. */
|
|
Screen screen();
|
|
|
|
/** Keyboard and mouse state, never null. */
|
|
Input input();
|
|
|
|
/** The mod command table, never null. */
|
|
Commands commands();
|
|
|
|
/** Ticks since the client started, driven by the game loop. */
|
|
long tick();
|
|
|
|
/** Frames drawn, which at a steady frame rate is a better clock than tick. */
|
|
long frame();
|
|
|
|
/** How fast the frames are going, never null. */
|
|
FrameStats frameStats();
|
|
} |