The WebGL app for the HT for Web custom 3D model

Source: Internet
Author: User

A number of friends asked how the 3D meter model of the five HTML5 WEB client summary of offline storage examples was generated by importing a 3dmax designed meter model and then importing it into the HT for web system via the obj format, This approach is particularly well suited for complex model scenarios, but many applications for monitoring systems do not require professional artists to use professional 3D editing tools, complete with the HT for Web pre-defined and built-in custom 3D model API to meet many applications, here are a few scenarios of custom 3D model application.

is to use the Createringmodel function provided by HT to create a corresponding ring-shaped 3D model by editing a 2D polygon, which is suitable for a ring-symmetric object such as a vase bowl. In addition to the Createringmodel, the Custommodel custom model example in the HT modeling manual has built a table chair and wall scene with more custom model APIs such as Createextrusionmodel, with the following effects:

The HT built-in base model also has many parameters that can be adjusted to a variety of model effects, see the following example of the HT Modeling manual:

Custom models can also be used to build common telecom network management models such as room, frame, board and Port:

The EMS Device Management System Example 3D model and tree components through the HT powerful flexible model and graphics data binding function, so as to achieve the tree custom icon and 3D custom model data sharing, real-time consistent refresh effect, the following is the EMS example of all the JavaScript code:

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 ';d ocument.body.appendChild (view);                         Window.addeventlistener (' Resize ', function (e) {mainsplit.invalidate ();}, False); Register2dimage (); Register3dmodel (); Addmodel (); G3d.setgridvisible (TRUE); G3d.setgridsize (+); g3d.setgridgap (0); G3d.seteye ([n. 0]); G3d.setcenter ((+ (+), (+); (+); 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 ();} functionRegister2dimage () {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, 10],background: {func: ' [email&     Nbsp;protected]}); Ht. Default.setimage (' Ems-block ', {width:18,height:18,comps: [{type: ' Circle ', rect: [0, 2, 10],background: {func: ' [EMA] Il protected] ', Value: ' #3498DB '}}, {type: ' rect ', rect: [4, +, 3],background: {fun                 C: ' [email protected] ', 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 (0, +, false, False,True, True), R3: [MATH.PI/2, 0, 0], color: {func: ' [email protected] ', Value: ' #3498DB '}},{shape3d: ' box ', S3:                  [1, 0.2, 1], T3: [0, -0.7, 0],color: {func: ' [email protected] ', 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 (+); wall.setelevation (200); Wall.s ({' Shape.border.width ': 5, ' shape.border.color ': ' Rgba ', ' 0.8 ', ' shape.background ': null, ' All.color ': '                                               RGBA (102, 192, 218, 0.95) ', ' all.transparent ': true, ' All.reverse.cull ': true});d M.add (wall); var frame = new ht. Node (); Frame.setname (' Main frame '); Frame.seticon (' ems-frame '); Frame.s3 (+), frame.p3 (0, 0); FRAME.S ({ ' Shape3d ': ' Ems-frame ', ' shape3d.color ': ' #34495E ', ' label ': ' www.hightopo.com ', ' label.color ': ' White ', ' Label.background ': ' #3498DB ', ' label.position ': 6, ' label.t3 ': [-6,-54, 6], ' LABEL.R3 ': [0, Math.pi/4, MATH.PI/2]});d M.add (frame);  var colors = [' #9C8CE7 ', ' #00C59D ', ' #A741B6 ', ' #F5C700 ', ' #31485F ', ' #F81F25 ', ' #00B862 ', ' #3B7DA7 '];for (var i=0; i<6; i++) {var pane = new ht.                    Node ();p ane.seticon (' Ems-pane ');p ane.setname (' pane ' + (i+1));p ANE.S3 (108, 16, 8);                     PANE.S ({' Shape3d ': ' box ', ' shape3d.color ': ' #ECF0F1 '});p Ane.sethost (frame);p ane.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] ');p ane.s ({' Shape3d.color ': ' #BDC3C7 '});}                PANE.P3 (0, 265-i*27, 54);} }


The WebGL app for the HT for Web custom 3D model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.