示例#1
0
        ////////////////////////////////////////////////////////////////////////////////////
        public ExtrusionMesh(Sec sec, Color color, bool att_color)
        {
            this.sec       = sec;
            this.color     = color;
            this.att_color = att_color;

            //计算所有的顶点集合及面索引
            GenerateAllVertexsAndFacets();
        }
示例#2
0
文件: Game.cs 项目: IanusInferus/cmdt
        ////////////////////////////////////////////////////////////////////////////////////
        void ResetAll(string fn)
        {
            ////////////////////////////////////////////////////////////////////////////////////
            //所有关键变量的清空和初始化
            EnableColoring       = true;
            EnableLights         = false;
            DisplayWireFrame     = true;
            DisplayHorizonalMesh = true;
            DisplayVerticalMesh  = true;
            DisplayInfoHUD       = true;

            //挤压Mesh的球面中心点
            center = new Vector3();

            //当前选中的多边形编号及其质心
            curr_district = 0;
            curr_centroid = new Vector3();

            //world中的平移矢量
            world_translation = new Vector3();                  //其值要么等于center,要么等于当前选择的面质心坐标

            //World等比放大系数,暂时不用
            scaling = 1F;

            //Direct3D相关
            device         = null;
            device_lost    = false;
            present_params = null;
            batch          = 0;

            //Direct3D资源相关
            font_selected    = font_hud = null;
            d3dfont_selected = d3dfont_hud = null;
            bmp_hud          = null;
            bkground_hud     = null;
            sprite           = null;

            //显示信息相关
            filename = message = null;

            //窗口状态相关
            onpaint_enabled = true;

            ////////////////////////////////////////////////////////////////////////////////////
            //生成原始数据和所有点、面和线框
            sec = new Sec(fn);
            ms  = new ExtrusionMesh(sec, Color.White, EnableColoring);
            ws  = new WallMesh(sec, Color.Gainsboro);
            pl  = new PartitionLines(ms.polys, Color.Red);
            wpl = new WallPartitionLines(sec, Color.Blue);

            //对sl采取的管理策略是不同的,其VertexBuffer和其自身将被同时创建或删除
            //这里无需初始化,InitializeGraphics中自然会初始化
            sl = null;

            //初始化当前选中的多边形的质心
            curr_centroid = ms.polys[curr_district].GetCentroid();

            //设置标题栏
            FileInfo fi = new FileInfo(fn);

            filename = fn; // fi.Name.ToLower();
            Text     = "3D .Sec Viewer - " + filename;

            //初始化信息字符串
            GenerateMessageString();
        }