Skip to content

Commit

Permalink
fix wrong type
Browse files Browse the repository at this point in the history
  • Loading branch information
nklbdev committed Jun 4, 2023
1 parent 7237f2d commit 9562828
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions servers/rendering_server.cpp
Expand Up @@ -402,9 +402,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
const Vector3 *src = array.ptr();
for (int i = 0; i < p_vertex_array_len; i++) {
Vector2 res = src[i].octahedron_encode();
int16_t vector[2] = {
(int16_t)CLAMP(res.x * 65535, 0, 65535),
(int16_t)CLAMP(res.y * 65535, 0, 65535),
uint16_t vector[2] = {
(uint16_t)CLAMP(res.x * 65535, 0, 65535),
(uint16_t)CLAMP(res.y * 65535, 0, 65535),
};

memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4);
Expand All @@ -422,9 +422,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
for (int i = 0; i < p_vertex_array_len; i++) {
const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]);
Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]);
int16_t vector[2] = {
(int16_t)CLAMP(res.x * 65535, 0, 65535),
(int16_t)CLAMP(res.y * 65535, 0, 65535),
uint16_t vector[2] = {
(uint16_t)CLAMP(res.x * 65535, 0, 65535),
(uint16_t)CLAMP(res.y * 65535, 0, 65535),
};

memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4);
Expand All @@ -437,9 +437,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
for (int i = 0; i < p_vertex_array_len; i++) {
const Vector3 src(src_ptr[i * 4 + 0], src_ptr[i * 4 + 1], src_ptr[i * 4 + 2]);
Vector2 res = src.octahedron_tangent_encode(src_ptr[i * 4 + 3]);
int16_t vector[2] = {
(int16_t)CLAMP(res.x * 65535, 0, 65535),
(int16_t)CLAMP(res.y * 65535, 0, 65535),
uint16_t vector[2] = {
(uint16_t)CLAMP(res.x * 65535, 0, 65535),
(uint16_t)CLAMP(res.y * 65535, 0, 65535),
};

memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, 4);
Expand Down

0 comments on commit 9562828

Please sign in to comment.