乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      HT for Web自定義3D模型的WebGL應(yīng)用

       看見就非常 2015-09-18
      摘要 有不少朋友詢問《HTML5 Web 客戶端五種離線存儲(chǔ)方式匯總》文章例子的3D表計(jì)模型是如何生成的,這個(gè)例子是通過導(dǎo)入3dmax設(shè)計(jì)好的表計(jì)模型,然后通過obj格式導(dǎo)入到HT for Web系統(tǒng)中進(jìn)行控制,這種方式特別適合復(fù)雜模型的應(yīng)用場(chǎng)景,但對(duì)于監(jiān)控系統(tǒng)的很多應(yīng)用其實(shí)并不需要專業(yè)的美工使用專業(yè)的3D編輯工具,完全通過HT for Web預(yù)定義的和內(nèi)置自定義3D模型API就能滿足很多應(yīng)用,這里介紹幾種場(chǎng)景的自定義3D模型應(yīng)用。

      Screen Shot 2015-01-07 at 11.53.23 PM

      有不少朋友詢問《HTML5 Web 客戶端五種離線存儲(chǔ)方式匯總》文章例子的3D表計(jì)模型是如何生成的,這個(gè)例子是通過導(dǎo)入3dmax設(shè)計(jì)好的表計(jì)模型,然后通過obj格式導(dǎo)入到HT for Web系統(tǒng)中進(jìn)行控制,這種方式特別適合復(fù)雜模型的應(yīng)用場(chǎng)景,但對(duì)于監(jiān)控系統(tǒng)的很多應(yīng)用其實(shí)并不需要專業(yè)的美工使用專業(yè)的3D編輯工具,完全通過HT for Web預(yù)定義的和內(nèi)置自定義3D模型API就能滿足很多應(yīng)用,這里介紹幾種場(chǎng)景的自定義3D模型應(yīng)用。

      Screen Shot 2015-01-07 at 11.48.45 PM

      上圖是采用HT提供的createRingModel函數(shù),通過編輯2D的多邊形生成對(duì)應(yīng)的環(huán)狀的3D模型,對(duì)于花瓶碗杯等環(huán)形對(duì)稱的物體很適合采用該函數(shù)構(gòu)建。除了createRingModel外,HT的建模手冊(cè)中的custommodel自定義模型例子,還采用了createExtrusionModel等更多的自定義模型API構(gòu)建了一個(gè)餐桌椅和墻面的場(chǎng)景,其效果如下:

      Screen Shot 2015-01-07 at 11.46.14 PM

      HT內(nèi)置的基礎(chǔ)模型也有很多參數(shù)可調(diào)節(jié)設(shè)置出多種模型效果,參見HT建模手冊(cè)的如下例子:

      Screen Shot 2015-01-07 at 11.49.56 PM

      自定義模型還可用于構(gòu)建如機(jī)房、機(jī)框、板卡和端口的常見電信網(wǎng)管監(jiān)控模型:http://v.youku.com/v_show/id_XODY2ODc0ODY0.html

      Screen Shot 2015-01-07 at 11.50.54 PM

      該EMS設(shè)備管理系統(tǒng)例子3D模型和Tree組件通過HT強(qiáng)大靈活的模型與圖形的數(shù)據(jù)綁定功能,從而實(shí)現(xiàn)樹上自定義圖標(biāo)和3D自定義模型的數(shù)據(jù)共享,實(shí)時(shí)一致刷新效果,以下為該EMS例子的全部JavaScript代碼:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
      100
      101
      102
      103
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      124
      125
      126
      127
      128
      129
      130
      131
      132
      133
      134
      135
      136
      137
      138
      139
      140
      141
      142
      143
      144
      145
      146
      147
      148
      149
      150
      151
      152
      153
      154
      155
      156
      157
      158
      159
      160
      161
      162
      163
      164
      165
      166
      167
      168
      169
      170
      171
      172
      173
      174
      175
      176
      177
      178
      179
      180
      181
      182
      183
      184
      185
      186
      187
      188
      function init(){                                 
          dm = new ht.DataModel();                
          treeView = new ht.widget.TreeView(dm);                                                                                                 
          g3d = new ht.graph3d.Graph3dView(dm);                          
          mainSplit = new ht.widget.SplitView(treeView, g3d, 'h', 0.2);   
          view = mainSplit.getView();  
          view.className = 'main';
          document.body.appendChild(view);    
          window.addEventListener('resize'function (e) {
              mainSplit.invalidate();
          }, false);                         
          register2DImage();
          register3DModel();
          addModel(); 
          g3d.setGridVisible(true); 
          g3d.setGridSize(30);
          g3d.setGridGap(50);
          g3d.setEye([200, 200, 600]);
          g3d.setCenter([0, 200, 0]);
          g3d.getView().style.background = '#F9F9F9';                 
          g3d.getLabel = function(data){
              return data.s('label');
          };
          dm.sm().setFilterFunc(function(data){
              return data !== wall;
          });
          treeView.setVisibleFunc(function(data){
              return data !== wall;
          });                
          treeView.expandAll();
      }
      function register2DImage(){
          ht.Default.setImage('ems-frame', {
              width: 18,
              height: 18,
              comps: [
                  {
                      type: 'rect',
                      rect: [5, 4, 8, 11],
                      borderWidth: 2,
                      borderColor: '#34495E'
                  }                         
          ]});        
          ht.Default.setImage('ems-pane', {
              width: 18,
              height: 18,
              comps: [
                  {
                      type: 'rect',
                      rect: [0, 4, 18, 10],
                      background: {func: 'style@shape3d.color'}
                  }                         
          ]});     
          ht.Default.setImage('ems-block', {
              width: 18,
              height: 18,
              comps: [
                  {
                      type: 'circle',
                      rect: [0, 2, 18, 10],
                      background: {
                          func: 'attr@circleColor',
                          value: '#3498DB'                               
                      }
                  }, 
                  {
                      type: 'rect',
                      rect: [4, 14, 10, 3],
                      background: {
                          func: 'attr@rectColor',
                          value: '#3498DB'                               
                      }
                  }                           
          ]});                 
      }
      function register3DModel(){
          ht.Default.setShape3dModel('ems-frame', ht.Default.createFrameModel(0.1, 0, 0.1, {top: true, bottom: true, back: true}));       
          ht.Default.setShape3dModel('ems-block', [
              {
                  shape3d: ht.Default.createCylinderModel(32, 0, 32, falsefalsetruetrue),   
                  r3: [Math.PI/2, 0, 0],   
                  color: {
                      func: 'attr@circleColor',
                      value: '#3498DB'
                  }     
              },
              {
                  shape3d: 'box',
                  s3: [1, 0.2, 1], 
                  t3: [0, -0.7, 0],
                  color: {
                      func: 'attr@rectColor',
                      value: '#3498DB'
                  }
              }
          ]);                  
      }
      function addModel(){
          wall = new ht.Shape();
          wall.setName('Wall');
          wall.setPoints(new ht.List([
              {x: -750, y: 750},
              {x: -750, y: -750},
              {x: 750, y: -750},
              {x: 750, y: 750}
          ]));
          wall.setTall(400);
          wall.setElevation(200);
          wall.s({
              'shape.border.width': 5,
              'shape.border.color''rgba(20, 20, 20, 0.8)',
              'shape.background'null,    
              'all.color''rgba(102, 192, 218, 0.95)',
              'all.transparent'true,
              'all.reverse.cull'true
          });
          dm.add(wall);                                               
          var frame = new ht.Node();
          frame.setName('Main Frame');
          frame.setIcon('ems-frame');
          frame.s3(120, 300, 120);
          frame.p3(0, 152, 0);
          frame.s({
              'shape3d''ems-frame',
              'shape3d.color''#34495E',
              'label''www.',
              'label.color''white',
              'label.background''#3498DB',
              'label.position': 6,
              'label.t3': [-6, -54, 6],
              'label.r3': [0, Math.PI/4, Math.PI/2]
          });
          dm.add(frame);                                
          var colors = ['#9C8CE7''#00C59D''#A741B6''#F5C700''#31485F''#F81F25''#00B862''#3B7DA7'];
          for(var i=0; i<6; i++){
              var pane = new ht.Node();
              pane.setIcon('ems-pane');
              pane.setName('Pane' + (i+1));
              pane.s3(108, 16, 8);                    
              pane.s({
                  'shape3d''box',
                  'shape3d.color''#ECF0F1'
              });
              pane.setHost(frame);
              pane.setParent(frame);                     
              dm.add(pane);
              if(i < 2){
                  for(var j=0; j<8; j++){
                      var block = new ht.Node();
                      block.setName('block ' + i + '*' + j);
                      block.s3(8, 8, 12);                
                      block.p3(-39+j*11, 1, 0);
                      block.setHost(pane);
                      block.setParent(pane); 
                      block.setIcon('ems-block');
                      block.s({
                          'shape3d''ems-block'
                      });                       
                      if(i === 1){
                          block.a({
                              'circleColor': colors[j],
                              'rectColor''#00F2CF'
                          });
                      }
                      dm.add(block);                                        
                  }                     
              }else{
                  pane.setName('Pane' + (i+1) + ' [ Empty ]');
                  pane.s({
                      'shape3d.color''#BDC3C7'
                  });
              }                   
              pane.p3(0, 265-i*27, 54);
          }                
      }


        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多