Tachyon (current)  Current Main Branch
Data Structures | Macros | Functions
util.c File Reference

Tachyon cross-platform timers, special math function wrappers, and RNGs. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "tachyon.h"
#include "macros.h"
#include "util.h"
#include "parallel.h"
#include "ui.h"

Go to the source code of this file.

Data Structures

struct  rt_timer
 

Macros

#define TACHYON_INTERNAL   1
 
#define STDTIME
 

Functions

void rt_finalize (void)
 Shut down Tachyon library for good, at final use before program termination. More...
 
void rt_timer_start (rt_timerhandle v)
 
void rt_timer_stop (rt_timerhandle v)
 
double rt_timer_time (rt_timerhandle v)
 
rt_timerhandle rt_timer_create (void)
 
void rt_timer_destroy (rt_timerhandle v)
 
double rt_timer_timenow (rt_timerhandle v)
 
unsigned int rt_rand (unsigned int *idum)
 
void rng_urand_init (rng_urand_handle *rngh)
 
void rng_urand_seed (rng_urand_handle *rngh, unsigned int seed)
 
unsigned int rng_urand (rng_urand_handle *rngh)
 
void rng_frand_init (rng_frand_handle *rngh)
 
float rng_frand (rng_frand_handle *rngh)
 
void rng_frand_seed (rng_frand_handle *rngh, unsigned int seed)
 
void rng_drand_init (rng_drand_handle *rngh)
 
double rng_drand (rng_frand_handle *rngh)
 
void rng_drand_seed (rng_frand_handle *rngh, unsigned int seed)
 
unsigned int rng_seed_from_tid_nodeid (int tid, int node)
 
unsigned int tea2 (unsigned int v0, unsigned int v1)
 
unsigned int tea4 (unsigned int v0, unsigned int v1)
 
double compute_goldenratio_phi (int dim)
 
float goldenratioseq1d (int n)
 
void goldenratioseq1d_incr (float *x)
 
void goldenratioseq2d (int n, float *x, float *y)
 
void goldenratioseq2d_incr (float *x, float *y)
 
void goldenratioseq3d (int n, float *x, float *y, float *z)
 
void goldenratioseq3d_incr (float *x, float *y, float *z)
 
void jitter_offset2f (unsigned int *pval, float *xy)
 
void jitter_disc2f (unsigned int *pval, float *dir)
 
void jitter_sphere3f (rng_frand_handle *rngh, float *dir)
 

Detailed Description

Tachyon cross-platform timers, special math function wrappers, and RNGs.

Definition in file util.c.

Macro Definition Documentation

◆ STDTIME

#define STDTIME

Definition at line 47 of file util.c.

◆ TACHYON_INTERNAL

#define TACHYON_INTERNAL   1

Definition at line 26 of file util.c.

Function Documentation

◆ compute_goldenratio_phi()

double compute_goldenratio_phi ( int  dim)

Definition at line 646 of file util.c.

◆ goldenratioseq1d()

float goldenratioseq1d ( int  n)

Definition at line 658 of file util.c.

◆ goldenratioseq1d_incr()

void goldenratioseq1d_incr ( float *  x)

Definition at line 668 of file util.c.

◆ goldenratioseq2d()

void goldenratioseq2d ( int  n,
float *  x,
float *  y 
)

Definition at line 677 of file util.c.

◆ goldenratioseq2d_incr()

void goldenratioseq2d_incr ( float *  x,
float *  y 
)

Definition at line 692 of file util.c.

◆ goldenratioseq3d()

void goldenratioseq3d ( int  n,
float *  x,
float *  y,
float *  z 
)

Definition at line 707 of file util.c.

◆ goldenratioseq3d_incr()

void goldenratioseq3d_incr ( float *  x,
float *  y,
float *  z 
)

Definition at line 726 of file util.c.

◆ jitter_disc2f()

void jitter_disc2f ( unsigned int *  pval,
float *  dir 
)

Definition at line 758 of file util.c.

