public void render(PGraphics g) { if (parent != null) rot = PApplet.lerp(rot, parent.rot, 0.25f); g.rotate(rot); g.textSize(txtSize); g.text(txt, 0, 0); g.translate(g.textWidth(txt) * kerning, 0); for (int i = 0; i < children.size(); i++) children.get(i).render(g); }
// mualimo kuutio kerrallaan void draw(PGraphics pa) { pa.pushMatrix(); for (int z = 0; z < size; z++) { for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { dobox(pa, x, y, z); } } } pa.popMatrix(); }
// piirrä kuutio jos sen väri on jotain muuta kun 0. void dobox(PGraphics pa, int x, int y, int z, int color) { int colo = color != 0 ? color : (map[size * size * z + size * y + x] == 0 ? 0 : 0xffffffff); if (colo == 0) return; // colo = (colo & 0xffffff) | 0x7f000000; pa.pushMatrix(); pa.translate(x, y, z); pa.fill(colo); pa.texture(boxtex); // TexCube t = new TexCube(); tcube.draw(pa, color == 0 ? boxtex : null, 0.5f); pa.popMatrix(); }