コード例 #1
0
ファイル: VoxelBlock.cs プロジェクト: Michaud1336/OpenCircuit
        public void updateAll(int x, int y, int z, byte detailLevel, VoxelTree control, bool force = false)
        {
            // check if this is a high enough detail level.  If not, call the childrens' update methods
            if (!isRenderSize(control.sizes[detailLevel], control) && (!isRenderLod(x, y, z, control.sizes[detailLevel], control)))
            {
                for (byte xi = 0; xi < CHILD_DIMENSION; ++xi)
                {
                    for (byte yi = 0; yi < CHILD_DIMENSION; ++yi)
                    {
                        for (byte zi = 0; zi < CHILD_DIMENSION; ++zi)
                        {
                            //VoxelUpdateInfo childInfo = new VoxelUpdateInfo(info, xi, yi, zi);
                            if (children[xi, yi, zi].GetType() == typeof(Voxel))
                            {
                                //if (!childInfo.isSolid())
                                children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
                                //else
                                //continue;
                            }
                            UpdateCheckJob job = new UpdateCheckJob((VoxelBlock)children[xi, yi, zi], control, (byte)(detailLevel + 1));
                            job.setOffset((byte)(x * CHILD_DIMENSION + xi), (byte)(y * CHILD_DIMENSION + yi), (byte)(z * CHILD_DIMENSION + zi));
                            control.enqueueCheck(job);
                        }
                    }
                }
                if (renderer != null)
                {
                    //GameObject.Destroy(renderer.ob);
                    //lock (myControl) {
                    //	myControl.enqueueJob(new DropRendererJob(renderer));
                    //	renderer = null;
                    //}
                    renderer.old = true;
                }
                return;
            }

            // check if we already have a mesh
            if (renderer == null)
            {
                //clearSubRenderers();
                renderer = new VoxelRenderer(new VoxelIndex(x, y, z, detailLevel), control);
                //info.renderers[1, 1, 1] = renderer;
            }
            else
            {
                renderer.old = false;
                if (!force)
                {
                    return;
                }
            }

            // We should generate a mesh
            GenMeshJob updateJob = new GenMeshJob(this, control, detailLevel);

            updateJob.setOffset(x, y, z);
            control.enqueueUpdate(updateJob);
        }
コード例 #2
0
        public void updateAll(uint x, uint y, uint z, byte detailLevel, OcTree control, bool force = false)
        {
            // check if this is a high enough detail level.  If not, call the childrens' update methods
            VoxelRenderer renderer = control.getRenderer(new Index(detailLevel, x, y, z));
            if (!isRenderSize(control.sizes[detailLevel], control) && (!isRenderLod(x, y, z, control.sizes[detailLevel], control))) {
                for (byte xi = 0; xi < CHILD_DIMENSION; ++xi) {
                    for (byte yi = 0; yi < CHILD_DIMENSION; ++yi) {
                        for (byte zi = 0; zi < CHILD_DIMENSION; ++zi) {
                            if (children[xi, yi, zi].GetType() == typeof(Voxel)) {
                                children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
                            }
                            UpdateCheckJob job = new UpdateCheckJob((VoxelBlock)children[xi, yi, zi], control, (byte)(detailLevel + 1));
                            job.setOffset((byte)(x * CHILD_DIMENSION + xi), (byte)(y * CHILD_DIMENSION + yi), (byte)(z * CHILD_DIMENSION + zi));
                            control.enqueueCheck(job);
                        }
                    }
                }
                return;
            }

            // check if we already have a mesh
            if (renderer == null) {
                renderer = new VoxelRenderer(new Index(detailLevel, x, y, z), control);
            } else if (!force) {
                return;
            }

            // We should generate a mesh
            GenMeshJob updateJob = new GenMeshJob(this, control, detailLevel);
            updateJob.setOffset(x, y, z);
            control.enqueueUpdate(updateJob);
        }
コード例 #3
0
ファイル: VoxelBlock.cs プロジェクト: AlyDrake/OpenCircuit
		public void updateAll(uint x, uint y, uint z, byte detailLevel, Tree control, bool force = false) {
			// check if this is a high enough detail level.  If not, call the childrens' update methods
			VoxelRenderer renderer = control.getRenderer(new Index(detailLevel, x, y, z));
			if (!isRenderSize(control.sizes[detailLevel], control) && (!isRenderLod(x, y, z, control.sizes[detailLevel], control))) {
				for (byte xi = 0; xi < CHILD_DIMENSION; ++xi) {
					for (byte yi = 0; yi < CHILD_DIMENSION; ++yi) {
						for (byte zi = 0; zi < CHILD_DIMENSION; ++zi) {
							//VoxelUpdateInfo childInfo = new VoxelUpdateInfo(info, xi, yi, zi);
							if (children[xi, yi, zi].GetType() == typeof(Voxel)) {
								//if (!childInfo.isSolid())
								children[xi, yi, zi] = new VoxelBlock((Voxel)children[xi, yi, zi]);
								//else
								//continue;
							}
							UpdateCheckJob job = new UpdateCheckJob((VoxelBlock)children[xi, yi, zi], control, (byte)(detailLevel + 1));
							job.setOffset((byte)(x * CHILD_DIMENSION + xi), (byte)(y * CHILD_DIMENSION + yi), (byte)(z * CHILD_DIMENSION + zi));
							control.enqueueCheck(job);
						}
					}
				}
				if (renderer != null) {
					//GameObject.Destroy(renderer.ob);
					//lock (myControl) {
					//	myControl.enqueueJob(new DropRendererJob(renderer));
					//	renderer = null;
					//}
					renderer.old = true;
				}
				return;
			}

			// check if we already have a mesh
			if (renderer == null) {
				//clearSubRenderers();
				renderer = new VoxelRenderer(new Index(detailLevel, x, y, z), control);
				//info.renderers[1, 1, 1] = renderer;
			} else {
				renderer.old = false;
				if (!force) return;
			}

			// We should generate a mesh
			GenMeshJob updateJob = new GenMeshJob(this, control, detailLevel);
			updateJob.setOffset(x, y, z);
			control.enqueueUpdate(updateJob);
		}