private void SetCamera_Click(object sender, EventArgs e) { if (isRunning) { YamangDll.SetCameraView(Convert.ToInt32(GetNumber(CameraXVal)), Convert.ToInt32(GetNumber(CameraYVal)), Convert.ToInt32(GetNumber(CameraZVal))); } }
private void exitToolStripMenuItem_Click(object sender, EventArgs e) { isRunning = false; YamangDll.HeightMapCleanup(); YamangDll.D3DCleanUp(); //YamangDll.MeshObjectCleanUp(ref infoPtr); Application.Exit(); }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { renderStop = true; YamangDll.HeightMapCleanup(); YamangDll.D3DCleanUp(); MessageBox.Show(this, "맵툴을 종료합니다", "Closing...", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
public Main() { InitializeComponent(); YamangDll.InitD3D(this.RenderTarget.Handle); YamangDll.HeightMapTextureImport(this.RenderTarget.Handle, heightMap, mapTexture); // YamangDll.MapToolTextureImport(this.RenderTarget.Handle, mapTexture0); // YamangDll.MapToolTextureImport(this.RenderTarget.Handle, mapTexture1); // YamangDll.MapToolTextureImport(this.RenderTarget.Handle, mapTexture2); // YamangDll.MapToolTextureImport(this.RenderTarget.Handle, mapTexture3); // YamangDll.MapToolTextureImport(this.RenderTarget.Handle, mapTexture4); Render(); }
async private void Render() { int i = 0; while (isRunning) { YamangDll.RenderingTool(ref infoPtr); button1.Text = "" + i; await Task.Delay(10); ++i; } }
async private void Render() { while (!renderStop) { YamangDll.PreRendering(); int curWidth = Convert.ToInt32(GetNumber(MapHeightVal)); int curHeight = Convert.ToInt32(GetNumber(MapWidthVal)); int curMapSpace = Convert.ToInt32(GetNumber(MapVertexSpacingVal)); if ((preWidth != curWidth) || (preHeight != curHeight) || (preMapSpace != curMapSpace)) { meshSizeChanged = true; } if (meshSizeChanged) { meshSizeChanged = false; YamangDll.InitGroundMesh(curWidth, curHeight); YamangDll.CreateRawGround(curWidth, curHeight, curMapSpace); } YamangDll.ToolViewSetting(RenderTarget.Size.Width, RenderTarget.Size.Height); if (mouseEventFlag) { SetAction(); YamangDll.CalcPickingRay(mouseXPosition, mouseYPosition); //YamangDll.TransPickedTriangle(ref returnedXPos, ref returnedZPos); YamangDll.TransPickedTriangle(ref returnedXPos, ref returnedZPos, ref PickedTriPointA, ref PickedTriPointB, ref PickedTriPointC); //이거 활용해서 해당 위치에 나무 같은거 뿌리면 될 듯 Console.WriteLine("A: " + PickedTriPointA + "\nB: " + PickedTriPointB + "\nC: " + PickedTriPointC); Console.WriteLine("Xpos: " + returnedXPos + ", ZPos: " + returnedZPos); YamangDll.MapToolPickingEvent(actionFlag, PickedTriPointA, PickedTriPointB, PickedTriPointC); mouseEventFlag = false; } YamangDll.RenderHeightMap(); YamangDll.PostRendering(); preWidth = curWidth; preHeight = curHeight; preMapSpace = curMapSpace; await Task.Delay(10); } }
private void button1_Click(object sender, EventArgs e) { if (!isRunning) { isRunning = true; info = new YamangDll.MESHOBJECT(); infoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(info)); Marshal.StructureToPtr(info, infoPtr, false); info = (YamangDll.MESHOBJECT)Marshal.PtrToStructure(infoPtr, typeof(YamangDll.MESHOBJECT)); string filename = "tiger.x"; YamangDll.InitGeometry(this.Window.Handle, filename, ref infoPtr); YamangDll.SetCameraView(0.0f, 1.0f, -10.0f); Render(); } }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (isRunning == true) { isRunning = false; YamangDll.HeightMapCleanup(); // if (infoPtr != IntPtr.Zero) // { // YamangDll.MeshObjectCleanUp(ref infoPtr); // } YamangDll.D3DCleanUp(); MessageBox.Show(this, "맵툴을 종료합니다", "Closing...", MessageBoxButtons.OK, MessageBoxIcon.Question); } } }
public Main() { InitializeComponent(); YamangDll.InitD3D(this.Window.Handle); Render(); }