Exemplo n.º 1
0
/* planar image map */
color image_plane_texture(vector * hit, texture * tex, ray * ry) {
    vector pnt;
    flt u,v;

    pnt.x=hit->x - tex->ctr.x;
    pnt.y=hit->y - tex->ctr.y;
    pnt.z=hit->z - tex->ctr.z;

    VDOT(u, tex->uaxs, pnt);
    /*  VDOT(len, tex->uaxs, tex->uaxs);
      u = u / sqrt(len); */

    VDOT(v, tex->vaxs, pnt);
    /*  VDOT(len, tex->vaxs, tex->vaxs);
      v = v / sqrt(len); */


    u = u * tex->scale.x;
    u = u + tex->rot.x;
    u = fmod(u, 1.0);
    if (u < 0.0) u += 1.0;

    v = v * tex->scale.y;
    v = v + tex->rot.y;
    v = fmod(v, 1.0);
    if (v < 0.0) v += 1.0;

    return ImageMap((rawimage *)tex->img, u, v);
}
Exemplo n.º 2
0
SpriteManager::SpriteManager(SDL_Color colorKey)
{
	_colorKey = colorKey;

    spriteMap_ = SpriteMap();
    spriteMap_.clear();

    _imageMap = ImageMap();
    _imageMap.clear();

    nextSpriteId_ = 0;
}
Exemplo n.º 3
0
SpriteManager::SpriteManager()
{
	_colorKey.r = 0x00;
	_colorKey.g = 0xFF;
	_colorKey.b = 0xFF;

  spriteMap_ = SpriteMap();
  spriteMap_.clear();

  _imageMap = ImageMap();
  _imageMap.clear();

  nextSpriteId_ = 0;
}
Exemplo n.º 4
0
/* cylindrical image map */
color image_cyl_texture(vector * hit, texture * tex, ray * ry) {
    vector rh;
    flt u,v;

    rh.x=hit->x - tex->ctr.x;
    rh.z=hit->y - tex->ctr.y;
    rh.y=hit->z - tex->ctr.z;

    xyztocyl(rh, 1.0, &u, &v);

    u = u * tex->scale.x;
    u = u + tex->rot.x;
    u=fmod(u, 1.0);
    if (u < 0.0) u+=1.0;

    v = v * tex->scale.y;
    v = v + tex->rot.y;
    v=fmod(v, 1.0);
    if (v < 0.0) v+=1.0;

    return ImageMap((rawimage *)tex->img, u, v);
}