Exemple #1
0
        //============================================================
        public void Export3d2(FDrGeometry geometry, string filename)
        {
            SIntSize    size   = new SIntSize(1024, 1024);
            Form        form   = new Form();
            FDxDevice3D device = RDxCore.Adapter.CreateDevice(form.Handle, size.Width, size.Height);

            device.ModeWireFrame = false;
            // 设置几何体
            FDxRegion         region         = new FDxRegion();
            FDsNormalGeometry normalGeometry = new FDsNormalGeometry();

            normalGeometry.Device = device;
            normalGeometry.LoadResource(geometry);
            region.Renderables.Push(normalGeometry);
            // 设置目标
            FDxBufferedTexture texture = new FDxBufferedTexture();

            texture.Device = device;
            texture.Create(size.Width, size.Height);
            device.SetRenderTarget(texture);
            // 绘制结果
            FDxTechnique technique = RDxCore.TechniqueConsole.Get(device, "normal.map");

            technique.Draw(region);
            // 保存内容
            texture.SaveFile(filename);
            // 创建设备
            // QNormalMapForm form = new QNormalMapForm();
            // form.geometry = geometry;
            // Application.Run(form);
        }
Exemple #2
0
        private void QNormalMapForm_Load(object sender, EventArgs e)
        {
            device = RDxCore.Adapter.CreateDevice(Handle, 1024, 1024);
            // 设置几何体
            region = new FDxRegion();
            FDsNormalGeometry normalGeometry = new FDsNormalGeometry();

            normalGeometry.Device = device;
            normalGeometry.LoadResource(geometry);
            region.Renderables.Push(normalGeometry);
            // 设置目标
            FDxBufferedTexture texture = new FDxBufferedTexture();

            texture.Device = device;
            texture.Create(1024, 1024);
            //device.SetRenderTarget(texture);
            // 绘制结果
            technique = RDxCore.TechniqueConsole.Get(device, "normal.map");
            // 保存内容
            //texture.SaveFile(filename);
            timer1.Enabled = true;
        }