MCPcopy
hub / github.com/mrdoob/three.js / getVertexPosition

Method getVertexPosition

src/objects/Mesh.js:176–218  ·  view source on GitHub ↗

* Returns the local-space position of the vertex at the given index, taking into * account the current animation state of both morph targets and skinning. * * @param {number} index - The vertex index. * @param {Vector3} target - The target object that is used to store the method's result.

( index, target )

Source from the content-addressed store, hash-verified

174 * @return {Vector3} The vertex position in local space.
175 */
176 getVertexPosition( index, target ) {
177
178 const geometry = this.geometry;
179 const position = geometry.attributes.position;
180 const morphPosition = geometry.morphAttributes.position;
181 const morphTargetsRelative = geometry.morphTargetsRelative;
182
183 target.fromBufferAttribute( position, index );
184
185 const morphInfluences = this.morphTargetInfluences;
186
187 if ( morphPosition && morphInfluences ) {
188
189 _morphA.set( 0, 0, 0 );
190
191 for ( let i = 0, il = morphPosition.length; i < il; i ++ ) {
192
193 const influence = morphInfluences[ i ];
194 const morphAttribute = morphPosition[ i ];
195
196 if ( influence === 0 ) continue;
197
198 _tempA.fromBufferAttribute( morphAttribute, index );
199
200 if ( morphTargetsRelative ) {
201
202 _morphA.addScaledVector( _tempA, influence );
203
204 } else {
205
206 _morphA.addScaledVector( _tempA.sub( target ), influence );
207
208 }
209
210 }
211
212 target.add( _morphA );
213
214 }
215
216 return target;
217
218 }
219
220 /**
221 * Computes intersection points between a casted ray and this line.

Callers 3

expandByObjectMethod · 0.45
reduceVerticesFunction · 0.45

Calls 5

fromBufferAttributeMethod · 0.45
setMethod · 0.45
addScaledVectorMethod · 0.45
subMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected