Esempio n. 1
0
/*
 * Set up resources.
 */
void AddInitialResources() {
  ResAdd("Canvas", NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT));
  ResAdd("Scene", NewScene());
#if 0
  ResAdd("Mesh", NewMeshFromFile("data/shattered_ball.robj"));
  ResAdd("ColorMap", NewPixBufFromFile("data/shattered_ball_cmap.8"));
  ResAddPngImage("ColorMap", "Palette", "data/wecan_logo_cmap.png");
  ResAdd("Palette", NewPaletteFromFile("data/shattered_ball_cmap.pal"));
#else
  ResAdd("Mesh", NewMeshFromFile("data/wecan_logo.robj"));
#endif

  {
    MeshT *mesh = R_("Mesh");

    CalculateSurfaceNormals(mesh);
    NormalizeMeshSize(mesh);
    MeshApplyPalette(mesh, R_("Palette"));
  }

  SceneAddObject(R_("Scene"), NewSceneObject("Object", R_("Mesh")));

  RenderMode = RENDER_GOURAUD_SHADING;
  RenderAllFaces = false;
}
Esempio n. 2
0
static void Load() {
  LoadPngImage(&texture, &texturePal, "data/texture-shades.png");
  LoadPngImage(&colorMap, NULL, "data/texture-shades-map.png");
  mesh = NewMeshFromFile("data/shattered_ball.robj");

  CenterMeshPosition(mesh);
  CalculateSurfaceNormals(mesh);
  NormalizeMeshSize(mesh);

  RenderAllFaces = false;
  RenderMode = RENDER_FLAT_SHADING;
}