idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
148,500
public void setValue ( Quaternionf rot ) { mX = rot . x ; mY = rot . y ; mZ = rot . z ; mW = rot . w ; }
Sets the quaternion of the keyframe .
148,501
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 , ...
Copy new data to an existing float - point texture .
148,502
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 .
148,503
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
148,504
public void writeLine ( String pattern , Object ... parameters ) { String line = ( parameters == null || parameters . length == 0 ) ? pattern : String . format ( pattern , parameters ) ; lines . add ( 0 , line ) ; updateHUD ( ) ; }
Write a message to the console .
148,505
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 .
148,506
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 .
148,507
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 .
148,508
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 .
148,509
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...
Calcs the bonding size of given mesh .
148,510
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 } ; m...
Creates a quad consisting of two triangles with the specified width and height .
148,511
void onSurfaceChanged ( int width , int height ) { Log . v ( TAG , "onSurfaceChanged" ) ; final VrAppSettings . EyeBufferParams . DepthFormat depthFormat = mApplication . getAppSettings ( ) . getEyeBufferParams ( ) . getDepthFormat ( ) ; mApplication . getConfigurationManager ( ) . configureRendering ( VrAppSettings . ...
Called when the surface is created or recreated . Avoided because this can be called twice at the beginning .
148,512
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 ( ) ; mTra...
Called from the native side
148,513
public GVRAndroidResource openResource ( String filePath ) throws IOException { if ( filePath . startsWith ( File . separator ) ) { filePath = filePath . substring ( File . separator . length ( ) ) ; } filePath = adaptFilePath ( filePath ) ; String path ; int resourceId ; GVRAndroidResource resourceKey ; switch ( volum...
Opens a file from the volume . The filePath is relative to the defaultPath .
148,514
protected String adaptFilePath ( String filePath ) { String targetPath = filePath . replaceAll ( "\\\\" , volumeType . getSeparator ( ) ) ; return targetPath ; }
Adapt a file path to the current file system .
148,515
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 ( ) ;...
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 .
148,516
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 .
148,517
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 ( ! ...
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 .
148,518
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 .
148,519
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 .
148,520
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 .
148,521
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 .
148,522
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 .
148,523
public void pause ( ) { if ( mAudioListener != null ) { int sourceId = getSourceId ( ) ; if ( sourceId != GvrAudioEngine . INVALID_ID ) { mAudioListener . getAudioEngine ( ) . pauseSound ( sourceId ) ; } } }
Pauses the playback of a sound .
148,524
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 .
148,525
public void setVolume ( float volume ) { mVolume = volume ; if ( isPlaying ( ) && ( getSourceId ( ) != GvrAudioEngine . INVALID_ID ) ) { mAudioListener . getAudioEngine ( ) . setSoundVolume ( getSourceId ( ) , getVolume ( ) ) ; } }
Changes the volume of an existing sound .
148,526
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
148,527
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
148,528
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 ) ) { ...
Calculate delta with another vector
148,529
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 .
148,530
public boolean setCurrentPage ( final int page ) { Log . d ( TAG , "setPageId pageId = %d" , page ) ; return ( page >= 0 && page < getCheckableCount ( ) ) && check ( page ) ; }
Sets selected page implicitly
148,531
public void loadPhysics ( String filename , GVRScene scene ) throws IOException { GVRPhysicsLoader . loadPhysicsFile ( getGVRContext ( ) , filename , true , scene ) ; }
Load physics information for the current avatar
148,532
public void rotateToFaceCamera ( final GVRTransform transform ) { 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 .
148,533
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 .
148,534
public void updateFrontFacingRotation ( float rotation ) { if ( ! Float . isNaN ( rotation ) && ! equal ( rotation , frontFacingRotation ) ) { final float oldRotation = frontFacingRotation ; frontFacingRotation = rotation % 360 ; for ( OnFrontRotationChangedListener listener : mOnFrontRotationChangedListeners ) { try {...
Set new front facing rotation
148,535
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
148,536
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 ( mRi...
Scale all widgets in Main Scene hierarchy
148,537
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 .
148,538
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 .
148,539
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 .
148,540
public GVRAnimation setOnFinish ( GVROnFinish callback ) { mOnFinish = callback ; mOnRepeat = callback instanceof GVROnRepeat ? ( GVROnRepeat ) callback : null ; if ( mOnRepeat != null ) { mRepeatCount = - 1 ; } return this ; }
Set the on - finish callback .
148,541
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 ( getGVRCo...
Selects a specific vertex and fragment shader to use for rendering .
148,542
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
148,543
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...
Set the draw mode for this mesh . Default is GL_TRIANGLES .
148,544
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 =...
Fling the content
148,545
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 ...
Scroll to the next page . To process the scrolling by pages LayoutScroller must be constructed with a pageSize greater than zero .
148,546
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...
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 .
148,547
public int scrollToItem ( int position ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "scrollToItem position = %d" , position ) ; scrollToPosition ( position ) ; return mCurrentItemIndex ; }
Scroll to the specific position
148,548
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
148,549
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 .
148,550
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 .
148,551
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 .
148,552
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=" + getFinalTransformMatri...
Pretty - print the object .
148,553
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 ...
Updates the backing render texture . This method should not be called when capturing is in progress .
148,554
public void setCapture ( boolean capture , float fps ) { capturing = capture ; NativeTextureCapturer . setCapture ( getNative ( ) , capture , fps ) ; }
Starts or stops capturing .
148,555
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 .
148,556
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 . ...
Add a listener to be invoked when the checked button changes in this group .
148,557
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
148,558
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
148,559
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
148,560
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
148,561
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 instanceo...
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 .
148,562
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
148,563
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 ) ...
Configure high fps settings in the camera for VR mode
148,564
static GVROrthogonalCamera makeOrthoShadowCamera ( GVRPerspectiveCamera centerCam ) { GVROrthogonalCamera shadowCam = new GVROrthogonalCamera ( centerCam . getGVRContext ( ) ) ; float near = centerCam . getNearClippingDistance ( ) ; float far = centerCam . getFarClippingDistance ( ) ; float fovy = ( float ) Math . toRa...
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 ...
148,565
static GVRPerspectiveCamera makePerspShadowCamera ( GVRPerspectiveCamera centerCam , float coneAngle ) { GVRPerspectiveCamera camera = new GVRPerspectiveCamera ( centerCam . getGVRContext ( ) ) ; float near = centerCam . getNearClippingDistance ( ) ; float far = centerCam . getFarClippingDistance ( ) ; camera . setNear...
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 .
148,566
private void SetNewViewpoint ( String url ) { Viewpoint vp = null ; String vpURL = url . substring ( 1 , url . length ( ) ) ; for ( Viewpoint viewpoint : viewpoints ) { if ( viewpoint . getName ( ) . equalsIgnoreCase ( vpURL ) ) { vp = viewpoint ; } } if ( vp != null ) { GVRCameraRig mainCameraRig = gvrContext . getMai...
end AnchorImplementation class
148,567
private void WebPageCloseOnClick ( GVRViewSceneObject gvrWebViewSceneObject , GVRSceneObject gvrSceneObjectAnchor , String url ) { final String urlFinal = url ; webPagePlusUISceneObject = new GVRSceneObject ( gvrContext ) ; webPagePlusUISceneObject . getTransform ( ) . setPosition ( webPagePlusUIPosition [ 0 ] , webPag...
Display web page but no user interface - close
148,568
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...
Get the axis along the orientation
148,569
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 (...
Attach a component to this scene object .
148,570
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 .
148,571
@ 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 ) { Arr...
Get all components of a specific class from this scene object and its descendants .
148,572
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 .
148,573
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 .
148,574
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 ) ...
Performs case - sensitive depth - first search for a child object and then removes it if found .
148,575
protected void onNewParentObject ( GVRSceneObject parent ) { for ( GVRComponent comp : mComponents . values ( ) ) { comp . onNewOwnersParent ( parent ) ; } }
Called when the scene object gets a new parent .
148,576
protected void onRemoveParentObject ( GVRSceneObject parent ) { for ( GVRComponent comp : mComponents . values ( ) ) { comp . onRemoveOwnersParent ( parent ) ; } }
Called when is removed the parent of the scene object .
148,577
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 = getRenderDa...
Generate debug dump of the tree from the scene object . It should include a newline character at the end .
148,578
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 .
148,579
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 .
148,580
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 .
148,581
@ 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 .
148,582
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 .
148,583
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 .
148,584
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 .
148,585
public static GVRTexture loadFutureCubemapTexture ( GVRContext gvrContext , ResourceCache < GVRImage > textureCache , GVRAndroidResource resource , int priority , Map < String , Integer > faceIndexMap ) { GVRTexture tex = new GVRTexture ( gvrContext ) ; GVRImage cached = textureCache . get ( resource ) ; if ( cached !=...
Load a cube map texture asynchronously .
148,586
public static void loadCubemapTexture ( final GVRContext context , ResourceCache < GVRImage > textureCache , final TextureCallback callback , final GVRAndroidResource resource , int priority , Map < String , Integer > faceIndexMap ) throws IllegalArgumentException { validatePriorityCallbackParameters ( context , callba...
Load a cubemap texture asynchronously .
148,587
public static Bitmap decodeStream ( InputStream stream , boolean closeStream ) { return AsyncBitmapTexture . decodeStream ( stream , AsyncBitmapTexture . glMaxTextureSize , AsyncBitmapTexture . glMaxTextureSize , true , null , closeStream ) ; }
An internal method public only so that GVRContext can make cross - package calls .
148,588
public GVRShaderId getShaderType ( Class < ? extends GVRShader > shaderClass ) { GVRShaderId shaderId = mShaderTemplates . get ( shaderClass ) ; if ( shaderId == null ) { GVRContext ctx = getGVRContext ( ) ; shaderId = new GVRShaderId ( shaderClass ) ; mShaderTemplates . put ( shaderClass , shaderId ) ; shaderId . getT...
Retrieves the Material Shader ID associated with the given shader template class .
148,589
static String makeLayout ( String descriptor , String blockName , boolean useUBO ) { return NativeShaderManager . makeLayout ( descriptor , blockName , useUBO ) ; }
Make a string with the shader layout for a uniform block with a given descriptor . The format of the descriptor is the same as for a
148,590
public void rotateWithPivot ( float quatW , float quatX , float quatY , float quatZ , float pivotX , float pivotY , float pivotZ ) { NativeTransform . rotateWithPivot ( getNative ( ) , quatW , quatX , quatY , quatZ , pivotX , pivotY , pivotZ ) ; }
Modify the transform s current rotation in quaternion terms around a pivot other than the origin .
148,591
public static void setFaceNames ( String [ ] nameArray ) { if ( nameArray . length != 6 ) { throw new IllegalArgumentException ( "nameArray length is not 6." ) ; } for ( int i = 0 ; i < 6 ; i ++ ) { faceIndexMap . put ( nameArray [ i ] , i ) ; } }
Set the names of six images in the zip file . The default names of the six images are posx . png negx . png posy . png negx . png posz . png and negz . png . If the names of the six images in the zip file are different to the default ones this function must be called before load the zip file .
148,592
public boolean startDrag ( final GVRSceneObject sceneObject , final float hitX , final float hitY , final float hitZ ) { final GVRRigidBody dragMe = ( GVRRigidBody ) sceneObject . getComponent ( GVRRigidBody . getComponentType ( ) ) ; if ( dragMe == null || dragMe . getSimulationType ( ) != GVRRigidBody . DYNAMIC || ! ...
Start the drag operation of a scene object with a rigid body .
148,593
public void stopDrag ( ) { mPhysicsDragger . stopDrag ( ) ; mPhysicsContext . runOnPhysicsThread ( new Runnable ( ) { public void run ( ) { if ( mRigidBodyDragMe != null ) { NativePhysics3DWorld . stopDrag ( getNative ( ) ) ; mRigidBodyDragMe = null ; } } } ) ; }
Stop the drag action .
148,594
public void setValue ( Vector3f scale ) { mX = scale . x ; mY = scale . y ; mZ = scale . z ; }
Sets the scale vector of the keyframe .
148,595
public void selectByName ( String childName ) { int i = 0 ; GVRSceneObject owner = getOwnerObject ( ) ; if ( owner == null ) { return ; } for ( GVRSceneObject child : owner . children ( ) ) { if ( child . getName ( ) . equals ( childName ) ) { mSwitchIndex = i ; return ; } ++ i ; } }
Sets the current switch index based on object name . This function finds the child of the scene object this component is attached to and sets the switch index to reference it so this is the object that will be displayed .
148,596
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 ) co...
Attaches a morph to scene object with a base mesh
148,597
protected boolean intersect ( GVRSceneObject . BoundingVolume bv1 , GVRSceneObject . BoundingVolume bv2 ) { return ( bv1 . maxCorner . x >= bv2 . minCorner . x ) && ( bv1 . maxCorner . y >= bv2 . minCorner . y ) && ( bv1 . maxCorner . z >= bv2 . minCorner . z ) && ( bv1 . minCorner . x <= bv2 . maxCorner . x ) && ( bv1...
Determines whether or not two axially aligned bounding boxes in the same coordinate space intersect .
148,598
public static GVRVideoSceneObjectPlayer < MediaPlayer > makePlayerInstance ( final MediaPlayer mediaPlayer ) { return new GVRVideoSceneObjectPlayer < MediaPlayer > ( ) { public MediaPlayer getPlayer ( ) { return mediaPlayer ; } public void setSurface ( Surface surface ) { mediaPlayer . setSurface ( surface ) ; } public...
Creates a player wrapper for the Android MediaPlayer .
148,599
public void setRefreshFrequency ( IntervalFrequency frequency ) { if ( NONE_REFRESH_INTERVAL == mRefreshInterval && IntervalFrequency . NONE != frequency ) { getGVRContext ( ) . unregisterDrawFrameListener ( mFrameListener ) ; getGVRContext ( ) . registerDrawFrameListener ( mFrameListener ) ; } switch ( frequency ) { c...
Set the refresh frequency of this scene object . Use NONE for improved performance when the text is set initially and never changed .