Example #1
0
animated_object* animated_object_new() {

  animated_object* ao = malloc(sizeof(animated_object));
  ao->position = vec3_zero();
  ao->scale = vec3_one();
  ao->rotation = quat_id();
  
  ao->renderable = asset_hndl_null();
  ao->skeleton = asset_hndl_null();
  ao->animation = asset_hndl_null();
  ao->animation_time = 0;
  
  ao->pose = NULL;
  
  return ao;
}
Example #2
0
animated_object* animated_object_new() {

  animated_object* ao = malloc(sizeof(animated_object));
  ao->position = vec3_zero();
  ao->scale = vec3_one();
  ao->rotation = quaternion_id();
  
  ao->active = true;
  ao->recieve_shadows = true;
  ao->cast_shadows = true;
  
  ao->renderable = asset_hndl_null();
  ao->skeleton = asset_hndl_null();
  ao->animation = asset_hndl_null();
  ao->animation_time = 0;
  
  ao->pose = NULL;
  
  return ao;
}
Example #3
0
collision ellipsoid_collide_mesh(ellipsoid e, vec3 v, cmesh* m, mat4 world, mat3 world_normal) {
  
  world.xw -= e.center.x;
  world.yw -= e.center.y;
  world.zw -= e.center.z;
  
  mat3 space     = mat3_scale(vec3_div_vec3(vec3_one(), e.radiuses));
  mat3 space_inv = mat3_scale(e.radiuses);
  
  v = mat3_mul_vec3(space, v);
  
  collision c = sphere_collide_mesh_space(sphere_unit(), v, m, world, world_normal, space, mat3_transpose(space_inv));
  
  c.point = mat3_mul_vec3(space_inv, c.point);
  c.point = vec3_add(c.point, e.center);

  c.norm = vec3_normalize(mat3_mul_vec3(space, c.norm));
  
  return c;
  
}