fixes
parent
72b63d2ac0
commit
2708d4dc90
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -14439,12 +14439,17 @@ static __thread unsigned array_n_;
|
||||||
|
|
||||||
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
||||||
array_free(t); \
|
array_free(t); \
|
||||||
(t) = vrealloc( (t), array_count(src) * sizeof(0[t])); \
|
(t) = array_realloc_( (t), array_count(src)); \
|
||||||
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define array_erase(t, i) do { /*may alter ordering*/ \
|
#define array_swapback_and_pop(t, i) do { /*may alter ordering*/ \
|
||||||
memcpy( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
memmove( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
||||||
|
array_pop(t); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define array_erase(t, i) do { \
|
||||||
|
memmove( &(t)[i], &(t)[i + 1], sizeof(0[t])*(array_count(t) - i - 1)); \
|
||||||
array_pop(t); \
|
array_pop(t); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
@ -606822,8 +606827,9 @@ vec3 editor_pick(float mouse_x, float mouse_y) {
|
||||||
#else
|
#else
|
||||||
// unproject 2d coord as 3d coord
|
// unproject 2d coord as 3d coord
|
||||||
camera_t *camera = camera_get_active();
|
camera_t *camera = camera_get_active();
|
||||||
float x = (2.0f * mouse_x) / window_width() - 1.0f;
|
vec2 dpi = window_dpi();
|
||||||
float y = 1.0f - (2.0f * mouse_y) / window_height();
|
float x = (2.0f * mouse_x) / (dpi.x * window_width()) - 1.0f;
|
||||||
|
float y = 1.0f - (2.0f * mouse_y) / (dpi.y * window_height());
|
||||||
float z = 1.0f;
|
float z = 1.0f;
|
||||||
vec3 ray_nds = vec3(x, y, z);
|
vec3 ray_nds = vec3(x, y, z);
|
||||||
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
||||||
|
|
|
@ -115,12 +115,17 @@ static __thread unsigned array_n_;
|
||||||
|
|
||||||
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
||||||
array_free(t); \
|
array_free(t); \
|
||||||
(t) = vrealloc( (t), array_count(src) * sizeof(0[t])); \
|
(t) = array_realloc_( (t), array_count(src)); \
|
||||||
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define array_erase(t, i) do { /*may alter ordering*/ \
|
#define array_swapback_and_pop(t, i) do { /*may alter ordering*/ \
|
||||||
memcpy( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
memmove( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
||||||
|
array_pop(t); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define array_erase(t, i) do { \
|
||||||
|
memmove( &(t)[i], &(t)[i + 1], sizeof(0[t])*(array_count(t) - i - 1)); \
|
||||||
array_pop(t); \
|
array_pop(t); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@ vec3 editor_pick(float mouse_x, float mouse_y) {
|
||||||
#else
|
#else
|
||||||
// unproject 2d coord as 3d coord
|
// unproject 2d coord as 3d coord
|
||||||
camera_t *camera = camera_get_active();
|
camera_t *camera = camera_get_active();
|
||||||
float x = (2.0f * mouse_x) / window_width() - 1.0f;
|
vec2 dpi = window_dpi();
|
||||||
float y = 1.0f - (2.0f * mouse_y) / window_height();
|
float x = (2.0f * mouse_x) / (dpi.x * window_width()) - 1.0f;
|
||||||
|
float y = 1.0f - (2.0f * mouse_y) / (dpi.y * window_height());
|
||||||
float z = 1.0f;
|
float z = 1.0f;
|
||||||
vec3 ray_nds = vec3(x, y, z);
|
vec3 ray_nds = vec3(x, y, z);
|
||||||
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
||||||
|
|
|
@ -24995,8 +24995,9 @@ vec3 editor_pick(float mouse_x, float mouse_y) {
|
||||||
#else
|
#else
|
||||||
// unproject 2d coord as 3d coord
|
// unproject 2d coord as 3d coord
|
||||||
camera_t *camera = camera_get_active();
|
camera_t *camera = camera_get_active();
|
||||||
float x = (2.0f * mouse_x) / window_width() - 1.0f;
|
vec2 dpi = window_dpi();
|
||||||
float y = 1.0f - (2.0f * mouse_y) / window_height();
|
float x = (2.0f * mouse_x) / (dpi.x * window_width()) - 1.0f;
|
||||||
|
float y = 1.0f - (2.0f * mouse_y) / (dpi.y * window_height());
|
||||||
float z = 1.0f;
|
float z = 1.0f;
|
||||||
vec3 ray_nds = vec3(x, y, z);
|
vec3 ray_nds = vec3(x, y, z);
|
||||||
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
vec4 ray_clip = vec4(ray_nds.x, ray_nds.y, -1.0, 1.0);
|
||||||
|
|
11
engine/v4k.h
11
engine/v4k.h
|
@ -506,12 +506,17 @@ static __thread unsigned array_n_;
|
||||||
|
|
||||||
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
#define array_copy(t, src) do { /*todo: review old vrealloc call!*/ \
|
||||||
array_free(t); \
|
array_free(t); \
|
||||||
(t) = vrealloc( (t), array_count(src) * sizeof(0[t])); \
|
(t) = array_realloc_( (t), array_count(src)); \
|
||||||
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
memcpy( (t), src, array_count(src) * sizeof(0[t])); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define array_erase(t, i) do { /*may alter ordering*/ \
|
#define array_swapback_and_pop(t, i) do { /*may alter ordering*/ \
|
||||||
memcpy( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
memmove( &(t)[i], &(t)[array_count(t) - 1], sizeof(0[t])); \
|
||||||
|
array_pop(t); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define array_erase(t, i) do { \
|
||||||
|
memmove( &(t)[i], &(t)[i + 1], sizeof(0[t])*(array_count(t) - i - 1)); \
|
||||||
array_pop(t); \
|
array_pop(t); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue