/* * 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; }
static void Init() { canvas = NewPixBuf(PIXBUF_CLUT, WIDTH, HEIGHT); uvmap = NewUVMap(WIDTH, HEIGHT, UV_FAST, 256, 256); UVMapGenerate2(uvmap); UVMapSetTexture(uvmap, texture); orig = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); PixBufBlit(orig, 0, 0, NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u), NULL); scene = NewScene(); SceneAddObject(scene, NewSceneObject("Object", mesh)); shades = NewPixBuf(PIXBUF_GRAY, WIDTH, HEIGHT); InitDisplay(WIDTH, HEIGHT, DEPTH); LoadPalette(texturePal); }