/// <summary> /// Runs through all levels and creates the parameters that are required to /// produce all images for each level, and starts the conversion /// </summary> private void CreatePyramid() { // The resolution of the image has to be n*2+1 to grid size in x3dom int meshDim = Convert.ToInt32(meshDimension.Text) * 2 + 1; double factor = 1.0; // List of nodes that is only required for tree extraction ArrayList nodes = new ArrayList(); // Creates the coordinates on the image of the output size of all nodes UV[,] VertexData = createVertexData(meshDim); int entireTiles = 0; int currentTiles = 0; TreeTileData rootTreeTileData = null; // Calculation of the count of all tiles that should be produced in all levels for (int count = 0; count <= Convert.ToDouble(qtDepth.Text); count++) { entireTiles += (int)Math.Pow(4, count); } TreeTileData[] treeTileData = null; // Only required for tree output if (datasetFormat.Text == "tree") { treeTileData = new TreeTileData[entireTiles]; rootTreeTileData = new TreeTileData(Convert.ToInt32(qtDepth.Text), storingPath.Text, 0, 0, 0, 1, treeTileData); } // Convertion of all nodes of all levels for (double level = 0.0; level <= Convert.ToDouble(qtDepth.Text); level++) { int quadNumber = 0; int rowCount = (int)Math.Sqrt(Math.Pow(4.0, level)); double step = 1.0 / (double)((double)rowCount); double xStep = 0.0, yStep = 0.0; // Convertion of all nodes of the current level for (int y = 0; y < rowCount; y++) { for (int x = 0; x < rowCount; x++) { OutputNode node = new OutputNode(xStep, yStep, factor, (int)level, quadNumber, VertexData, image, new Bitmap(meshDim, meshDim, System.Drawing.Imaging.PixelFormat.Format32bppArgb), storingPath.Text, convertingType.Text, x, y, treeTileData); node.CreateImage(); // Refresh the progress currentTiles++; convertState.Value = (int)Math.Floor((double)currentTiles / ((double)entireTiles / 100.0)); quadNumber++; xStep += step; // Refresh the form convertState.Refresh(); this.Refresh(); Application.DoEvents(); } xStep = 0.0; yStep += step; } yStep = 0.0; factor /= 2; } // final message MessageBox.Show("The convertion has been finished successfully! \n " + "Please use the following configuration and replace all [] " + "through right pathes etc. (all settings with '*' are only " + "required if mode=3D): \n------------------------------------" + "---------------------------------------\n\n" + "<BVHRefiner maxDepth='" + qtDepth.Text + "'" + "\n\t minDepth='[0.." + qtDepth.Text + "]'" + "\n\t interactionDepth='[0.." + qtDepth.Text + "]'" + "\n\t smoothLoading='5'" + "\n\t subdivision='" + meshDimension.Text + " " + meshDimension.Text + "'" + "\n\t size='" + image.Width + " " + image.Width + "'" + "\n\t factor='10'" + "\n\t maxElevation='[0..n]'" + "\n\t elevationUrl='[path to elevation data]*'" + "\n\t textureUrl='[path to texture data]'" + "\n\t normalUrl='[path to normal data]*'" + "\n\t elevationFormat='[png]*'" + "\n\t textureFormat='[jpg, png, gif]'" + "\n\t normalFormat='[jpg, png, gif]*'" + "\n\t mode='[2D, 3D, bin, bvh]'>" + "\n</BVHRefiner>\n\n" + "The node is copied to clipboard automatically. Please insert in HTML with " + "'Ctrl + V'.", "Result message", MessageBoxButtons.OK, MessageBoxIcon.Information); convertState.Value = 0; // copy the node definition to clipboard String clipboardMessage = "<BVHRefiner maxDepth='" + qtDepth.Text + "'" + "\n\t minDepth='[0.." + qtDepth.Text + "]'" + "\n\t interactionDepth='[0.." + qtDepth.Text + "]'" + "\n\t smoothLoading='5'" + "\n\t subdivision='" + meshDimension.Text + " " + meshDimension.Text + "'" + "\n\t size='" + image.Width + " " + image.Width + "'" + "\n\t factor='10'" + "\n\t maxElevation='[0..n]'" + "\n\t elevationUrl='[path to elevation data]*'" + "\n\t textureUrl='[path to texture data]'" + "\n\t normalUrl='[path to normal data]*'" + "\n\t elevationFormat='[png]*'" + "\n\t textureFormat='[jpg, png, gif]'" + "\n\t normalFormat='[jpg, png, gif]*'" + "\n\t mode='[2D, 3D, bin, bvh]'>" + "\n</BVHRefiner>"; Clipboard.SetText(clipboardMessage); }
/// <summary> /// Runs through all levels and creates the parameters that are required to /// produce all images for each level, and starts the conversion /// </summary> private void CreatePyramid() { // The resolution of the image has to be n*2+1 to grid size in x3dom int meshDim = Convert.ToInt32(meshDimension.Text) * 2 + 1; double factor = 1.0; // List of nodes that is only required for tree extraction ArrayList nodes = new ArrayList(); // Creates the coordinates on the image of the output size of all nodes UV[,] VertexData = createVertexData(meshDim); int entireTiles = 0; int currentTiles = 0; TreeTileData rootTreeTileData = null; // Calculation of the count of all tiles that should be produced in all levels for (int count = 0; count <= Convert.ToDouble(qtDepth.Text); count++) { entireTiles += (int)Math.Pow(4, count); } TreeTileData[] treeTileData = null; // Only required for tree output if (datasetFormat.Text == "tree") { treeTileData = new TreeTileData[entireTiles]; rootTreeTileData = new TreeTileData(Convert.ToInt32(qtDepth.Text),storingPath.Text, 0, 0, 0, 1, treeTileData); } // Convertion of all nodes of all levels for (double level = 0.0; level <= Convert.ToDouble(qtDepth.Text); level++) { int quadNumber = 0; int rowCount = (int)Math.Sqrt(Math.Pow(4.0, level)); double step = 1.0 / (double)((double) rowCount); double xStep = 0.0, yStep = 0.0; // Convertion of all nodes of the current level for (int y = 0; y < rowCount; y++) { for (int x = 0; x < rowCount; x++) { OutputNode node = new OutputNode(xStep, yStep, factor, (int)level, quadNumber, VertexData,image, new Bitmap(meshDim, meshDim, System.Drawing.Imaging.PixelFormat.Format32bppArgb), storingPath.Text, convertingType.Text, x, y, treeTileData); node.CreateImage(); // Refresh the progress currentTiles++; convertState.Value = (int)Math.Floor((double)currentTiles / ((double)entireTiles / 100.0)); quadNumber++; xStep += step; // Refresh the form convertState.Refresh(); this.Refresh(); Application.DoEvents(); } xStep = 0.0; yStep += step; } yStep = 0.0; factor /= 2; } // final message MessageBox.Show("The convertion has been finished successfully! \n " + "Please use the following configuration and replace all [] " + "through right pathes etc. (all settings with '*' are only " + "required if mode=3D): \n------------------------------------" + "---------------------------------------\n\n" + "<BVHRefiner maxDepth='" + qtDepth.Text + "'" + "\n\t minDepth='[0.." + qtDepth.Text + "]'" + "\n\t interactionDepth='[0.." + qtDepth.Text + "]'" + "\n\t smoothLoading='5'" + "\n\t subdivision='" + meshDimension.Text + " " + meshDimension.Text + "'" + "\n\t size='" + image.Width + " " + image.Width + "'" + "\n\t factor='10'" + "\n\t maxElevation='[0..n]'" + "\n\t elevationUrl='[path to elevation data]*'" + "\n\t textureUrl='[path to texture data]'" + "\n\t normalUrl='[path to normal data]*'" + "\n\t elevationFormat='[png]*'" + "\n\t textureFormat='[jpg, png, gif]'" + "\n\t normalFormat='[jpg, png, gif]*'" + "\n\t mode='[2D, 3D, bin, bvh]'>" + "\n</BVHRefiner>\n\n" + "The node is copied to clipboard automatically. Please insert in HTML with " + "'Ctrl + V'.", "Result message", MessageBoxButtons.OK, MessageBoxIcon.Information); convertState.Value = 0; // copy the node definition to clipboard String clipboardMessage = "<BVHRefiner maxDepth='" + qtDepth.Text + "'" + "\n\t minDepth='[0.." + qtDepth.Text + "]'" + "\n\t interactionDepth='[0.." + qtDepth.Text + "]'" + "\n\t smoothLoading='5'" + "\n\t subdivision='" + meshDimension.Text + " " + meshDimension.Text + "'" + "\n\t size='" + image.Width + " " + image.Width + "'" + "\n\t factor='10'" + "\n\t maxElevation='[0..n]'" + "\n\t elevationUrl='[path to elevation data]*'" + "\n\t textureUrl='[path to texture data]'" + "\n\t normalUrl='[path to normal data]*'" + "\n\t elevationFormat='[png]*'" + "\n\t textureFormat='[jpg, png, gif]'" + "\n\t normalFormat='[jpg, png, gif]*'" + "\n\t mode='[2D, 3D, bin, bvh]'>" + "\n</BVHRefiner>"; Clipboard.SetText(clipboardMessage); }