コード例 #1
0
 private void SetCamera_Click(object sender, EventArgs e)
 {
     if (isRunning)
     {
         YamangDll.SetCameraView(Convert.ToInt32(GetNumber(CameraXVal)), Convert.ToInt32(GetNumber(CameraYVal)), Convert.ToInt32(GetNumber(CameraZVal)));
     }
 }
コード例 #2
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     isRunning = false;
     YamangDll.HeightMapCleanup();
     YamangDll.D3DCleanUp();
     //YamangDll.MeshObjectCleanUp(ref infoPtr);
     Application.Exit();
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        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();
        }
コード例 #5
0
        async private void Render()
        {
            int i = 0;

            while (isRunning)
            {
                YamangDll.RenderingTool(ref infoPtr);

                button1.Text = "" + i;
                await Task.Delay(10);

                ++i;
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
        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);
                }
            }
        }
コード例 #9
0
 public Main()
 {
     InitializeComponent();
     YamangDll.InitD3D(this.Window.Handle);
     Render();
 }