|
15054 | 15054 |
|
15055 | 15055 | var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}"; |
15056 | 15056 |
|
15057 | | - var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"; |
| 15057 | + var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"; |
15058 | 15058 |
|
15059 | 15059 | var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}"; |
15060 | 15060 |
|
|
27551 | 27551 | this.linecap = 'round'; |
27552 | 27552 | this.linejoin = 'round'; |
27553 | 27553 |
|
| 27554 | + this.morphTargets = false; |
| 27555 | + |
27554 | 27556 | this.setValues( parameters ); |
27555 | 27557 |
|
27556 | 27558 | } |
|
27570 | 27572 | this.linecap = source.linecap; |
27571 | 27573 | this.linejoin = source.linejoin; |
27572 | 27574 |
|
| 27575 | + this.morphTargets = source.morphTargets; |
| 27576 | + |
27573 | 27577 | return this; |
27574 | 27578 |
|
27575 | 27579 | }; |
|
27599 | 27603 | this.geometry = geometry !== undefined ? geometry : new BufferGeometry(); |
27600 | 27604 | this.material = material !== undefined ? material : new LineBasicMaterial(); |
27601 | 27605 |
|
| 27606 | + this.updateMorphTargets(); |
| 27607 | + |
27602 | 27608 | } |
27603 | 27609 |
|
27604 | 27610 | Line.prototype = Object.assign( Object.create( Object3D.prototype ), { |
|
27801 | 27807 |
|
27802 | 27808 | }, |
27803 | 27809 |
|
| 27810 | + updateMorphTargets: function () { |
| 27811 | + |
| 27812 | + var geometry = this.geometry; |
| 27813 | + var m, ml, name; |
| 27814 | + |
| 27815 | + if ( geometry.isBufferGeometry ) { |
| 27816 | + |
| 27817 | + var morphAttributes = geometry.morphAttributes; |
| 27818 | + var keys = Object.keys( morphAttributes ); |
| 27819 | + |
| 27820 | + if ( keys.length > 0 ) { |
| 27821 | + |
| 27822 | + var morphAttribute = morphAttributes[ keys[ 0 ] ]; |
| 27823 | + |
| 27824 | + if ( morphAttribute !== undefined ) { |
| 27825 | + |
| 27826 | + this.morphTargetInfluences = []; |
| 27827 | + this.morphTargetDictionary = {}; |
| 27828 | + |
| 27829 | + for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) { |
| 27830 | + |
| 27831 | + name = morphAttribute[ m ].name || String( m ); |
| 27832 | + |
| 27833 | + this.morphTargetInfluences.push( 0 ); |
| 27834 | + this.morphTargetDictionary[ name ] = m; |
| 27835 | + |
| 27836 | + } |
| 27837 | + |
| 27838 | + } |
| 27839 | + |
| 27840 | + } |
| 27841 | + |
| 27842 | + } else { |
| 27843 | + |
| 27844 | + var morphTargets = geometry.morphTargets; |
| 27845 | + |
| 27846 | + if ( morphTargets !== undefined && morphTargets.length > 0 ) { |
| 27847 | + |
| 27848 | + console.error( 'THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' ); |
| 27849 | + |
| 27850 | + } |
| 27851 | + |
| 27852 | + } |
| 27853 | + |
| 27854 | + }, |
| 27855 | + |
27804 | 27856 | clone: function () { |
27805 | 27857 |
|
27806 | 27858 | return new this.constructor( this.geometry, this.material ).copy( this ); |
|
0 commit comments