public void onAttach ( GVRSceneObject sceneObj ) { super . onAttach ( sceneObj ) ; GVRComponent comp = getComponent ( GVRRenderData . getComponentType ( ) ) ; if ( comp == null ) { throw new IllegalStateException ( "Cannot attach a morph to a scene object without a base mesh" ) ; } GVRMesh mesh = ( ( GVRRenderData ) comp ) . getMesh ( ) ; if ( mesh == null ) { throw new IllegalStateException ( "Cannot attach a morph to a scene object without a base mesh" ) ; } GVRShaderData mtl = getMaterial ( ) ; if ( ( mtl == null ) || ! mtl . getTextureDescriptor ( ) . contains ( "blendshapeTexture" ) ) { throw new IllegalStateException ( "Scene object shader does not support morphing" ) ; } copyBaseShape ( mesh . getVertexBuffer ( ) ) ; mtl . setInt ( "u_numblendshapes" , mNumBlendShapes ) ; mtl . setFloatArray ( "u_blendweights" , mWeights ) ; }
Attaches a morph to scene object with a base mesh