提交 1e8081dc 编写于 作者: T tschw

Let PropertyBinding support arrays.

上级 af4c7233
......@@ -237,6 +237,12 @@ THREE.PropertyBinding.prototype = {
this.resolvedProperty = nodeProperty;
} else if ( Array.isArray( nodeProperty ) ) {
bindingType = this.BindingType.EntireArray;
this.resolvedProperty = nodeProperty;
} else {
this.propertyName = propertyName;
......@@ -274,8 +280,9 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
BindingType: {
Direct: 0,
ArrayElement: 1,
HasFromToArray: 2
EntireArray: 1,
ArrayElement: 2,
HasFromToArray: 3
},
Versioning: {
......@@ -292,6 +299,18 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
},
function getValue_array( buffer, offset ) {
var source = this.node[ this.propertyName ];
for ( var i = 0, n = source.length; i !== n; ++ i ) {
buffer[ offset ++ ] = source[ i ];
}
},
function getValue_arrayElement( buffer, offset ) {
buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];
......@@ -331,6 +350,50 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
}
], [
// EntireArray
function setValue_array( buffer, offset ) {
var dest = this.resolvedProperty;
for ( var i = 0, n = dest.length; i !== n; ++ i ) {
dest[ i ] = buffer[ offset ++ ];
}
},
function setValue_array_setNeedsUpdate( buffer, offset ) {
var dest = this.resolvedProperty;
for ( var i = 0, n = dest.length; i !== n; ++ i ) {
dest[ i ] = buffer[ offset ++ ];
}
this.targetObject.needsUpdate = true;
},
function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {
var dest = this.resolvedProperty;
for ( var i = 0, n = dest.length; i !== n; ++ i ) {
dest[ i ] = buffer[ offset ++ ];
}
this.targetObject.matrixWorldNeedsUpdate = true;
}
], [
// ArrayElement
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册