idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
148,200 | public PayloadBuilder sound ( final String sound ) { if ( sound != null ) { aps . put ( "sound" , sound ) ; } else { aps . remove ( "sound" ) ; } return this ; } | Sets the alert sound to be played . | 48 | 9 |
148,201 | public PayloadBuilder category ( final String category ) { if ( category != null ) { aps . put ( "category" , category ) ; } else { aps . remove ( "category" ) ; } return this ; } | Sets the category of the notification for iOS8 notification actions . See 13 minutes into What s new in iOS Notifications | 48 | 24 |
148,202 | public PayloadBuilder customField ( final String key , final Object value ) { root . put ( key , value ) ; return this ; } | Sets any application - specific custom fields . The values are presented to the application and the iPhone doesn t display them automatically . | 29 | 25 |
148,203 | public PayloadBuilder resizeAlertBody ( final int payloadLength , final String postfix ) { int currLength = length ( ) ; if ( currLength <= payloadLength ) { return this ; } // now we are sure that truncation is required String body = ( String ) customAlert . get ( "body" ) ; final int acceptableSize = Utilities . toUTF8Bytes ( body ) . length - ( currLength - payloadLength + Utilities . toUTF8Bytes ( postfix ) . length ) ; body = Utilities . truncateWhenUTF8 ( body , acceptableSize ) + postfix ; // set it back customAlert . put ( "body" , body ) ; // calculate the length again currLength = length ( ) ; if ( currLength > payloadLength ) { // string is still too long, just remove the body as the body is // anyway not the cause OR the postfix might be too long customAlert . remove ( "body" ) ; } return this ; } | Shrinks the alert message body so that the resulting payload message fits within the passed expected payload length . | 208 | 21 |
148,204 | public String build ( ) { if ( ! root . containsKey ( "mdm" ) ) { insertCustomAlert ( ) ; root . put ( "aps" , aps ) ; } try { return mapper . writeValueAsString ( root ) ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; } } | Returns the JSON String representation of the payload according to Apple APNS specification | 72 | 14 |
148,205 | public ApnsServiceBuilder withSocksProxy ( String host , int port ) { Proxy proxy = new Proxy ( Proxy . Type . SOCKS , new InetSocketAddress ( host , port ) ) ; return withProxy ( proxy ) ; } | Specify the address of the SOCKS proxy the connection should use . | 51 | 15 |
148,206 | public ApnsServiceBuilder withAuthProxy ( Proxy proxy , String proxyUsername , String proxyPassword ) { this . proxy = proxy ; this . proxyUsername = proxyUsername ; this . proxyPassword = proxyPassword ; return this ; } | Specify the proxy and the authentication parameters to be used to establish the connections to Apple Servers . | 50 | 20 |
148,207 | @ Deprecated public ApnsServiceBuilder withProxySocket ( Socket proxySocket ) { return this . withProxy ( new Proxy ( Proxy . Type . SOCKS , proxySocket . getRemoteSocketAddress ( ) ) ) ; } | Specify the socket to be used as underlying socket to connect to the APN service . | 47 | 18 |
148,208 | public ApnsServiceBuilder withDelegate ( ApnsDelegate delegate ) { this . delegate = delegate == null ? ApnsDelegate . EMPTY : delegate ; return this ; } | Sets the delegate of the service that gets notified of the status of message delivery . | 38 | 17 |
148,209 | public int length ( ) { int length = 1 + 2 + deviceToken . length + 2 + payload . length ; final int marshalledLength = marshall ( ) . length ; assert marshalledLength == length ; return length ; } | Returns the length of the message in bytes as it is encoded on the wire . | 48 | 16 |
148,210 | public void setPadding ( float padding , Layout . Axis axis ) { OrientedLayout layout = null ; switch ( axis ) { case X : layout = mShiftLayout ; break ; case Y : layout = mShiftLayout ; break ; case Z : layout = mStackLayout ; break ; } if ( layout != null ) { if ( ! equal ( layout . getDividerPadding ( axis ) , padding ) ) { layout . setDividerPadding ( padding , axis ) ; if ( layout . getOrientationAxis ( ) == axis ) { requestLayout ( ) ; } } } } | Sets padding between the pages | 126 | 6 |
148,211 | public void setShiftOrientation ( OrientedLayout . Orientation orientation ) { if ( mShiftLayout . getOrientation ( ) != orientation && orientation != OrientedLayout . Orientation . STACK ) { mShiftLayout . setOrientation ( orientation ) ; requestLayout ( ) ; } } | Sets page shift orientation . The pages might be shifted horizontally or vertically relative to each other to make the content of each page on the screen at least partially visible | 64 | 32 |
148,212 | public boolean removeHandlerFor ( final GVRSceneObject sceneObject ) { sceneObject . detachComponent ( GVRCollider . getComponentType ( ) ) ; return null != touchHandlers . remove ( sceneObject ) ; } | Makes the object unpickable and removes the touch handler for it | 48 | 14 |
148,213 | public void makePickable ( GVRSceneObject sceneObject ) { try { GVRMeshCollider collider = new GVRMeshCollider ( sceneObject . getGVRContext ( ) , false ) ; sceneObject . attachComponent ( collider ) ; } catch ( Exception e ) { // Possible that some objects (X3D panel nodes) are without mesh Log . e ( Log . SUBSYSTEM . INPUT , TAG , "makePickable(): possible that some objects (X3D panel nodes) are without mesh!" ) ; } } | Makes the scene object pickable by eyes . However the object has to be touchable to process the touch events . | 116 | 24 |
148,214 | static boolean isInCircle ( float x , float y , float centerX , float centerY , float radius ) { return Math . abs ( x - centerX ) < radius && Math . abs ( y - centerY ) < radius ; } | Check if a position is within a circle | 51 | 8 |
148,215 | public void setValue ( Quaternionf rot ) { mX = rot . x ; mY = rot . y ; mZ = rot . z ; mW = rot . w ; } | Sets the quaternion of the keyframe . | 41 | 11 |
148,216 | public void update ( int width , int height , float [ ] data ) throws IllegalArgumentException { if ( ( width <= 0 ) || ( height <= 0 ) || ( data == null ) || ( data . length < height * width * mFloatsPerPixel ) ) { throw new IllegalArgumentException ( ) ; } NativeFloatImage . update ( getNative ( ) , width , height , 0 , data ) ; } | Copy new data to an existing float - point texture . | 89 | 11 |
148,217 | public String [ ] getUrl ( ) { String [ ] valueDestination = new String [ url . size ( ) ] ; this . url . getValue ( valueDestination ) ; return valueDestination ; } | Provide array of String results from inputOutput MFString field named url . | 44 | 15 |
148,218 | protected float getSizeArcLength ( float angle ) { if ( mRadius <= 0 ) { throw new IllegalArgumentException ( "mRadius is not specified!" ) ; } return angle == Float . MAX_VALUE ? Float . MAX_VALUE : LayoutHelpers . lengthOfArc ( angle , mRadius ) ; } | Calculate the arc length by angle and radius | 69 | 10 |
148,219 | public void writeLine ( String pattern , Object ... parameters ) { String line = ( parameters == null || parameters . length == 0 ) ? pattern : String . format ( pattern , parameters ) ; lines . add ( 0 , line ) ; // we'll write bottom to top, then purge unwritten // lines from end updateHUD ( ) ; } | Write a message to the console . | 70 | 7 |
148,220 | public void setCanvasWidthHeight ( int width , int height ) { hudWidth = width ; hudHeight = height ; HUD = Bitmap . createBitmap ( width , height , Config . ARGB_8888 ) ; canvas = new Canvas ( HUD ) ; texture = null ; } | Sets the width and height of the canvas the text is drawn to . | 63 | 15 |
148,221 | public static void scale ( GVRMesh mesh , float x , float y , float z ) { final float [ ] vertices = mesh . getVertices ( ) ; final int vsize = vertices . length ; for ( int i = 0 ; i < vsize ; i += 3 ) { vertices [ i ] *= x ; vertices [ i + 1 ] *= y ; vertices [ i + 2 ] *= z ; } mesh . setVertices ( vertices ) ; } | Scale the mesh at x y and z axis . | 105 | 10 |
148,222 | public static void resize ( GVRMesh mesh , float xsize , float ysize , float zsize ) { float dim [ ] = getBoundingSize ( mesh ) ; scale ( mesh , xsize / dim [ 0 ] , ysize / dim [ 1 ] , zsize / dim [ 2 ] ) ; } | Resize the mesh to given size for each axis . | 66 | 11 |
148,223 | public static void resize ( GVRMesh mesh , float size ) { float dim [ ] = getBoundingSize ( mesh ) ; float maxsize = 0.0f ; if ( dim [ 0 ] > maxsize ) maxsize = dim [ 0 ] ; if ( dim [ 1 ] > maxsize ) maxsize = dim [ 1 ] ; if ( dim [ 2 ] > maxsize ) maxsize = dim [ 2 ] ; scale ( mesh , size / maxsize ) ; } | Resize the given mesh keeping its aspect ration . | 101 | 10 |
148,224 | public static float [ ] getBoundingSize ( GVRMesh mesh ) { final float [ ] dim = new float [ 3 ] ; final float [ ] vertices = mesh . getVertices ( ) ; final int vsize = vertices . length ; float minx = Integer . MAX_VALUE ; float miny = Integer . MAX_VALUE ; float minz = Integer . MAX_VALUE ; float maxx = Integer . MIN_VALUE ; float maxy = Integer . MIN_VALUE ; float maxz = Integer . MIN_VALUE ; for ( int i = 0 ; i < vsize ; i += 3 ) { if ( vertices [ i ] < minx ) minx = vertices [ i ] ; if ( vertices [ i ] > maxx ) maxx = vertices [ i ] ; if ( vertices [ i + 1 ] < miny ) miny = vertices [ i + 1 ] ; if ( vertices [ i + 1 ] > maxy ) maxy = vertices [ i + 1 ] ; if ( vertices [ i + 2 ] < minz ) minz = vertices [ i + 2 ] ; if ( vertices [ i + 2 ] > maxz ) maxz = vertices [ i + 2 ] ; } dim [ 0 ] = maxx - minx ; dim [ 1 ] = maxy - miny ; dim [ 2 ] = maxz - minz ; return dim ; } | Calcs the bonding size of given mesh . | 304 | 9 |
148,225 | public static GVRMesh createQuad ( GVRContext gvrContext , float width , float height ) { GVRMesh mesh = new GVRMesh ( gvrContext ) ; float [ ] vertices = { width * - 0.5f , height * 0.5f , 0.0f , width * - 0.5f , height * - 0.5f , 0.0f , width * 0.5f , height * 0.5f , 0.0f , width * 0.5f , height * - 0.5f , 0.0f } ; mesh . setVertices ( vertices ) ; final float [ ] normals = { 0.0f , 0.0f , 1.0f , 0.0f , 0.0f , 1.0f , 0.0f , 0.0f , 1.0f , 0.0f , 0.0f , 1.0f } ; mesh . setNormals ( normals ) ; final float [ ] texCoords = { 0.0f , 0.0f , 0.0f , 1.0f , 1.0f , 0.0f , 1.0f , 1.0f } ; mesh . setTexCoords ( texCoords ) ; char [ ] triangles = { 0 , 1 , 2 , 1 , 3 , 2 } ; mesh . setIndices ( triangles ) ; return mesh ; } | Creates a quad consisting of two triangles with the specified width and height . | 309 | 15 |
148,226 | void onSurfaceChanged ( int width , int height ) { Log . v ( TAG , "onSurfaceChanged" ) ; final VrAppSettings . EyeBufferParams . DepthFormat depthFormat = mApplication . getAppSettings ( ) . getEyeBufferParams ( ) . getDepthFormat ( ) ; mApplication . getConfigurationManager ( ) . configureRendering ( VrAppSettings . EyeBufferParams . DepthFormat . DEPTH_24_STENCIL_8 == depthFormat ) ; } | Called when the surface is created or recreated . Avoided because this can be called twice at the beginning . | 110 | 23 |
148,227 | void onDrawEye ( int eye , int swapChainIndex , boolean use_multiview ) { mCurrentEye = eye ; if ( ! ( mSensoredScene == null || ! mMainScene . equals ( mSensoredScene ) ) ) { GVRCameraRig mainCameraRig = mMainScene . getMainCameraRig ( ) ; if ( use_multiview ) { if ( DEBUG_STATS ) { mTracerDrawEyes1 . enter ( ) ; // this eye is drawn first mTracerDrawEyes2 . enter ( ) ; } GVRRenderTarget renderTarget = mRenderBundle . getRenderTarget ( EYE . MULTIVIEW , swapChainIndex ) ; GVRCamera camera = mMainScene . getMainCameraRig ( ) . getCenterCamera ( ) ; GVRCamera left_camera = mMainScene . getMainCameraRig ( ) . getLeftCamera ( ) ; renderTarget . cullFromCamera ( mMainScene , camera , mRenderBundle . getShaderManager ( ) ) ; captureCenterEye ( renderTarget , true ) ; capture3DScreenShot ( renderTarget , true ) ; renderTarget . render ( mMainScene , left_camera , mRenderBundle . getShaderManager ( ) , mRenderBundle . getPostEffectRenderTextureA ( ) , mRenderBundle . getPostEffectRenderTextureB ( ) ) ; captureRightEye ( renderTarget , true ) ; captureLeftEye ( renderTarget , true ) ; captureFinish ( ) ; if ( DEBUG_STATS ) { mTracerDrawEyes1 . leave ( ) ; mTracerDrawEyes2 . leave ( ) ; } } else { if ( eye == 1 ) { if ( DEBUG_STATS ) { mTracerDrawEyes1 . enter ( ) ; } GVRCamera rightCamera = mainCameraRig . getRightCamera ( ) ; GVRRenderTarget renderTarget = mRenderBundle . getRenderTarget ( EYE . RIGHT , swapChainIndex ) ; renderTarget . render ( mMainScene , rightCamera , mRenderBundle . getShaderManager ( ) , mRenderBundle . getPostEffectRenderTextureA ( ) , mRenderBundle . getPostEffectRenderTextureB ( ) ) ; captureRightEye ( renderTarget , false ) ; captureFinish ( ) ; if ( DEBUG_STATS ) { mTracerDrawEyes1 . leave ( ) ; mTracerDrawEyes . leave ( ) ; } } else { if ( DEBUG_STATS ) { mTracerDrawEyes1 . leave ( ) ; mTracerDrawEyes . leave ( ) ; } GVRRenderTarget renderTarget = mRenderBundle . getRenderTarget ( EYE . LEFT , swapChainIndex ) ; GVRCamera leftCamera = mainCameraRig . getLeftCamera ( ) ; capture3DScreenShot ( renderTarget , false ) ; renderTarget . cullFromCamera ( mMainScene , mainCameraRig . getCenterCamera ( ) , mRenderBundle . getShaderManager ( ) ) ; captureCenterEye ( renderTarget , false ) ; renderTarget . render ( mMainScene , leftCamera , mRenderBundle . getShaderManager ( ) , mRenderBundle . getPostEffectRenderTextureA ( ) , mRenderBundle . getPostEffectRenderTextureB ( ) ) ; captureLeftEye ( renderTarget , false ) ; if ( DEBUG_STATS ) { mTracerDrawEyes2 . leave ( ) ; } } } } } | Called from the native side | 766 | 6 |
148,228 | public GVRAndroidResource openResource ( String filePath ) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if ( filePath . startsWith ( File . separator ) ) { filePath = filePath . substring ( File . separator . length ( ) ) ; } filePath = adaptFilePath ( filePath ) ; String path ; int resourceId ; GVRAndroidResource resourceKey ; switch ( volumeType ) { case ANDROID_ASSETS : // Resolve '..' and '.' path = getFullPath ( defaultPath , filePath ) ; path = new File ( path ) . getCanonicalPath ( ) ; if ( path . startsWith ( File . separator ) ) { path = path . substring ( 1 ) ; } resourceKey = new GVRAndroidResource ( gvrContext , path ) ; break ; case ANDROID_RESOURCE : path = FileNameUtils . getBaseName ( filePath ) ; resourceId = gvrContext . getContext ( ) . getResources ( ) . getIdentifier ( path , "raw" , gvrContext . getContext ( ) . getPackageName ( ) ) ; if ( resourceId == 0 ) { throw new FileNotFoundException ( filePath + " resource not found" ) ; } resourceKey = new GVRAndroidResource ( gvrContext , resourceId ) ; break ; case LINUX_FILESYSTEM : resourceKey = new GVRAndroidResource ( getFullPath ( defaultPath , filePath ) ) ; break ; case ANDROID_SDCARD : String linuxPath = Environment . getExternalStorageDirectory ( ) . getAbsolutePath ( ) ; resourceKey = new GVRAndroidResource ( getFullPath ( linuxPath , defaultPath , filePath ) ) ; break ; case INPUT_STREAM : resourceKey = new GVRAndroidResource ( getFullPath ( defaultPath , filePath ) , volumeInputStream ) ; break ; case NETWORK : resourceKey = new GVRAndroidResource ( gvrContext , getFullURL ( defaultPath , filePath ) , enableUrlLocalCache ) ; break ; default : throw new IOException ( String . format ( "Unrecognized volumeType %s" , volumeType ) ) ; } return addResource ( resourceKey ) ; } | Opens a file from the volume . The filePath is relative to the defaultPath . | 513 | 18 |
148,229 | protected String adaptFilePath ( String filePath ) { // Convert windows file path to target FS String targetPath = filePath . replaceAll ( "\\\\" , volumeType . getSeparator ( ) ) ; return targetPath ; } | Adapt a file path to the current file system . | 49 | 10 |
148,230 | public FloatBuffer getFloatVec ( String attributeName ) { int size = getAttributeSize ( attributeName ) ; if ( size <= 0 ) { return null ; } size *= 4 * getVertexCount ( ) ; ByteBuffer buffer = ByteBuffer . allocateDirect ( size ) . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer data = buffer . asFloatBuffer ( ) ; if ( ! NativeVertexBuffer . getFloatVec ( getNative ( ) , attributeName , data , 0 , 0 ) ) { throw new IllegalArgumentException ( "Attribute name " + attributeName + " cannot be accessed" ) ; } return data ; } | Retrieves a vertex attribute as a float buffer . The attribute name must be one of the attributes named in the descriptor passed to the constructor . | 139 | 29 |
148,231 | public float [ ] getFloatArray ( String attributeName ) { float [ ] array = NativeVertexBuffer . getFloatArray ( getNative ( ) , attributeName ) ; if ( array == null ) { throw new IllegalArgumentException ( "Attribute name " + attributeName + " cannot be accessed" ) ; } return array ; } | Retrieves a vertex attribute as a float array . The attribute name must be one of the attributes named in the descriptor passed to the constructor . | 70 | 29 |
148,232 | public IntBuffer getIntVec ( String attributeName ) { int size = getAttributeSize ( attributeName ) ; if ( size <= 0 ) { return null ; } size *= 4 * getVertexCount ( ) ; ByteBuffer buffer = ByteBuffer . allocateDirect ( size ) . order ( ByteOrder . nativeOrder ( ) ) ; IntBuffer data = buffer . asIntBuffer ( ) ; if ( ! NativeVertexBuffer . getIntVec ( getNative ( ) , attributeName , data , 0 , 0 ) ) { throw new IllegalArgumentException ( "Attribute name " + attributeName + " cannot be accessed" ) ; } return data ; } | Retrieves a vertex attribute as an integer buffer . The attribute name must be one of the attributes named in the descriptor passed to the constructor . | 139 | 29 |
148,233 | public int [ ] getIntArray ( String attributeName ) { int [ ] array = NativeVertexBuffer . getIntArray ( getNative ( ) , attributeName ) ; if ( array == null ) { throw new IllegalArgumentException ( "Attribute name " + attributeName + " cannot be accessed" ) ; } return array ; } | Retrieves a vertex attribute as an integer array . The attribute name must be one of the attributes named in the descriptor passed to the constructor . | 70 | 29 |
148,234 | public float getSphereBound ( float [ ] sphere ) { if ( ( sphere == null ) || ( sphere . length != 4 ) || ( ( NativeVertexBuffer . getBoundingVolume ( getNative ( ) , sphere ) ) < 0 ) ) { throw new IllegalArgumentException ( "Cannot copy sphere bound into array provided" ) ; } return sphere [ 0 ] ; } | Returns the bounding sphere of the vertices . | 80 | 10 |
148,235 | public boolean getBoxBound ( float [ ] corners ) { int rc ; if ( ( corners == null ) || ( corners . length != 6 ) || ( ( rc = NativeVertexBuffer . getBoundingVolume ( getNative ( ) , corners ) ) < 0 ) ) { throw new IllegalArgumentException ( "Cannot copy box bound into array provided" ) ; } return rc != 0 ; } | Returns the bounding box of the vertices . | 84 | 10 |
148,236 | public void load ( String soundFile ) { if ( mSoundFile != null ) { unload ( ) ; } mSoundFile = soundFile ; if ( mAudioListener != null ) { mAudioListener . getAudioEngine ( ) . preloadSoundFile ( soundFile ) ; Log . d ( "SOUND" , "loaded audio file %s" , getSoundFile ( ) ) ; } } | Preloads a sound file . | 85 | 6 |
148,237 | public void unload ( ) { if ( mAudioListener != null ) { Log . d ( "SOUND" , "unloading audio source %d %s" , getSourceId ( ) , getSoundFile ( ) ) ; mAudioListener . getAudioEngine ( ) . unloadSoundFile ( getSoundFile ( ) ) ; } mSoundFile = null ; mSourceId = GvrAudioEngine . INVALID_ID ; } | Unloads the sound file for this source if any . | 94 | 11 |
148,238 | public void pause ( ) { if ( mAudioListener != null ) { int sourceId = getSourceId ( ) ; if ( sourceId != GvrAudioEngine . INVALID_ID ) { mAudioListener . getAudioEngine ( ) . pauseSound ( sourceId ) ; } } } | Pauses the playback of a sound . | 62 | 8 |
148,239 | public void stop ( ) { if ( mAudioListener != null ) { Log . d ( "SOUND" , "stopping audio source %d %s" , getSourceId ( ) , getSoundFile ( ) ) ; mAudioListener . getAudioEngine ( ) . stopSound ( getSourceId ( ) ) ; } } | Stops the playback of a sound and destroys the corresponding Sound Object or Soundfield . | 70 | 17 |
148,240 | public void setVolume ( float volume ) { // Save this in case this audio source is not being played yet mVolume = volume ; if ( isPlaying ( ) && ( getSourceId ( ) != GvrAudioEngine . INVALID_ID ) ) { // This will actually work only if the sound file is being played mAudioListener . getAudioEngine ( ) . setSoundVolume ( getSourceId ( ) , getVolume ( ) ) ; } } | Changes the volume of an existing sound . | 95 | 8 |
148,241 | public float get ( Layout . Axis axis ) { switch ( axis ) { case X : return x ; case Y : return y ; case Z : return z ; default : throw new RuntimeAssertion ( "Bad axis specified: %s" , axis ) ; } } | Gets axis dimension | 56 | 4 |
148,242 | public void set ( float val , Layout . Axis axis ) { switch ( axis ) { case X : x = val ; break ; case Y : y = val ; break ; case Z : z = val ; break ; default : throw new RuntimeAssertion ( "Bad axis specified: %s" , axis ) ; } } | Sets axis dimension | 68 | 4 |
148,243 | public Vector3Axis delta ( Vector3f v ) { Vector3Axis ret = new Vector3Axis ( Float . NaN , Float . NaN , Float . NaN ) ; if ( x != Float . NaN && v . x != Float . NaN && ! equal ( x , v . x ) ) { ret . set ( x - v . x , Layout . Axis . X ) ; } if ( y != Float . NaN && v . y != Float . NaN && ! equal ( y , v . y ) ) { ret . set ( y - v . y , Layout . Axis . Y ) ; } if ( z != Float . NaN && v . z != Float . NaN && ! equal ( z , v . z ) ) { ret . set ( z - v . z , Layout . Axis . Z ) ; } return ret ; } | Calculate delta with another vector | 186 | 7 |
148,244 | public int setPageCount ( final int num ) { int diff = num - getCheckableCount ( ) ; if ( diff > 0 ) { addIndicatorChildren ( diff ) ; } else if ( diff < 0 ) { removeIndicatorChildren ( - diff ) ; } if ( mCurrentPage >= num ) { mCurrentPage = 0 ; } setCurrentPage ( mCurrentPage ) ; return diff ; } | Sets number of pages . If the index of currently selected page is bigger than the total number of pages first page will be selected instead . | 86 | 28 |
148,245 | public boolean setCurrentPage ( final int page ) { Log . d ( TAG , "setPageId pageId = %d" , page ) ; return ( page >= 0 && page < getCheckableCount ( ) ) && check ( page ) ; } | Sets selected page implicitly | 53 | 5 |
148,246 | public void loadPhysics ( String filename , GVRScene scene ) throws IOException { GVRPhysicsLoader . loadPhysicsFile ( getGVRContext ( ) , filename , true , scene ) ; } | Load physics information for the current avatar | 44 | 7 |
148,247 | public void rotateToFaceCamera ( final GVRTransform transform ) { //see http://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion final GVRTransform t = getMainCameraRig ( ) . getHeadTransform ( ) ; final Quaternionf q = new Quaternionf ( 0 , t . getRotationY ( ) , 0 , t . getRotationW ( ) ) . normalize ( ) ; transform . rotateWithPivot ( q . w , q . x , q . y , q . z , 0 , 0 , 0 ) ; } | Apply the necessary rotation to the transform so that it is in front of the camera . | 137 | 17 |
148,248 | public float rotateToFaceCamera ( final Widget widget ) { final float yaw = getMainCameraRigYaw ( ) ; GVRTransform t = getMainCameraRig ( ) . getHeadTransform ( ) ; widget . rotateWithPivot ( t . getRotationW ( ) , 0 , t . getRotationY ( ) , 0 , 0 , 0 , 0 ) ; return yaw ; } | Apply the necessary rotation to the transform so that it is in front of the camera . The actual rotation is performed not using the yaw angle but using equivalent quaternion values for better accuracy . But the yaw angle is still returned for backward compatibility . | 88 | 51 |
148,249 | public void updateFrontFacingRotation ( float rotation ) { if ( ! Float . isNaN ( rotation ) && ! equal ( rotation , frontFacingRotation ) ) { final float oldRotation = frontFacingRotation ; frontFacingRotation = rotation % 360 ; for ( OnFrontRotationChangedListener listener : mOnFrontRotationChangedListeners ) { try { listener . onFrontRotationChanged ( this , frontFacingRotation , oldRotation ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . e ( TAG , e , "updateFrontFacingRotation()" ) ; } } } } | Set new front facing rotation | 142 | 5 |
148,250 | public void rotateToFront ( ) { GVRTransform transform = mSceneRootObject . getTransform ( ) ; transform . setRotation ( 1 , 0 , 0 , 0 ) ; transform . rotateByAxisWithPivot ( - frontFacingRotation + 180 , 0 , 1 , 0 , 0 , 0 , 0 ) ; } | Rotate root widget to make it facing to the front of the scene | 71 | 14 |
148,251 | public void setScale ( final float scale ) { if ( equal ( mScale , scale ) != true ) { Log . d ( TAG , "setScale(): old: %.2f, new: %.2f" , mScale , scale ) ; mScale = scale ; setScale ( mSceneRootObject , scale ) ; setScale ( mMainCameraRootObject , scale ) ; setScale ( mLeftCameraRootObject , scale ) ; setScale ( mRightCameraRootObject , scale ) ; for ( OnScaledListener listener : mOnScaledListeners ) { try { listener . onScaled ( scale ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . e ( TAG , e , "setScale()" ) ; } } } } | Scale all widgets in Main Scene hierarchy | 168 | 7 |
148,252 | public GVRAnimation setRepeatMode ( int repeatMode ) { if ( GVRRepeatMode . invalidRepeatMode ( repeatMode ) ) { throw new IllegalArgumentException ( repeatMode + " is not a valid repetition type" ) ; } mRepeatMode = repeatMode ; return this ; } | Set the repeat type . | 61 | 5 |
148,253 | public GVRAnimation setOffset ( float startOffset ) { if ( startOffset < 0 || startOffset > mDuration ) { throw new IllegalArgumentException ( "offset should not be either negative or greater than duration" ) ; } animationOffset = startOffset ; mDuration = mDuration - animationOffset ; return this ; } | Sets the offset for the animation . | 67 | 8 |
148,254 | public GVRAnimation setDuration ( float start , float end ) { if ( start > end || start < 0 || end > mDuration ) { throw new IllegalArgumentException ( "start and end values are wrong" ) ; } animationOffset = start ; mDuration = end - start ; return this ; } | Sets the duration for the animation to be played . | 64 | 11 |
148,255 | public GVRAnimation setOnFinish ( GVROnFinish callback ) { mOnFinish = callback ; // Do the instance-of test at set-time, not at use-time mOnRepeat = callback instanceof GVROnRepeat ? ( GVROnRepeat ) callback : null ; if ( mOnRepeat != null ) { mRepeatCount = - 1 ; // loop until iterate() returns false } return this ; } | Set the on - finish callback . | 89 | 7 |
148,256 | public synchronized void bindShader ( GVRScene scene , boolean isMultiview ) { GVRRenderPass pass = mRenderPassList . get ( 0 ) ; GVRShaderId shader = pass . getMaterial ( ) . getShaderType ( ) ; GVRShader template = shader . getTemplate ( getGVRContext ( ) ) ; if ( template != null ) { template . bindShader ( getGVRContext ( ) , this , scene , isMultiview ) ; } for ( int i = 1 ; i < mRenderPassList . size ( ) ; ++ i ) { pass = mRenderPassList . get ( i ) ; shader = pass . getMaterial ( ) . getShaderType ( ) ; template = shader . getTemplate ( getGVRContext ( ) ) ; if ( template != null ) { template . bindShader ( getGVRContext ( ) , pass , scene , isMultiview ) ; } } } | Selects a specific vertex and fragment shader to use for rendering . | 204 | 13 |
148,257 | public GVRRenderData setCullFace ( GVRCullFaceEnum cullFace , int passIndex ) { if ( passIndex < mRenderPassList . size ( ) ) { mRenderPassList . get ( passIndex ) . setCullFace ( cullFace ) ; } else { Log . e ( TAG , "Trying to set cull face to a invalid pass. Pass " + passIndex + " was not created." ) ; } return this ; } | Set the face to be culled | 99 | 7 |
148,258 | public GVRRenderData setDrawMode ( int drawMode ) { if ( drawMode != GL_POINTS && drawMode != GL_LINES && drawMode != GL_LINE_STRIP && drawMode != GL_LINE_LOOP && drawMode != GL_TRIANGLES && drawMode != GL_TRIANGLE_STRIP && drawMode != GL_TRIANGLE_FAN ) { throw new IllegalArgumentException ( "drawMode must be one of GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP." ) ; } NativeRenderData . setDrawMode ( getNative ( ) , drawMode ) ; return this ; } | Set the draw mode for this mesh . Default is GL_TRIANGLES . | 180 | 17 |
148,259 | public boolean fling ( float velocityX , float velocityY , float velocityZ ) { boolean scrolled = true ; float viewportX = mScrollable . getViewPortWidth ( ) ; if ( Float . isNaN ( viewportX ) ) { viewportX = 0 ; } float maxX = Math . min ( MAX_SCROLLING_DISTANCE , viewportX * MAX_VIEWPORT_LENGTHS ) ; float viewportY = mScrollable . getViewPortHeight ( ) ; if ( Float . isNaN ( viewportY ) ) { viewportY = 0 ; } float maxY = Math . min ( MAX_SCROLLING_DISTANCE , viewportY * MAX_VIEWPORT_LENGTHS ) ; float xOffset = ( maxX * velocityX ) / VELOCITY_MAX ; float yOffset = ( maxY * velocityY ) / VELOCITY_MAX ; Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "fling() velocity = [%f, %f, %f] offset = [%f, %f]" , velocityX , velocityY , velocityZ , xOffset , yOffset ) ; if ( equal ( xOffset , 0 ) ) { xOffset = Float . NaN ; } if ( equal ( yOffset , 0 ) ) { yOffset = Float . NaN ; } // TODO: Think about Z-scrolling mScrollable . scrollByOffset ( xOffset , yOffset , Float . NaN , mInternalScrollListener ) ; return scrolled ; } | Fling the content | 341 | 4 |
148,260 | public int scrollToNextPage ( ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "scrollToNextPage getCurrentPage() = %d currentIndex = %d" , getCurrentPage ( ) , mCurrentItemIndex ) ; if ( mSupportScrollByPage ) { scrollToPage ( getCurrentPage ( ) + 1 ) ; } else { Log . w ( TAG , "Pagination is not enabled!" ) ; } return mCurrentItemIndex ; } | Scroll to the next page . To process the scrolling by pages LayoutScroller must be constructed with a pageSize greater than zero . | 106 | 26 |
148,261 | public int scrollToPage ( int pageNumber ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "scrollToPage pageNumber = %d mPageCount = %d" , pageNumber , mPageCount ) ; if ( mSupportScrollByPage && ( mScrollOver || ( pageNumber >= 0 && pageNumber <= mPageCount - 1 ) ) ) { scrollToItem ( getFirstItemIndexOnPage ( pageNumber ) ) ; } else { Log . w ( TAG , "Pagination is not enabled!" ) ; } return mCurrentItemIndex ; } | Scroll to specific page . The final page might be different from the requested one if the requested page is larger than the last page . To process the scrolling by pages LayoutScroller must be constructed with a pageSize greater than zero . | 127 | 46 |
148,262 | public int scrollToItem ( int position ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "scrollToItem position = %d" , position ) ; scrollToPosition ( position ) ; return mCurrentItemIndex ; } | Scroll to the specific position | 54 | 5 |
148,263 | public int getCurrentPage ( ) { int currentPage = 1 ; int count = mScrollable . getScrollingItemsCount ( ) ; if ( mSupportScrollByPage && mCurrentItemIndex >= 0 && mCurrentItemIndex < count ) { currentPage = ( Math . min ( mCurrentItemIndex + mPageSize - 1 , count - 1 ) / mPageSize ) ; } return currentPage ; } | Gets the current page | 87 | 5 |
148,264 | public String getName ( ) { GVRSceneObject owner = getOwnerObject ( ) ; String name = "" ; if ( owner != null ) { name = owner . getName ( ) ; if ( name == null ) return "" ; } return name ; } | Returns the name of the bone . | 54 | 7 |
148,265 | public void setFinalTransformMatrix ( Matrix4f finalTransform ) { float [ ] mat = new float [ 16 ] ; finalTransform . get ( mat ) ; NativeBone . setFinalTransformMatrix ( getNative ( ) , mat ) ; } | Sets the final transform of the bone during animation . | 50 | 11 |
148,266 | public Matrix4f getFinalTransformMatrix ( ) { final FloatBuffer fb = ByteBuffer . allocateDirect ( 4 * 4 * 4 ) . order ( ByteOrder . nativeOrder ( ) ) . asFloatBuffer ( ) ; NativeBone . getFinalTransformMatrix ( getNative ( ) , fb ) ; return new Matrix4f ( fb ) ; } | Gets the final transform of the bone . | 75 | 9 |
148,267 | @ Override public void prettyPrint ( StringBuffer sb , int indent ) { sb . append ( Log . getSpaces ( indent ) ) ; sb . append ( GVRBone . class . getSimpleName ( ) ) ; sb . append ( " [name=" + getName ( ) + ", boneId=" + getBoneId ( ) + ", offsetMatrix=" + getOffsetMatrix ( ) + ", finalTransformMatrix=" + getFinalTransformMatrix ( ) // crashes debugger + "]" ) ; sb . append ( System . lineSeparator ( ) ) ; } | Pretty - print the object . | 123 | 6 |
148,268 | public void update ( int width , int height , int sampleCount ) { if ( capturing ) { throw new IllegalStateException ( "Cannot update backing texture while capturing" ) ; } this . width = width ; this . height = height ; if ( sampleCount == 0 ) captureTexture = new GVRRenderTexture ( getGVRContext ( ) , width , height ) ; else captureTexture = new GVRRenderTexture ( getGVRContext ( ) , width , height , sampleCount ) ; setRenderTexture ( captureTexture ) ; readBackBuffer = new int [ width * height ] ; } | Updates the backing render texture . This method should not be called when capturing is in progress . | 124 | 19 |
148,269 | public void setCapture ( boolean capture , float fps ) { capturing = capture ; NativeTextureCapturer . setCapture ( getNative ( ) , capture , fps ) ; } | Starts or stops capturing . | 35 | 6 |
148,270 | public void setTexture ( GVRRenderTexture texture ) { mTexture = texture ; NativeRenderTarget . setTexture ( getNative ( ) , texture . getNative ( ) ) ; } | Sets the texture this render target will render to . If no texture is provided the render target will not render anything . | 38 | 24 |
148,271 | public < T extends Widget & Checkable > boolean addOnCheckChangedListener ( OnCheckChangedListener listener ) { final boolean added ; synchronized ( mListeners ) { added = mListeners . add ( listener ) ; } if ( added ) { List < T > c = getCheckableChildren ( ) ; for ( int i = 0 ; i < c . size ( ) ; ++ i ) { listener . onCheckChanged ( this , c . get ( i ) , i ) ; } } return added ; } | Add a listener to be invoked when the checked button changes in this group . | 108 | 15 |
148,272 | public < T extends Widget & Checkable > boolean check ( int checkableIndex ) { List < T > children = getCheckableChildren ( ) ; T checkableWidget = children . get ( checkableIndex ) ; return checkInternal ( checkableWidget , true ) ; } | Checks the widget by index | 58 | 6 |
148,273 | public < T extends Widget & Checkable > boolean uncheck ( int checkableIndex ) { List < T > children = getCheckableChildren ( ) ; T checkableWidget = children . get ( checkableIndex ) ; return checkInternal ( checkableWidget , false ) ; } | Unchecks the widget by index | 59 | 6 |
148,274 | public < T extends Widget & Checkable > void clearChecks ( ) { List < T > children = getCheckableChildren ( ) ; for ( T c : children ) { c . setChecked ( false ) ; } } | Clears all checked widgets in the group | 49 | 8 |
148,275 | public < T extends Widget & Checkable > List < T > getCheckedWidgets ( ) { List < T > checked = new ArrayList <> ( ) ; for ( Widget c : getChildren ( ) ) { if ( c instanceof Checkable && ( ( Checkable ) c ) . isChecked ( ) ) { checked . add ( ( T ) c ) ; } } return checked ; } | Gets all checked widgets in the group | 88 | 8 |
148,276 | public < T extends Widget & Checkable > List < Integer > getCheckedWidgetIndexes ( ) { List < Integer > checked = new ArrayList <> ( ) ; List < Widget > children = getChildren ( ) ; final int size = children . size ( ) ; for ( int i = 0 , j = - 1 ; i < size ; ++ i ) { Widget c = children . get ( i ) ; if ( c instanceof Checkable ) { ++ j ; if ( ( ( Checkable ) c ) . isChecked ( ) ) { checked . add ( j ) ; } } } return checked ; } | Gets all checked widget indexes in the group . The indexes are counted from 0 to size - 1 where size is the number of Checkable widgets in the group . It does not take into account any non - Checkable widgets added to the group widget . | 133 | 51 |
148,277 | public < T extends Widget & Checkable > List < T > getCheckableChildren ( ) { List < Widget > children = getChildren ( ) ; ArrayList < T > result = new ArrayList <> ( ) ; for ( Widget c : children ) { if ( c instanceof Checkable ) { result . add ( ( T ) c ) ; } } return result ; } | Gets all Checkable widgets in the group | 82 | 9 |
148,278 | public boolean setUpCameraForVrMode ( final int fpsMode ) { cameraSetUpStatus = false ; this . fpsMode = fpsMode ; if ( ! isCameraOpen ) { Log . e ( TAG , "Camera is not open" ) ; return false ; } if ( fpsMode < 0 || fpsMode > 2 ) { Log . e ( TAG , "Invalid fpsMode: %d. It can only take values 0, 1, or 2." , fpsMode ) ; } else { Parameters params = camera . getParameters ( ) ; // check if the device supports vr mode preview if ( "true" . equalsIgnoreCase ( params . get ( "vrmode-supported" ) ) ) { Log . v ( TAG , "VR Mode supported!" ) ; // set vr mode params . set ( "vrmode" , 1 ) ; // true if the apps intend to record videos using // MediaRecorder params . setRecordingHint ( true ) ; // set preview size // params.setPreviewSize(640, 480); // set fast-fps-mode: 0 for 30fps, 1 for 60 fps, // 2 for 120 fps params . set ( "fast-fps-mode" , fpsMode ) ; switch ( fpsMode ) { case 0 : // 30 fps params . setPreviewFpsRange ( 30000 , 30000 ) ; break ; case 1 : // 60 fps params . setPreviewFpsRange ( 60000 , 60000 ) ; break ; case 2 : // 120 fps params . setPreviewFpsRange ( 120000 , 120000 ) ; break ; default : } // for auto focus params . set ( "focus-mode" , "continuous-video" ) ; params . setVideoStabilization ( false ) ; if ( "true" . equalsIgnoreCase ( params . get ( "ois-supported" ) ) ) { params . set ( "ois" , "center" ) ; } camera . setParameters ( params ) ; cameraSetUpStatus = true ; } } return cameraSetUpStatus ; } | Configure high fps settings in the camera for VR mode | 431 | 11 |
148,279 | static GVROrthogonalCamera makeOrthoShadowCamera ( GVRPerspectiveCamera centerCam ) { GVROrthogonalCamera shadowCam = new GVROrthogonalCamera ( centerCam . getGVRContext ( ) ) ; float near = centerCam . getNearClippingDistance ( ) ; float far = centerCam . getFarClippingDistance ( ) ; float fovy = ( float ) Math . toRadians ( centerCam . getFovY ( ) ) ; float h = ( float ) ( Math . atan ( fovy / 2.0f ) * far ) / 2.0f ; shadowCam . setLeftClippingDistance ( - h ) ; shadowCam . setRightClippingDistance ( h ) ; shadowCam . setTopClippingDistance ( h ) ; shadowCam . setBottomClippingDistance ( - h ) ; shadowCam . setNearClippingDistance ( near ) ; shadowCam . setFarClippingDistance ( far ) ; return shadowCam ; } | Adds an orthographic camera constructed from the designated perspective camera to describe the shadow projection . The field of view and aspect ration of the perspective camera are used to obtain the view volume of the orthographic camera . This type of camera is used for shadows generated by direct lights at infinite distance . | 215 | 57 |
148,280 | static GVRPerspectiveCamera makePerspShadowCamera ( GVRPerspectiveCamera centerCam , float coneAngle ) { GVRPerspectiveCamera camera = new GVRPerspectiveCamera ( centerCam . getGVRContext ( ) ) ; float near = centerCam . getNearClippingDistance ( ) ; float far = centerCam . getFarClippingDistance ( ) ; camera . setNearClippingDistance ( near ) ; camera . setFarClippingDistance ( far ) ; camera . setFovY ( ( float ) Math . toDegrees ( coneAngle ) ) ; camera . setAspectRatio ( 1.0f ) ; return camera ; } | Adds a perspective camera constructed from the designated perspective camera to describe the shadow projection . This type of camera is used for shadows generated by spot lights . | 146 | 29 |
148,281 | private void SetNewViewpoint ( String url ) { Viewpoint vp = null ; // get the name without the '#' sign String vpURL = url . substring ( 1 , url . length ( ) ) ; for ( Viewpoint viewpoint : viewpoints ) { if ( viewpoint . getName ( ) . equalsIgnoreCase ( vpURL ) ) { vp = viewpoint ; } } if ( vp != null ) { // found the Viewpoint matching the url GVRCameraRig mainCameraRig = gvrContext . getMainScene ( ) . getMainCameraRig ( ) ; float [ ] cameraPosition = vp . getPosition ( ) ; mainCameraRig . getTransform ( ) . setPosition ( cameraPosition [ 0 ] , cameraPosition [ 1 ] , cameraPosition [ 2 ] ) ; // Set the Gaze controller position which is where the pick ray // begins in the direction of camera.lookt() GVRCursorController gazeController = null ; GVRInputManager inputManager = gvrContext . getInputManager ( ) ; List < GVRCursorController > controllerList = inputManager . getCursorControllers ( ) ; for ( GVRCursorController controller : controllerList ) { if ( controller . getControllerType ( ) == GVRControllerType . GAZE ) ; { gazeController = controller ; break ; } } if ( gazeController != null ) { gazeController . setOrigin ( cameraPosition [ 0 ] , cameraPosition [ 1 ] , cameraPosition [ 2 ] ) ; } } else { Log . e ( TAG , "Viewpoint named " + vpURL + " not found (defined)." ) ; } } | end AnchorImplementation class | 352 | 6 |
148,282 | private void WebPageCloseOnClick ( GVRViewSceneObject gvrWebViewSceneObject , GVRSceneObject gvrSceneObjectAnchor , String url ) { final String urlFinal = url ; webPagePlusUISceneObject = new GVRSceneObject ( gvrContext ) ; webPagePlusUISceneObject . getTransform ( ) . setPosition ( webPagePlusUIPosition [ 0 ] , webPagePlusUIPosition [ 1 ] , webPagePlusUIPosition [ 2 ] ) ; GVRScene mainScene = gvrContext . getMainScene ( ) ; Sensor webPageSensor = new Sensor ( urlFinal , Sensor . Type . TOUCH , gvrWebViewSceneObject , true ) ; final GVRSceneObject gvrSceneObjectAnchorFinal = gvrSceneObjectAnchor ; final GVRSceneObject gvrWebViewSceneObjectFinal = gvrWebViewSceneObject ; final GVRSceneObject webPagePlusUISceneObjectFinal = webPagePlusUISceneObject ; webPagePlusUISceneObjectFinal . addChildObject ( gvrWebViewSceneObjectFinal ) ; gvrSceneObjectAnchorFinal . addChildObject ( webPagePlusUISceneObjectFinal ) ; webPageSensor . addISensorEvents ( new ISensorEvents ( ) { boolean uiObjectIsActive = false ; boolean clickDown = true ; @ Override public void onSensorEvent ( SensorEvent event ) { if ( event . isActive ( ) ) { clickDown = ! clickDown ; if ( clickDown ) { // Delete the WebView page gvrSceneObjectAnchorFinal . removeChildObject ( webPagePlusUISceneObjectFinal ) ; webPageActive = false ; webPagePlusUISceneObject = null ; webPageClosed = true ; // Make sure click up doesn't open web page behind it } } } } ) ; } | Display web page but no user interface - close | 410 | 9 |
148,283 | public Axis getOrientationAxis ( ) { final Axis axis ; switch ( getOrientation ( ) ) { case HORIZONTAL : axis = Axis . X ; break ; case VERTICAL : axis = Axis . Y ; break ; case STACK : axis = Axis . Z ; break ; default : Log . w ( TAG , "Unsupported orientation %s" , mOrientation ) ; axis = Axis . X ; break ; } return axis ; } | Get the axis along the orientation | 99 | 6 |
148,284 | public boolean attachComponent ( GVRComponent component ) { if ( component . getNative ( ) != 0 ) { NativeSceneObject . attachComponent ( getNative ( ) , component . getNative ( ) ) ; } synchronized ( mComponents ) { long type = component . getType ( ) ; if ( ! mComponents . containsKey ( type ) ) { mComponents . put ( type , component ) ; component . setOwnerObject ( this ) ; return true ; } } return false ; } | Attach a component to this scene object . | 104 | 8 |
148,285 | public GVRComponent detachComponent ( long type ) { NativeSceneObject . detachComponent ( getNative ( ) , type ) ; synchronized ( mComponents ) { GVRComponent component = mComponents . remove ( type ) ; if ( component != null ) { component . setOwnerObject ( null ) ; } return component ; } } | Detach the component of the specified type from this scene object . | 69 | 13 |
148,286 | @ SuppressWarnings ( "unchecked" ) public < T extends GVRComponent > ArrayList < T > getAllComponents ( long type ) { ArrayList < T > list = new ArrayList < T > ( ) ; GVRComponent component = getComponent ( type ) ; if ( component != null ) list . add ( ( T ) component ) ; for ( GVRSceneObject child : mChildren ) { ArrayList < T > temp = child . getAllComponents ( type ) ; list . addAll ( temp ) ; } return list ; } | Get all components of a specific class from this scene object and its descendants . | 119 | 15 |
148,287 | public void setPickingEnabled ( boolean enabled ) { if ( enabled != getPickingEnabled ( ) ) { if ( enabled ) { attachComponent ( new GVRSphereCollider ( getGVRContext ( ) ) ) ; } else { detachComponent ( GVRCollider . getComponentType ( ) ) ; } } } | Simple high - level API to enable or disable eye picking for this scene object . | 69 | 16 |
148,288 | public int removeChildObjectsByName ( final String name ) { int removed = 0 ; if ( null != name && ! name . isEmpty ( ) ) { removed = removeChildObjectsByNameImpl ( name ) ; } return removed ; } | Removes any child object that has the given name by performing case - sensitive search . | 52 | 17 |
148,289 | public boolean removeChildObjectByName ( final String name ) { if ( null != name && ! name . isEmpty ( ) ) { GVRSceneObject found = null ; for ( GVRSceneObject child : mChildren ) { GVRSceneObject object = child . getSceneObjectByName ( name ) ; if ( object != null ) { found = object ; break ; } } if ( found != null ) { removeChildObject ( found ) ; return true ; } } return false ; } | Performs case - sensitive depth - first search for a child object and then removes it if found . | 103 | 20 |
148,290 | protected void onNewParentObject ( GVRSceneObject parent ) { for ( GVRComponent comp : mComponents . values ( ) ) { comp . onNewOwnersParent ( parent ) ; } } | Called when the scene object gets a new parent . | 43 | 11 |
148,291 | protected void onRemoveParentObject ( GVRSceneObject parent ) { for ( GVRComponent comp : mComponents . values ( ) ) { comp . onRemoveOwnersParent ( parent ) ; } } | Called when is removed the parent of the scene object . | 43 | 12 |
148,292 | public void prettyPrint ( StringBuffer sb , int indent ) { sb . append ( Log . getSpaces ( indent ) ) ; sb . append ( getClass ( ) . getSimpleName ( ) ) ; sb . append ( " [name=" ) ; sb . append ( this . getName ( ) ) ; sb . append ( "]" ) ; sb . append ( System . lineSeparator ( ) ) ; GVRRenderData rdata = getRenderData ( ) ; GVRTransform trans = getTransform ( ) ; if ( rdata == null ) { sb . append ( Log . getSpaces ( indent + 2 ) ) ; sb . append ( "RenderData: null" ) ; sb . append ( System . lineSeparator ( ) ) ; } else { rdata . prettyPrint ( sb , indent + 2 ) ; } sb . append ( Log . getSpaces ( indent + 2 ) ) ; sb . append ( "Transform: " ) ; sb . append ( trans ) ; sb . append ( System . lineSeparator ( ) ) ; // dump its children for ( GVRSceneObject child : getChildren ( ) ) { child . prettyPrint ( sb , indent + 2 ) ; } } | Generate debug dump of the tree from the scene object . It should include a newline character at the end . | 272 | 23 |
148,293 | public void setControllerModel ( GVRSceneObject controllerModel ) { if ( mControllerModel != null ) { mControllerGroup . removeChildObject ( mControllerModel ) ; } mControllerModel = controllerModel ; mControllerGroup . addChildObject ( mControllerModel ) ; mControllerModel . setEnable ( mShowControllerModel ) ; } | Replaces the model used to depict the controller in the scene . | 71 | 13 |
148,294 | @ Override public void setCursorDepth ( float depth ) { super . setCursorDepth ( depth ) ; if ( mRayModel != null ) { mRayModel . getTransform ( ) . setScaleZ ( mCursorDepth ) ; } } | Set the depth of the cursor . This is the length of the ray from the origin to the cursor . | 54 | 21 |
148,295 | @ Override public void setPosition ( float x , float y , float z ) { position . set ( x , y , z ) ; pickDir . set ( x , y , z ) ; pickDir . normalize ( ) ; invalidate ( ) ; } | Set the position of the pick ray . This function is used internally to update the pick ray with the new controller position . | 55 | 24 |
148,296 | @ SuppressWarnings ( "unused" ) public Handedness getHandedness ( ) { if ( ( currentControllerEvent == null ) || currentControllerEvent . isRecycled ( ) ) { return null ; } return currentControllerEvent . handedness == 0.0f ? Handedness . LEFT : Handedness . RIGHT ; } | Return the current handedness of the Gear Controller . | 76 | 10 |
148,297 | protected void updatePicker ( MotionEvent event , boolean isActive ) { final MotionEvent newEvent = ( event != null ) ? event : null ; final ControllerPick controllerPick = new ControllerPick ( mPicker , newEvent , isActive ) ; context . runOnGlThread ( controllerPick ) ; } | Update the state of the picker . If it has an owner the picker will use that object to derive its position and orientation . The active state of this controller is used to indicate touch . The cursor position is updated after picking . | 64 | 47 |
148,298 | public static JSONObject loadJSONAsset ( Context context , final String asset ) { if ( asset == null ) { return new JSONObject ( ) ; } return getJsonObject ( org . gearvrf . widgetlib . main . Utility . readTextFile ( context , asset ) ) ; } | Load a JSON file from the application s asset directory . | 61 | 11 |
148,299 | public static int getJSONColor ( final JSONObject json , String elementName ) throws JSONException { Object raw = json . get ( elementName ) ; return convertJSONColor ( raw ) ; } | Gets a color formatted as an integer with ARGB ordering . | 40 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.