コード例 #1
0
ファイル: colormap.c プロジェクト: cahirwpz/demoscene
static void Render(int frameNumber) {
  int change = (frameNumber * 2) % 256;

  switch (effect) {
    case 0:
      PROFILE(PixBufCopy)
        PixBufCopy(canvas, image);
      PROFILE(PixBufAddAndClamp)
        PixBufAddAndClamp(shade, map[0], change);
      PixBufSetColorMap(shade, lighten);
      PixBufSetBlitMode(shade, BLIT_COLOR_MAP);
      PROFILE(PixBufBlit)
        PixBufBlit(canvas, 0, 0, shade, NULL);
      break;

    case 1:
      PROFILE(PixBufCopy)
        PixBufCopy(canvas, image);
      PROFILE(PixBufAddAndClamp)
        PixBufAddAndClamp(shade, map[0], change - 64);
      PixBufSetColorMap(shade, darken);
      PixBufSetBlitMode(shade, BLIT_COLOR_MAP);
      PROFILE(PixBufBlit)
        PixBufBlit(canvas, 0, 0, shade, NULL);
      break;

    case 2:
      PROFILE(PixBufCopy)
        PixBufCopy(canvas, image);
      PROFILE(PixBufAddAndClamp)
        PixBufAddAndClamp(shade, map[1], change - 64);
      PixBufSetColorMap(shade, lighten);
      PixBufSetBlitMode(shade, BLIT_COLOR_MAP);
      PROFILE(PixBufBlit)
        PixBufBlit(canvas, 0, 0, shade, NULL);
      break;

    case 3:
      PROFILE(PixBufCopy)
        PixBufCopy(canvas, image);
      PROFILE(PixBufAddAndClamp)
        PixBufAddAndClamp(shade, map[1], change - 64);
      PixBufSetColorMap(shade, darken);
      PixBufSetBlitMode(shade, BLIT_COLOR_MAP);
      PROFILE(PixBufBlit)
        PixBufBlit(canvas, 0, 0, shade, NULL);
      break;

    default:
      break;
  }

  c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}
コード例 #2
0
ファイル: flat-shading.c プロジェクト: cahirwpz/demoscene
static void Render(int frameNumber) {
  PixBufT *umap;

  int du = 2 * frameNumber;
  int dv = 4 * frameNumber;

  {
    MatrixStack3D *ms = GetObjectTranslation(scene, "Object");

    StackReset(ms);
    PushScaling3D(ms, 1.25f, 1.25f, 1.25f);
    PushRotation3D(ms, 0, (float)(-frameNumber * 2), frameNumber);
    PushTranslation3D(ms, 0.0f, 0.0f, -2.0f);
  }

  if (effectNum == 0) {
    umap = NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u);

    PROFILE(PixBufClear)
      PixBufClear(shades);
    PROFILE(RenderScene)
      RenderScene(scene, shades);

    PixBufSetBlitMode(shades, BLIT_ADDITIVE);
    PixBufBlit(umap, 0, 0, orig, NULL);
    PixBufBlit(umap, 0, 0, shades, NULL);

    UVMapSetOffset(uvmap, du, dv);
    UVMapRender(uvmap, canvas);

    MemUnref(umap);
  } else {
    UVMapSetOffset(uvmap, du, dv);
    UVMapRender(uvmap, canvas);

    PROFILE(PixBufClear)
      PixBufClear(shades);
    PROFILE(RenderScene)
      RenderScene(scene, shades);

    PixBufSetColorMap(shades, colorMap);
    PixBufSetBlitMode(shades, BLIT_COLOR_MAP);

    PixBufBlit(canvas, 0, 0, shades, NULL);
  }

  c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}
コード例 #3
0
ファイル: uvmap-blit.c プロジェクト: cahirwpz/demoscene
static void Render(int frameNumber) {
  PixBufT *umap;

  int du = frameNumber;
  int dv = 2 * frameNumber;
  int i;

  umap = NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u);

  UVMapSetOffset(uvmap, du, dv);
  PixBufBlit(umap, 0, 0, origU, NULL);

  for (i = 0; i < 8; i++) {
    PixBufSetBlitMode(flare, BLIT_ADDITIVE);
    PixBufBlit(umap, 
               (int)(128.0f + sin(-frameNumber * M_PI / 45.0f + M_PI * i / 4) * 80.0f), 
               (int)(96.0f + cos(-frameNumber * M_PI / 45.0f + M_PI * i / 4) * 48.0f),
               flare, NULL);
  }

  UVMapRender(uvmap, canvas);

  c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);

  MemUnref(umap);
}
コード例 #4
0
ファイル: uvmap-light.c プロジェクト: argasek/morphine
/*
 * Effect rendering functions.
 */
void RenderEffect(int frameNumber) {
  PixBufT *canvas = R_("Canvas");
  UVMapT *uvmap = R_("Map");
  PixBufT *comp = R_("Component");
  PixBufT *shades = R_("Shades");
  uint8_t *cfunc = R_("ColFunc");

  int du = 2 * frameNumber;
  int dv = 4 * frameNumber;

  {
    int i;

    for (i = 0; i < 256; i++) {
      uint8_t v = i + du;

      if (v >= 128)
        cfunc[i] = ~v * 2;
      else 
        cfunc[i] = v * 2;
    }
  }

  PixBufSetBlitMode(comp, BLIT_COLOR_FUNC);
  PixBufSetColorFunc(comp, cfunc);
  PROFILE (PixBufBlitWithColorFunc)
    PixBufBlit(shades, 0, 0, comp, NULL);

  UVMapSetOffset(uvmap, du, dv);
  PROFILE (UVMapRenderFast)
    UVMapRender(uvmap, canvas);

  c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}
コード例 #5
0
ファイル: raytunnel.c プロジェクト: cahirwpz/demoscene
static void Render(int frameNumber) {
  RaycastCalculateView(frameNumber);

  PROFILE(RaycastTunnel)
    RaycastTunnel(smallMap, CameraView.Transformed);

  PROFILE (UVMapScale8x)
    UVMapScale8x(uvmap, smallMap);

  UVMapSetTexture(uvmap, texture);
  UVMapSetOffset(uvmap, 0, frameNumber);

  PROFILE (UVMapRender)
    UVMapRender(uvmap, canvas);

  PROFILE (RenderShadeMap)
    RenderShadeMap(shades, uvmap->map.normal.v);

  PixBufSetColorMap(shades, colorMap);
  PixBufSetBlitMode(shades, BLIT_COLOR_MAP);

  PROFILE (BlitShadeMap)
    PixBufBlit(canvas, 0, 0, shades, NULL);

  PROFILE (ChunkyToPlanar)
    c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}
コード例 #6
0
ファイル: uvmap-light.c プロジェクト: cahirwpz/demoscene
static void Render(int frameNumber) {
  int du = 2 * frameNumber;
  int dv = 4 * frameNumber;

  {
    int i;

    for (i = 0; i < 256; i++) {
      uint8_t v = i + du;

      if (v >= 128)
        colorFunc[i] = ~v * 2;
      else 
        colorFunc[i] = v * 2;
    }
  }

  PixBufSetBlitMode(component, BLIT_COLOR_FUNC);
  PixBufSetColorFunc(component, colorFunc);
  PROFILE (PixBufBlitWithColorFunc)
    PixBufBlit(shades, 0, 0, component, NULL);

  UVMapSetOffset(uvmap, du, dv);
  PROFILE (UVMapRenderFast)
    UVMapRender(uvmap, canvas);

  c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}