Difference between revisions 1338 and 1339 on hiwikiversity

{{कंप्यूटर ग्राफिक्स -- 2013-2014 -- info.uvt.ro/पेज हैडर}}

== डायरेक्टएक्स9 में संक्षिप्त परिचय ==
=== अवलोकन ===
इस प्रयोगशाला में हम डायरेक्टएक्स में सरल दृश्य के बनाने और इसे के अंदर कुछ तत्वों के साथ ड्रा के विषय में कुछ सामान्य मुद्दों पर चर्चा करेंगे। कोड सी# में लिखे जाएँगे। यह बारीकी से जावा जैसा दिखता हैं।

=== साधारण हैलो वर्ल्ड एप्लीकेशन बनाना ===

(contracted; show full)
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            
            HelloDirectX frm = new HelloDirectX();
            // 
Initialize the device.डिवाइस को प्रारंभ करें
            frm.Init();
            // Show the form.फॉर्म दिखाएं
            frm.Show();

            Application.run(frm);
        }

        public void Init()
        {
            [...]        
        }

        private void Render()
        {
            // Set the projection to be Perspective.प्रोजेकशन को पर्सपेक्टिव में सेट करें
            device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI/4,
                    this.Width/this.Height, 1f, 50f);
            // Orient the camera.ओरिएंट कैमरा
            device.Transform.View = Matrix.LookAtLH(new Vector3(0,0,-30), new Vector3(0,0,0), 
                    new Vector3(0,1,0));
            // Reset the world matrix to Identity.आइडेन्टिटि के लिए वल्ड मैट्रिक्स को रीसेट करें।
            device.Transform.World = Matrix.Identity;

            // Create a new matrix which will store our transformations.एक नया मैट्रिक्स बनाएं जो हमारे परिवर्तनों को संग्रहित करे।
            Matrix customMatrix = Matrix.Identity;
            // Apply a translation to our matrix.हमारे मैट्रिक्स में एक ट्रान्सलेशन लागू करें
            Matrix translation = Matrix.Translation(10, 10, 10);
            // Apply a rotation on the OX axis.OX अक्ष पर रोटेशन लागू करें             
            Matrix rotation = Matrix.RotationX(45);
            // Apply scaling. स्केलिंग लागू करें               
            Matrix scaling = Matrix.Scaling(0.5f, 0.5f, 0.5f);
            // Build the composite matrix.कम्पोजिट मैट्रिक्स बनाएं
            customMatrix = translation * rotation * scaling;

            // Set the world matrix to be our new custom matrix.हमारे नए कस्टम मैट्रिक्स होने के लिए वल्ड मैट्रिक्स सेट करें
            device.Transform.World = customMatrix;
            [...]        
        }

        // We need to override this method so that we can control what is being drawn on the screen.हमें इस पद्धति को ओवरराइड करने की आवश्यकता है ताकि हम स्क्रीन पर खींची गई चीज़ों को नियंत्रित कर सकें।
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            this.Render();
        }

        // Event handler for managing the device reset instance.
        public void OnResetDevice(object sender, EventArgs e)
        {
            [...]
        }
        [...]
    }
}
</source>



=== वर्टिस (Vertices) का प्रयोग ===

<source lang="csharp">
[...]
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Direct3D = Microsoft.DirectX.Direct3D;

(contracted; show full)</source>

== लिंक ==
* [http://www.riemers.net/eng/Tutorials/DirectX/Csharp/series1.php प्रबंधित डायरेक्टएक्स9 ट्यूटोरियल]

[[Category:HI]]
[[Category:कंप्यूटर ग्राफिक्स]]
[[Category:ग्राफिक्स]]