this.outLine()

沟边效果设置

使用 initScene 函数属性。

参数

initScene.outLine( object )

object:单个模型网格,或者包含多个模型网格的数组

为空:取消沟边

代码示例

//沟边设置 initScene.outlinePass.edgeStrength = 5.0; //沟边深浅 initScene.outlinePass.edgeGlow = 0.8; //光晕 initScene.outlinePass.edgeThickness = 1.0; //粗细 initScene.outlinePass.pulsePeriod = 0; //闪烁 initScene.outlinePass.visibleEdgeColor.set(0xff9600); //沟边颜色 initScene.outlinePass.hiddenEdgeColor.set(0x2b0d00); //被挡住的颜色 //设置变量(把需要沟边的目标分组) var sm=[], cx1=[], cx2=[], cyy=[], tx=[], ds1=[], ds2=[]; //把需要沟边的模型装入 models[0].traverse( function ( child ) { if ( child.isMesh ) { //把需要沟边的模型装入 if( child.name.indexOf( "sm" ) == 0 ){ //酒店 sm.push( child ); }else if( child.name.indexOf( "cx1" ) == 0 ){ //写字楼A cx1.push( child ); }else if( child.name.indexOf( "cx2" ) == 0 ){ //写字楼B cx2.push( child ); }else if( child.name.indexOf( "cyy" ) == 0 ){ //综合楼 cyy.push( child ); }else if( child.name.indexOf( "tx" ) == 0 ){ //科技楼 tx.push( child ); }else if( child.name.indexOf( "ds_" ) == 0 ){ //标准厂房A ds1.push( child ); }else if( child.name.indexOf( "ds2" ) == 0 ){ //标准厂房B ds2.push( child ); } } }); //使用MMAPI类,自定义外部函数接口 MMAPI.outline = function(num){ switch(num) { case 1: //取消沟边 initScene.outLine(); break; case 2: //酒店沟边 initScene.outLine( sm ); break; case 3: //写字楼A沟边 initScene.outLine( cx1 ); break; case 4: //写字楼B沟边 initScene.outLine( cx2 ); break; case 5: //综合楼沟边 initScene.outLine( cyy ); break; case 6: //科技楼沟边 initScene.outLine( tx ); break; case 7: //标准厂房A沟边 initScene.outLine( ds1 ); break; case 8: //标准厂房B沟边 initScene.outLine( ds2 ); break; } }

在线演示