RealTime
1//! Left click and drag to rotate. Also Hold shift to translate. //2//! Mouse Wheel zooms in/out.3//! Middle Button hold down while drag rotates light. //4//! Right click to show popup menu. //5 6// Load surface data into memory //7String filepath = null;8filepath = System.AppDomain.CurrentDomain.BaseDirectory + "\\terrain2.bin";9System.IO.FileStream fs = null;10try11{12 fs = new System.IO.FileStream(filepath, System.IO.FileMode.Open);13}14catch15{16 System.Windows.Forms.MessageBox.Show("Demo File Not Found?", "Error", System.Windows.Forms.MessageBoxButtons.OK);17 System.Windows.Forms.Application.Exit();18}19 20System.IO.BinaryReader r = new System.IO.BinaryReader(fs);21for (int o = 0; o < 2250000; o++)22 MainWindow.pGlobalElevData[o] = r.ReadInt32();23fs.Close();24 25Pe3do1.PeData.Subsets = 150;26Pe3do1.PeData.Points = 150;27 28Pe3do1.PeData.DuplicateDataX = DuplicateData.PointIncrement;29Pe3do1.PeData.DuplicateDataZ = DuplicateData.SubsetIncrement;30 31int l;32for (int s = 0; s < 150; s++)33{34 for (int p = 0; p < 150; p++)35 {36 l = (s * 1500) + p + 0;37 Pe3do1.PeData.Y[s, p] = MainWindow.pGlobalElevData[l] * 0.1F;38 }39}40 41for (int p = 0; p < 150; p++)42{43 Pe3do1.PeData.X[0, p] = (float)p + 1;44}45 46for (int s = 0; s < 150; s++)47{48 Pe3do1.PeData.Z[0, s] = (float)s + 1;49}50 51MainWindow.m_nRealTimeCounter = 151; // Keeps track of current row52MainWindow.m_nOverallCounter = 151;53 54Pe3do1.PeColor.SubsetColors[(int)SurfaceColors.WireFrame] = Color.FromArgb(255, 215, 215, 255);55Pe3do1.PeColor.SubsetColors[(int)SurfaceColors.SolidSurface] = Color.FromArgb(255, 215, 215, 255);56 57// There are different plotting method values for each case of PolyMode //58Pe3do1.PePlot.Method = Gigasoft.ProEssentials.Enums.ThreeDGraphPlottingMethod.Two; // Surface59Pe3do1.PePlot.Allow.SurfaceContour = false;60Pe3do1.PePlot.Option.ShowWireFrame = true;61 62Pe3do1.PeConfigure.RenderEngine = RenderEngine.Direct3D;63 64Pe3do1.PePlot.Option.DxZoomMax = -3F; // v10 New properties to control max and min mousewheel zoom65Pe3do1.PePlot.Option.DxZoomMin = -12F;66 67Pe3do1.PePlot.Option.DxViewportPanFactor = 2.0F; // v10 New properties to control shift/drag and mousewheel sensitivity68Pe3do1.PeUserInterface.Scrollbar.MouseWheelZoomFactor = 3.75F;69 70Pe3do1.PeUserInterface.Scrollbar.ViewingHeight = 8;71Pe3do1.PeUserInterface.Scrollbar.DegreeOfRotation = 93;72Pe3do1.PeFunction.SetLight(0, .05F, -1.0F, 2.75F);73Pe3do1.PePlot.Option.DxZoom = -6.37F;74Pe3do1.PePlot.Option.DxViewportX = .2F;75Pe3do1.PePlot.Option.DxViewportY = 1.1F;76 77Pe3do1.PeString.SubTitle = "||Mouse Wheel zooms. Mouse Drag rotates. Mouse Drag+SHIFT shifts image. ";78Pe3do1.PeString.MultiSubTitles[0] = "||Double Click start/stop Rotation. Mouse Drag+MIDDLE rotates light. ";79 80Pe3do1.PeColor.BitmapGradientMode = false;81Pe3do1.PeColor.QuickStyle = QuickStyle.DarkNoBorder;82 83Pe3do1.PeString.MainTitle = "";84Pe3do1.PePlot.Option.DegreePrompting = true;85Pe3do1.PeGrid.Option.GridAspectX = 10.0F;86Pe3do1.PeGrid.Option.GridAspectZ = 2.0F;87 88Pe3do1.PeFont.Fixed = true;90Pe3do1.PeConfigure.PrepareImages = true;91Pe3do1.PeConfigure.CacheBmp = true;92Pe3do1.PeUserInterface.Allow.FocalRect = false;93 94Pe3do1.PeUserInterface.Menu.Contour = MenuControl.Hide;95Pe3do1.PeUserInterface.Menu.Rotation = MenuControl.Hide;96Pe3do1.PeUserInterface.Menu.BorderType = MenuControl.Hide;97 98Pe3do1.PeConfigure.TextShadows = TextShadows.BoldText;99Pe3do1.PeFont.Label.Bold = true;100Pe3do1.PeConfigure.ImageAdjustRight = 50;101Pe3do1.PeConfigure.ImageAdjustLeft = 50;102 103// Set various export defaults //104Pe3do1.PeSpecial.DpiX = 600;105Pe3do1.PeSpecial.DpiY = 600;106 107// default export setting //108Pe3do1.PeUserInterface.Dialog.ExportSizeDef = ExportSizeDef.NoSizeOrPixel;109Pe3do1.PeUserInterface.Dialog.ExportTypeDef = ExportTypeDef.Png;110Pe3do1.PeUserInterface.Dialog.ExportDestDef = ExportDestDef.Clipboard;111Pe3do1.PeUserInterface.Dialog.ExportUnitXDef = "1280";112Pe3do1.PeUserInterface.Dialog.ExportUnitYDef = "768";113Pe3do1.PeUserInterface.Dialog.ExportImageDpi = 300;114Pe3do1.PeUserInterface.Dialog.AllowEmfExport = false;115Pe3do1.PeUserInterface.Dialog.AllowWmfExport = false;116 117// Enable button dragging //118Pe3do1.PeUserInterface.Scrollbar.MouseDraggingX = true;119Pe3do1.PeUserInterface.Scrollbar.MouseDraggingY = true;120 121Pe3do1.PeData.ComputeShader = true; // v10 Enable ComputeShader, staging buffers, circular buffers for real-time122Pe3do1.PeData.StagingBufferX = true;123Pe3do1.PeData.StagingBufferY = true;124Pe3do1.PeData.StagingBufferZ = true;125Pe3do1.PeData.CircularBuffers = true;126 127Pe3do1.PeFunction.Force3dxVerticeRebuild = true;128 129Pe3do1.PeFunction.ReinitializeResetImage();130Pe3do1.Invalidate();131Pe3do1.Refresh();132 133MainWindow.Timer1.Interval = 10;134MainWindow.Timer1.Start();135 136/*137/////////////////////////138// Example Timer Event //139/////////////////////////140private void Timer1_Tick(object sender, System.EventArgs e)141{142 float[] pNewXData = new float[150];143 float[] pNewYData = new float[150];144 145 int l;146 int s;147 for (s = 0; s < 150; s++)148 {149 pNewXData[s] = m_nOverallCounter;150 l = (s * 1500) + m_nRealTimeCounter + 0;151 pNewYData[s] = pGlobalElevData[l] * 0.1F;152 }153 154 m_nRealTimeCounter = m_nRealTimeCounter + 1;155 if (m_nRealTimeCounter > 1499)156 m_nRealTimeCounter = 0;157 m_nOverallCounter = m_nOverallCounter + 1;158 159 // transfer new Data //160 Pe3do1.PeData.Y.AppendData(pNewYData, 1);161 Pe3do1.PeData.X.AppendData(pNewXData, 1);162 Pe3do1.PeData.ReuseDataZ = true;163 164 // causes 3D object to reconstruct polygon data //165 Pe3do1.PeFunction.PEreconstruct3dpolygons();166 Pe3do1.Invalidate();167}168*/Pego1.PeData.Y[s, p]Click underlined properties to view documentation