References COS, rt_rand(), RT_RAND_MAX_INV, SIN, and SQRT.

◆ jitter_offset2f()

void jitter_offset2f ( unsigned int *  pval,
float *  xy 
)

Definition at line 751 of file util.c.

References rt_rand(), and RT_RAND_MAX_INV.

◆ jitter_sphere3f()

void jitter_sphere3f ( rng_frand_handle rngh,
float *  dir 
)

Definition at line 779 of file util.c.

References rng_frand().

Referenced by shade_ambient_occlusion().

◆ rng_drand()

double rng_drand ( rng_frand_handle rngh)

Definition at line 572 of file util.c.

References rng_urand(), and RT_RNG_MAX.

◆ rng_drand_init()

void rng_drand_init ( rng_drand_handle rngh)

Definition at line 568 of file util.c.

References rng_urand_init().

◆ rng_drand_seed()

void rng_drand_seed ( rng_frand_handle rngh,
unsigned int  seed 
)

Definition at line 576 of file util.c.

References rng_urand_seed().

◆ rng_frand()

float rng_frand ( rng_frand_handle rngh)

Definition at line 560 of file util.c.

References rng_urand(), and RT_RNG_MAX.

Referenced by jitter_sphere3f().

◆ rng_frand_init()

void rng_frand_init ( rng_frand_handle rngh)

Definition at line 556 of file util.c.

References rng_urand_init().

Referenced by camray_init().

◆ rng_frand_seed()

void rng_frand_seed ( rng_frand_handle rngh,
unsigned int  seed 
)

Definition at line 564 of file util.c.

References rng_urand_seed().

Referenced by camray_init().

◆ rng_seed_from_tid_nodeid()

unsigned int rng_seed_from_tid_nodeid ( int  tid,
int  node 
)

Definition at line 583 of file util.c.

◆ rng_urand()

unsigned int rng_urand ( rng_urand_handle rngh)

◆ rng_urand_init()

void rng_urand_init ( rng_urand_handle rngh)

◆ rng_urand_seed()

void rng_urand_seed ( rng_urand_handle rngh,
unsigned int  seed 
)

◆ rt_finalize()

void rt_finalize ( void  )

Shut down Tachyon library for good, at final use before program termination.

Tachyon may not be used after rt_finalize has been called.

Definition at line 153 of file api.c.

References FreeTextures(), global_parhnd, and rt_par_finish().

Referenced by animate_scene(), fly_scene(), and main().

◆ rt_rand()

unsigned int rt_rand ( unsigned int *  idum)

◆ rt_timer_create()

rt_timerhandle rt_timer_create ( void  )

Definition at line 226 of file util.c.

Referenced by animate_scene(), fly_scene(), main(), rendercheck(), renderio(), and renderscene().

◆ rt_timer_destroy()

void rt_timer_destroy ( rt_timerhandle  v)

Definition at line 233 of file util.c.

Referenced by animate_scene(), fly_scene(), main(), rendercheck(), renderio(), and renderscene().

◆ rt_timer_start()

void rt_timer_start ( rt_timerhandle  v)

Definition at line 168 of file util.c.

References rt_timer::tz.

Referenced by animate_scene(), fly_scene(), main(), rendercheck(), renderio(), and renderscene().

◆ rt_timer_stop()

void rt_timer_stop ( rt_timerhandle  v)

◆ rt_timer_time()

double rt_timer_time ( rt_timerhandle  v)

Definition at line 186 of file util.c.

References rt_timer::endtime.

Referenced by animate_scene(), fly_scene(), main(), rendercheck(), renderio(), renderscene(), and rt_timer_timenow().

◆ rt_timer_timenow()

double rt_timer_timenow ( rt_timerhandle  v)

Definition at line 237 of file util.c.

References rt_timer_stop(), and rt_timer_time().

◆ tea2()

unsigned int tea2 ( unsigned int  v0,
unsigned int  v1 
)

Definition at line 614 of file util.c.

◆ tea4()

unsigned int tea4 ( unsigned int  v0,
unsigned int  v1 
)