Ejemplo n.º 1
0
void
plAttachParticleSystem3f(PLparticles *ps, PLobject *obj, float x, float y, float z)
{
  assert(ps != NULL);
  assert(obj != NULL);
  assert(ps->obj == NULL);
  obj_array_push(&obj->psystem, ps);
  ps->obj = obj;
  if (obj->parent) {
    obj_array_push(&obj->parent->sys->world->partSys, ps);
  } else {
    obj_array_push(&obj->sys->world->partSys, ps);
  }
  ps->p = vf3_set(x, y, z);
}
Ejemplo n.º 2
0
void
sgSceneAddObj(SGscene *sc, SGdrawable *object)
{
  assert(sc != NULL);
  assert(object != NULL);

  object->scene = sc;
  obj_array_push(&sc->objs, object);
}
Ejemplo n.º 3
0
pl_astrobody_t*
pl_new_obj_in_sys(pl_system_t *sys, const char *name, double m, double gm,
              lwcoord_t *coord, quaternion_t q, double siderealPeriod, double obliquity,
              double radius, double flattening)
{
  pl_astrobody_t *obj = pl_new_obj(sys->world, name, m, gm, coord,
                              q, siderealPeriod, obliquity,
                              radius, flattening);
  obj->sys = sys;

  obj_array_push(&sys->astroObjs, obj);
  return obj;
}
Ejemplo n.º 4
0
void
pl_collcontext_insert_object(pl_collisioncontext_t *ctxt, pl_recgrid_t *grid, pl_object_t *obj)
{
  int octant = getoctant(&grid->centre, obj);
  if (grid->children[octant] && fits(grid->children[octant], obj)){
    pl_collcontext_insert_object(ctxt, grid->children[octant], obj);
  } else {
    obj_array_push(&grid->objs, obj);
  }

  if (grid->objs.length > THRESHOLD) {
    split(ctxt, grid);
  }
}
Ejemplo n.º 5
0
void
plInsertObject(PLcollisioncontext *ctxt, PLrecgrid *grid, PLobject *obj)
{
  int octant = getoctant(&grid->centre, obj);
  if (grid->children[octant] && fits(grid->children[octant], obj)){
    plInsertObject(ctxt, grid->children[octant], obj);
  } else {
    obj_array_push(&grid->objs, obj);
  }

  if (grid->objs.length > THRESHOLD) {
    split(ctxt, grid);
  }
}
Ejemplo n.º 6
0
SGscene*
sgNewScene(SGscenegraph *sg, const char *name)
{
  assert(name != NULL);

  SGscene *sc = malloc(sizeof(SGscene));
  sc->name = strdup(name);

  sc->amb[0] = 0.2;
  sc->amb[1] = 0.2;
  sc->amb[2] = 0.2;
  sc->amb[3] = 1.0;

  sc->sg = sg;
  sc->lights = calloc(sg->maxLights, sizeof(SGlight*));

  obj_array_init(&sc->objs);
  obj_array_push(&sg->scenes, sc);

  return sc;
}
Ejemplo n.º 7
0
pl_system_t*
pl_new_sub_orbit(pl_system_t *parent, const char *name,
              double m, double gm,
              double orbitPeriod, double obliquity, double siderealPeriod,
              double semiMaj, double semiMin,
              double inc, double ascendingNode, double argOfPeriapsis,
              double meanAnomaly,
              double eqRadius, double flattening)
{
  assert(parent);
  assert(parent->world);

  pl_system_t * sys = pl_new_orbital_object(parent->world,
                                         name, m, gm, orbitPeriod, obliquity, siderealPeriod,
                                         semiMaj, semiMin,
                                         inc, ascendingNode, argOfPeriapsis, meanAnomaly,
                                         eqRadius, flattening);
  sys->parent = parent;
  obj_array_push(&parent->orbits, sys);
  pl_sys_set_current_pos(sys);

  return sys;
}
Ejemplo n.º 8
0
void
sgAddOverlay(SGscenegraph *sg, SGoverlay *overlay)
{
  obj_array_push(&sg->overlays, overlay);
}