//オブジェクトを追加 public void AddFill(Object3D o) { bool flug = false; foreach (Cube c in o.cube) if (c.center.X == (1.0f + 2.0f * (float)dx) && c.center.Y == (1.0f + 2.0f * (float)dy) && c.center.Z == (-1.0f + 2.0f * floar)) { flug = true; break; } if (!flug) { o.CreateCube(2); o.cube[o.cube.Count - 1].SetCube(1.0f + 2.0f * (float)dx, 1.0f + 2.0f * (float)dy, -1.0f + 2.0f * floar); AddFloar(); if (dx <= GRIDNUM / 2 && dx >= -GRIDNUM / 2 && dy >= -GRIDNUM / 2 && dy <= GRIDNUM / 2) { On[floar - 1][dx + GRIDNUM / 2, dy + GRIDNUM / 2] = true; Onbr[floar - 1][dx + GRIDNUM / 2, dy + GRIDNUM / 2] = nowbrush; } } }
public Drawing3DViewForm() { InitializeComponent(); camera = new Camera(); grid3D = new Grid3D(); grid2D = new Grid2D(); objects = new Object3D(); isClicked_pb1 = false; isClicked_pb2 = false; isAdd = true; isDelete = false; camera.SetLookatPoint(0.0f, 0.0f, 0.0f); camera.SetAspect(this.pictureBox1.Width, this.pictureBox1.Height); }
//指定された描画オブジェクトを削除 public void DeleteFill(Object3D o) { bool flug = false; int i; for (i = 0; i < o.cube.Count; i++) { if (o.cube[i].center.X == (1.0f + 2.0f * (float)dx) && o.cube[i].center.Y == (1.0f + 2.0f * (float)dy) && o.cube[i].center.Z == (-1.0f + 2.0f * floar)) { flug = true; break; } } if (flug) { o.RemoveCube(i); On[floar - 1][dx + GRIDNUM / 2, dy + GRIDNUM / 2] = false; } }