dist/claygl.es.js
function (geometry) {
        var attributes = geometry.attributes;
        var positionAttr = attributes.position;
        var jointAttr = attributes.joint;
        var weightAttr = attributes.weight;

        var jointsBoundingBoxes = [];
        for (var i = 0; i < this.joints.length; i++) {
            jointsBoundingBoxes[i] = new BoundingBox();
            jointsBoundingBoxes[i].__updated = false;
        }

        var vtxJoint = [];
        var vtxPos = [];
        var vtxWeight = [];
        var maxJointIdx = 0;
        for (var i = 0; i < geometry.vertexCount; i++) {
            jointAttr.get(i, vtxJoint);
            positionAttr.get(i, vtxPos);
            weightAttr.get(i, vtxWeight);

            for (var k = 0; k < 4; k++) {
                if (vtxWeight[k] > 0.01) {
                    var jointIdx = vtxJoint[k];
                    maxJointIdx = Math.max(maxJointIdx, jointIdx);

                    var min = jointsBoundingBoxes[jointIdx].min.array;
                    var max = jointsBoundingBoxes[jointIdx].max.array;

                    jointsBoundingBoxes[jointIdx].__updated = true;

                    min = vec3.min(min, min, vtxPos);
                    max = vec3.max(max, max, vtxPos);
                }
            }
        }

        this._jointsBoundingBoxes = jointsBoundingBoxes;

        this.boundingBox = new BoundingBox();

        if (maxJointIdx < this.joints.length - 1) {
            console.warn('Geometry joints and skeleton joints don\'t match');
        }
    }
function (geometry) {
        var attributes = geometry.attributes;
        var positionAttr = attributes.position;
        var jointAttr = attributes.joint;
        var weightAttr = attributes.weight;

        var jointsBoundingBoxes = [];
        for (var i = 0; i < this.joints.length; i++) {
            jointsBoundingBoxes[i] = new BoundingBox();
            jointsBoundingBoxes[i].__updated = false;
        }

        var vtxJoint = [];
        var vtxPos = [];
        var vtxWeight = [];
        var maxJointIdx = 0;
        for (var i = 0; i < geometry.vertexCount; i++) {
            jointAttr.get(i, vtxJoint);
            positionAttr.get(i, vtxPos);
            weightAttr.get(i, vtxWeight);

            for (var k = 0; k < 4; k++) {
                if (vtxWeight[k] > 0.01) {
                    var jointIdx = vtxJoint[k];
                    maxJointIdx = Math.max(maxJointIdx, jointIdx);

                    var min = jointsBoundingBoxes[jointIdx].min.array;
                    var max = jointsBoundingBoxes[jointIdx].max.array;

                    jointsBoundingBoxes[jointIdx].__updated = true;

                    min = vec3.min(min, min, vtxPos);
                    max = vec3.max(max, max, vtxPos);
                }
            }
        }

        this._jointsBoundingBoxes = jointsBoundingBoxes;

        this.boundingBox = new BoundingBox();

        if (maxJointIdx < this.joints.length - 1) {
            console.warn('Geometry joints and skeleton joints don\'t match');
        }
    }
function ( geometry ) { var attributes = geometry . attributes ; var positionAttr = attributes . position ; var jointAttr = attributes . joint ; var weightAttr = attributes . weight ; var jointsBoundingBoxes = [ ] ; for ( var i = 0 ; i < this . joints . length ; i ++ ) { jointsBoundingBoxes [ i ] = new BoundingBox ( ) ; jointsBoundingBoxes [ i ] . __updated = false ; } var vtxJoint = [ ] ; var vtxPos = [ ] ; var vtxWeight = [ ] ; var maxJointIdx = 0 ; for ( var i = 0 ; i < geometry . vertexCount ; i ++ ) { jointAttr . get ( i , vtxJoint ) ; positionAttr . get ( i , vtxPos ) ; weightAttr . get ( i , vtxWeight ) ; for ( var k = 0 ; k < 4 ; k ++ ) { if ( vtxWeight [ k ] > 0.01 ) { var jointIdx = vtxJoint [ k ] ; maxJointIdx = Math . max ( maxJointIdx , jointIdx ) ; var min = jointsBoundingBoxes [ jointIdx ] . min . array ; var max = jointsBoundingBoxes [ jointIdx ] . max . array ; jointsBoundingBoxes [ jointIdx ] . __updated = true ; min = vec3 . min ( min , min , vtxPos ) ; max = vec3 . max ( max , max , vtxPos ) ; } } } this . _jointsBoundingBoxes = jointsBoundingBoxes ; this . boundingBox = new BoundingBox ( ) ; if ( maxJointIdx < this . joints . length - 1 ) { console . warn ( 'Geometry joints and skeleton joints don\'t match' ) ; } }
Update boundingBox of each joint bound to geometry.
ASSUME skeleton and geometry joints are matched.
@param {clay.Geometry} geometry
Update boundingBox of each joint bound to geometry . ASSUME skeleton and geometry joints are matched .