コード例 #1
0
ファイル: Form1.cs プロジェクト: nturusin/DirectXModelView
        //Device d3d;
        //Mesh circuit;
        //ExtendedMaterial[] extshema;
        //Texture[] texshema;

        //Mesh objEDS;
        //ExtendedMaterial[] eds;
        //Texture[] texeds;

        //Mesh objIND;
        //ExtendedMaterial[] ind;
        //Texture[] texind;

        //Mesh objCOND;
        //ExtendedMaterial[] cond;
        //Texture[] texcond;

        //Mesh objRES;
        //ExtendedMaterial[] res;
        //Texture[] texres;

        //Matrix viewMatrix;
        //static float ex = 0.0f;
        //static float a = 0.0f;
        //static float Xobj = 0.0f;
        //static float Yobj = 0.0f;
        //static float Zobj = 0.0f;
        //static float EDSpoX = 0.0f;
        //private void Form1_Load(object sender, EventArgs e)
        //{

        //    PresentParameters pp = new PresentParameters();
        //    pp.AutoDepthStencilFormat = DepthFormat.D16;
        //    pp.EnableAutoDepthStencil = true;
        //    pp.SwapEffect = SwapEffect.Discard;
        //    pp.Windowed = true;
        //    d3d = new Device(0, DeviceType.Hardware, panel1, CreateFlags.HardwareVertexProcessing, pp);
        //    d3d.RenderState.Lighting = true;
        //    d3d.Lights[0].Enabled = true;
        //    d3d.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / -2.0f, (float)panel1.Width / panel1.Height, 0.1f, 100.0f);

        //    circuit = Mesh.FromFile("earth\\circuit.x", MeshFlags.Managed, d3d, out extshema);
        //    objEDS = Mesh.FromFile("earth\\circuit.x", MeshFlags.Managed, d3d, out eds);

        //    texeds = new Texture[eds.Length];
        //    texshema = new Texture[extshema.Length];

        //    for (int i = 0; i < eds.Length; i++)
        //    {
        //        if (eds[i].TextureFilename != null)
        //             texeds[i] = TextureLoader.FromFile(d3d, "earth\\earth.bmp");
        //    }

        //        for (int j = 0; j < extshema.Length; j++)
        //        {
        //            if (extshema[j].TextureFilename != null)
        //                texshema[j] = TextureLoader.FromFile(d3d, "earth\\earth.bmp");
        //        }
        //}

        public void Инициализация(object sender, EventArgs e)
        {
            Color c = Color.White;

            visCirc        = new Visualization(panel1, c);
            voCirc         = new VObj(visCirc, "earth\\Circuit.x");
            voEds          = new VObj(visCirc, "earth\\boxik.x");
            voEds.Position = Matrix.Translation(1000.0f, 1000.0f, 1000.0f);

            visCirc.Camera = new Camera(                                       // Задать камеру вида
                Matrix.RotationX(-0.7f) *                                      // Вокруг Ox наклонить на 0.7 радиан
                Matrix.Translation(0, 2.5f, 20.0f));                           // Перенести камеру на 20 единиц вдоль Oz.
            visCirc.Camera = new AroundView(3.0f);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: nturusin/DirectXModelView
        //Device d3d;
        //Mesh circuit;
        //ExtendedMaterial[] extshema;
        //Texture[] texshema;
        //Mesh objEDS;
        //ExtendedMaterial[] eds;
        //Texture[] texeds;
        //Mesh objIND;
        //ExtendedMaterial[] ind;
        //Texture[] texind;
        //Mesh objCOND;
        //ExtendedMaterial[] cond;
        //Texture[] texcond;
        //Mesh objRES;
        //ExtendedMaterial[] res;
        //Texture[] texres;
        //Matrix viewMatrix;
        //static float ex = 0.0f;
        //static float a = 0.0f;
        //static float Xobj = 0.0f;
        //static float Yobj = 0.0f;
        //static float Zobj = 0.0f;
        //static float EDSpoX = 0.0f;
        //private void Form1_Load(object sender, EventArgs e)
        //{
        //    PresentParameters pp = new PresentParameters();
        //    pp.AutoDepthStencilFormat = DepthFormat.D16;
        //    pp.EnableAutoDepthStencil = true;
        //    pp.SwapEffect = SwapEffect.Discard;
        //    pp.Windowed = true;
        //    d3d = new Device(0, DeviceType.Hardware, panel1, CreateFlags.HardwareVertexProcessing, pp);
        //    d3d.RenderState.Lighting = true;
        //    d3d.Lights[0].Enabled = true;
        //    d3d.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / -2.0f, (float)panel1.Width / panel1.Height, 0.1f, 100.0f);
        //    circuit = Mesh.FromFile("earth\\circuit.x", MeshFlags.Managed, d3d, out extshema);
        //    objEDS = Mesh.FromFile("earth\\circuit.x", MeshFlags.Managed, d3d, out eds);
        //    texeds = new Texture[eds.Length];
        //    texshema = new Texture[extshema.Length];
        //    for (int i = 0; i < eds.Length; i++)
        //    {
        //        if (eds[i].TextureFilename != null)
        //             texeds[i] = TextureLoader.FromFile(d3d, "earth\\earth.bmp");
        //    }
        //        for (int j = 0; j < extshema.Length; j++)
        //        {
        //            if (extshema[j].TextureFilename != null)
        //                texshema[j] = TextureLoader.FromFile(d3d, "earth\\earth.bmp");
        //        }
        //}
        public void Инициализация(object sender, EventArgs e)
        {
            Color c = Color.White;
            visCirc = new Visualization(panel1, c);
            voCirc = new VObj(visCirc, "earth\\Circuit.x");
            voEds = new VObj(visCirc, "earth\\boxik.x");
            voEds.Position = Matrix.Translation(1000.0f, 1000.0f, 1000.0f);

            visCirc.Camera = new Camera(                                       // Задать камеру вида
                Matrix.RotationX(-0.7f) *                                       // Вокруг Ox наклонить на 0.7 радиан
                Matrix.Translation(0, 2.5f, 20.0f));                            // Перенести камеру на 20 единиц вдоль Oz.
            visCirc.Camera = new AroundView(3.0f);
        }