Дайте World To screen для апекса.

Начинающий
Статус
Оффлайн
Регистрация
18 Май 2021
Сообщения
49
Реакции[?]
0
Поинты[?]
0
Мне нужен world to screen для apex.

Пробовал это но не пашит:



struct view_matrix_t {
float* operator[ ](int index) {
return matrix[index];
}

float matrix[4][4];
};

struct Vector3
{
float x, y, z;
};

Vector3 WorldToScreen(const Vector3 pos, view_matrix_t matrix) {
float _x = matrix[0][0] * pos.x + matrix[0][1] * pos.y + matrix[0][2] * pos.z + matrix[0][3];
float _y = matrix[1][0] * pos.x + matrix[1][1] * pos.y + matrix[1][2] * pos.z + matrix[1][3];

float w = matrix[3][0] * pos.x + matrix[3][1] * pos.y + matrix[3][2] * pos.z + matrix[3][3];

float inv_w = 1.f / w;
_x *= inv_w;
_y *= inv_w;

float x = screenX * .5f;
float y = screenY * .5f;

x += 0.5f * _x * screenX + 0.5f;
y -= 0.5f * _y * screenY + 0.5f;

return { x,y,w };
}
 
На самом деле я Zodiak
Участник
Статус
Оффлайн
Регистрация
22 Дек 2020
Сообщения
958
Реакции[?]
168
Поинты[?]
58K
C++:
struct Vector3 WorldToScreen(struct Vector3 pos, Matrix matrix, int SWidth, int SHeight) {
    struct Vector3 out;

    float _x = matrix.matrix[0] * pos.x + matrix.matrix[1] * pos.y + matrix.matrix[2] * pos.z + matrix.matrix[3];
    float _y = matrix.matrix[4] * pos.x + matrix.matrix[5] * pos.y + matrix.matrix[6] * pos.z + matrix.matrix[7];

    out.z = matrix.matrix[12] * pos.x + matrix.matrix[13] * pos.y + matrix.matrix[14] * pos.z + matrix.matrix[15];

    _x *= 1.f / out.z;
    _y *= 1.f / out.z;

    out.x = SWidth * .5f;
    out.y = SHeight * .5f;

    out.x += 0.5f * _x * SWidth + 0.5f;
    out.y -= 0.5f * _y * SHeight + 0.5f;

    return out;
};

C++:
struct Matrix {
    float matrix[16];
};
C++:
uintptr_t ViewMatrix = Read<uintptr_t>(base_address + Offsets::ViewMatrix);
Matrix Matrixx = Read<Matrix>(ViewMatrix+ Offsets::VeiwRender);//обязательно ViewRender
//используешь Matrixx в качестве матрицы))
 
Начинающий
Статус
Оффлайн
Регистрация
18 Май 2021
Сообщения
49
Реакции[?]
0
Поинты[?]
0
C++:
struct Vector3 WorldToScreen(struct Vector3 pos, Matrix matrix, int SWidth, int SHeight) {
    struct Vector3 out;

    float _x = matrix.matrix[0] * pos.x + matrix.matrix[1] * pos.y + matrix.matrix[2] * pos.z + matrix.matrix[3];
    float _y = matrix.matrix[4] * pos.x + matrix.matrix[5] * pos.y + matrix.matrix[6] * pos.z + matrix.matrix[7];

    out.z = matrix.matrix[12] * pos.x + matrix.matrix[13] * pos.y + matrix.matrix[14] * pos.z + matrix.matrix[15];

    _x *= 1.f / out.z;
    _y *= 1.f / out.z;

    out.x = SWidth * .5f;
    out.y = SHeight * .5f;

    out.x += 0.5f * _x * SWidth + 0.5f;
    out.y -= 0.5f * _y * SHeight + 0.5f;

    return out;
};

C++:
struct Matrix {
    float matrix[16];
};
C++:
uintptr_t ViewMatrix = Read<uintptr_t>(base_address + Offsets::ViewMatrix);
Matrix Matrixx = Read<Matrix>(ViewMatrix+ Offsets::VeiwRender);//обязательно ViewRender
//используешь Matrixx в качестве матрицы))
норм..
 
Эксперт
Статус
Оффлайн
Регистрация
29 Мар 2021
Сообщения
1,500
Реакции[?]
560
Поинты[?]
104K
C++:
struct Vector3 WorldToScreen(struct Vector3 pos, Matrix matrix, int SWidth, int SHeight) {
    struct Vector3 out;

    float _x = matrix.matrix[0] * pos.x + matrix.matrix[1] * pos.y + matrix.matrix[2] * pos.z + matrix.matrix[3];
    float _y = matrix.matrix[4] * pos.x + matrix.matrix[5] * pos.y + matrix.matrix[6] * pos.z + matrix.matrix[7];

    out.z = matrix.matrix[12] * pos.x + matrix.matrix[13] * pos.y + matrix.matrix[14] * pos.z + matrix.matrix[15];

    _x *= 1.f / out.z;
    _y *= 1.f / out.z;

    out.x = SWidth * .5f;
    out.y = SHeight * .5f;

    out.x += 0.5f * _x * SWidth + 0.5f;
    out.y -= 0.5f * _y * SHeight + 0.5f;

    return out;
};

C++:
struct Matrix {
    float matrix[16];
};
C++:
uintptr_t ViewMatrix = Read<uintptr_t>(base_address + Offsets::ViewMatrix);
Matrix Matrixx = Read<Matrix>(ViewMatrix+ Offsets::VeiwRender);//обязательно ViewRender
//используешь Matrixx в качестве матрицы))
а нахуя ты массив матрицей назвал
 
Пользователь
Статус
Оффлайн
Регистрация
8 Апр 2022
Сообщения
644
Реакции[?]
102
Поинты[?]
65K
он такой же как и в остальных играх, только тебе нужно матрицу игры получить
 
Сверху Снизу