Fix funk texture UV animation (#234)

* fix clock_time to float precision loss
This commit is contained in:
Dethrace Engineering Department 2022-11-13 08:17:06 +13:00 committed by GitHub
parent 4c9795a37b
commit 6c55ba2827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View File

@ -29,15 +29,15 @@ static char _program_name[1024];
static void* stack_traces[MAX_STACK_FRAMES];
#define TRACER_PID_STRING "TracerPid:"
DIR* directory_iterator;
uint32_t first_clock_time = 0;
struct dl_iterate_callback_data {
int initialized;
intptr_t start;
} dethrace_dl_data;
static int dl_iterate_callback(struct dl_phdr_info *info, size_t size, void *data)
{
struct dl_iterate_callback_data *callback_data = data;
static int dl_iterate_callback(struct dl_phdr_info* info, size_t size, void* data) {
struct dl_iterate_callback_data* callback_data = data;
if (strcmp(info->dlpi_name, "") == 0) {
callback_data->start = info->dlpi_addr;
@ -56,7 +56,10 @@ static intptr_t get_dethrace_offset() {
uint32_t OS_GetTime() {
struct timespec spec;
clock_gettime(CLOCK_MONOTONIC, &spec);
return spec.tv_sec * 1000 + spec.tv_nsec / 1000000;
if (first_clock_time == 0) {
first_clock_time = spec.tv_sec * 1000 + spec.tv_nsec / 1000000;
}
return (spec.tv_sec * 1000 + spec.tv_nsec / 1000000) - first_clock_time;
}
void OS_Sleep(int delay_ms) {

View File

@ -25,10 +25,15 @@ static char _program_name[1024];
static void* stack_traces[MAX_STACK_FRAMES];
DIR* directory_iterator;
uint32_t first_clock_time = 0;
uint32_t OS_GetTime() {
struct timespec spec;
clock_gettime(CLOCK_MONOTONIC, &spec);
return spec.tv_sec * 1000 + spec.tv_nsec / 1000000;
if (first_clock_time == 0) {
first_clock_time = spec.tv_sec * 1000 + spec.tv_nsec / 1000000;
}
return (spec.tv_sec * 1000 + spec.tv_nsec / 1000000) - first_clock_time;
}
void OS_Sleep(int delay_ms) {

View File

@ -31,6 +31,8 @@ static int vp_x, vp_y, vp_width, vp_height;
static br_pixelmap* last_shade_table = NULL;
static int dirty_buffers = 0;
tStored_material* current_material;
struct {
GLuint pixels, uv_transform;
GLuint shade_table;
@ -481,7 +483,6 @@ void GLRenderer_BufferModel(br_model* model) {
CHECK_GL_ERROR("after build model");
}
tStored_material* current_material;
void setActiveMaterial(tStored_material* material) {
if (material == NULL || material == current_material) {
return;