Beispiel #1
0
int	init(int argc, char** argv, t_env* env)
{
	id_memset(env, 0, sizeof(*env));
	if (argc != 4)
		return (id_error("id_rt width height fileToLoad"));
	env->width = id_atoi(argv[1]);
	env->height = id_atoi(argv[2]);
	if (env->height <= 0 || env->width <= 0)
		return (id_error("width and height should be over 0"));
	if (init_input(env, argv[3]))
		return (-1);
	env->screen = idx_init("Raytracing", env->width,
			       env->height);
	if (env->screen == NULL)
		return (-1);
	env->pixels = malloc(sizeof(*env->pixels) * (env->width * env->height));
	if (!env->pixels)
		return (-1);
	if (build_thread(env))
		return (-1);
	env->global_work = 0;
	env->scale = (((env->width * env->height) / 10) * (ANTIALIASING / 2)) * 2;
	env->current_work = 0;
	return (0);
}
Beispiel #2
0
void cttest_idx_get()
{
	struct idx _idx;
	idx_init(&_idx,10000);
	idx_set(&_idx,"ab",100UL);
	idx_set(&_idx,"cd",5000000000UL);
	uint64_t  ret=idx_get(&_idx,"ab");
	assert(ret == 100UL);
}
Beispiel #3
0
void cttest_idx_init()
{
	struct idx _idx;
	idx_init(&_idx,10000);
	assert(0 == 0);
}