idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
148,600
public IntervalFrequency getRefreshFrequency ( ) { switch ( mRefreshInterval ) { case REALTIME_REFRESH_INTERVAL : return IntervalFrequency . REALTIME ; case HIGH_REFRESH_INTERVAL : return IntervalFrequency . HIGH ; case LOW_REFRESH_INTERVAL : return IntervalFrequency . LOW ; case MEDIUM_REFRESH_INTERVAL : return Interv...
Get the refresh frequency of this scene object .
148,601
private float [ ] generateParticleVelocities ( ) { float velocities [ ] = new float [ mEmitRate * 3 ] ; for ( int i = 0 ; i < mEmitRate * 3 ; i += 3 ) { Vector3f nexVel = getNextVelocity ( ) ; velocities [ i ] = nexVel . x ; velocities [ i + 1 ] = nexVel . y ; velocities [ i + 2 ] = nexVel . z ; } return velocities ; }
generate random velocities in the given range
148,602
private float [ ] generateParticleTimeStamps ( float totalTime ) { float timeStamps [ ] = new float [ mEmitRate * 2 ] ; for ( int i = 0 ; i < mEmitRate * 2 ; i += 2 ) { timeStamps [ i ] = totalTime + mRandom . nextFloat ( ) ; timeStamps [ i + 1 ] = 0 ; } return timeStamps ; }
Generate random time stamps from the current time upto the next one second . Passed as texture coordinates to the vertex shader an unused field is present with every pair passed .
148,603
public static WidgetLib init ( GVRContext gvrContext , String customPropertiesAsset ) throws InterruptedException , JSONException , NoSuchMethodException { if ( mInstance == null ) { new WidgetLib ( gvrContext , customPropertiesAsset ) ; } return mInstance . get ( ) ; }
Initialize an instance of Widget Lib . It has to be done before any usage of library . The application needs to hold onto the returned WidgetLib reference for as long as the library is going to be used .
148,604
public void BuildInteractiveObjectFromAnchor ( Sensor anchorSensor , String anchorDestination ) { InteractiveObject interactiveObject = new InteractiveObject ( ) ; interactiveObject . setSensor ( anchorSensor , anchorDestination ) ; interactiveObjects . add ( interactiveObject ) ; }
BuildInteractiveObjectFromAnchor is a special type of interactive object in that it does not get built using ROUTE s .
148,605
private void RunScript ( InteractiveObject interactiveObject , String functionName , Object [ ] parameters ) { boolean complete = false ; if ( V8JavaScriptEngine ) { GVRJavascriptV8File gvrJavascriptV8File = interactiveObject . getScriptObject ( ) . getGVRJavascriptV8File ( ) ; String paramString = "var params =[" ; fo...
Run the JavaScript program Output saved in localBindings
148,606
public Quaternionf ConvertDirectionalVectorToQuaternion ( Vector3f d ) { d . negate ( ) ; Quaternionf q = new Quaternionf ( ) ; if ( ( d . x == 0 ) && ( d . z == 0 ) ) { if ( d . y > 0 ) { AxisAngle4f angleAxis = new AxisAngle4f ( - ( float ) Math . PI / 2 , 1 , 0 , 0 ) ; q . set ( angleAxis ) ; } else if ( d . y < 0 )...
Converts a vector into a quaternion . Used for the direction of spot and directional lights Called upon initialization and updates to those vectors
148,607
public static void count ( ) { long duration = SystemClock . uptimeMillis ( ) - startTime ; float avgFPS = sumFrames / ( duration / 1000f ) ; Log . v ( "FPSCounter" , "total frames = %d, total elapsed time = %d ms, average fps = %f" , sumFrames , duration , avgFPS ) ; }
Computes FPS average
148,608
public static void startCheck ( String extra ) { startCheckTime = System . currentTimeMillis ( ) ; nextCheckTime = startCheckTime ; Log . d ( Log . SUBSYSTEM . TRACING , "FPSCounter" , "[%d] startCheck %s" , startCheckTime , extra ) ; }
Start check of execution time
148,609
public static void timeCheck ( String extra ) { if ( startCheckTime > 0 ) { long now = System . currentTimeMillis ( ) ; long diff = now - nextCheckTime ; nextCheckTime = now ; Log . d ( Log . SUBSYSTEM . TRACING , "FPSCounter" , "[%d, %d] timeCheck: %s" , now , diff , extra ) ; } }
Computes execution time
148,610
public void animate ( GVRHybridObject object , float animationTime ) { GVRMeshMorph morph = ( GVRMeshMorph ) mTarget ; mKeyInterpolator . animate ( animationTime * mDuration , mCurrentValues ) ; morph . setWeights ( mCurrentValues ) ; }
Computes the blend weights for the given time and updates them in the target .
148,611
public synchronized void addRange ( final float range , final GVRSceneObject sceneObject ) { if ( null == sceneObject ) { throw new IllegalArgumentException ( "sceneObject must be specified!" ) ; } if ( range < 0 ) { throw new IllegalArgumentException ( "range cannot be negative" ) ; } final int size = mRanges . size (...
Add a range to this LOD group . Specify the scene object that should be displayed in this range . Add the LOG group as a component to the parent scene object . The scene objects associated with each range will automatically be added as children to the parent .
148,612
public void onDrawFrame ( float frameTime ) { final GVRSceneObject owner = getOwnerObject ( ) ; if ( owner == null ) { return ; } final int size = mRanges . size ( ) ; final GVRTransform t = getGVRContext ( ) . getMainScene ( ) . getMainCameraRig ( ) . getCenterCamera ( ) . getTransform ( ) ; for ( final Object [ ] ran...
Do not call directly .
148,613
public static Shell createConsoleShell ( String prompt , String appName , Object ... handlers ) { ConsoleIO io = new ConsoleIO ( ) ; List < String > path = new ArrayList < String > ( 1 ) ; path . add ( prompt ) ; MultiMap < String , Object > modifAuxHandlers = new ArrayHashMultiMap < String , Object > ( ) ; modifAuxHan...
One of facade methods for operating the Shell .
148,614
public static Shell createConsoleShell ( String prompt , String appName , Object mainHandler ) { return createConsoleShell ( prompt , appName , mainHandler , new EmptyMultiMap < String , Object > ( ) ) ; }
Facade method for operating the Shell .
148,615
public static Shell createSubshell ( String pathElement , Shell parent , String appName , Object mainHandler , MultiMap < String , Object > auxHandlers ) { List < String > newPath = new ArrayList < String > ( parent . getPath ( ) ) ; newPath . add ( pathElement ) ; Shell subshell = new Shell ( parent . getSettings ( ) ...
Facade method facilitating the creation of subshell . Subshell is created and run inside Command method and shares the same IO and naming strategy .
148,616
public static Shell createSubshell ( String pathElement , Shell parent , String appName , Object mainHandler ) { return createSubshell ( pathElement , parent , appName , mainHandler , new EmptyMultiMap < String , Object > ( ) ) ; }
Facade method facilitating the creation of subshell . Subshell is created and run inside Command method and shares the same IO and naming strtategy .
148,617
public void animate ( float animationTime , Matrix4f mat ) { mRotInterpolator . animate ( animationTime , mRotKey ) ; mPosInterpolator . animate ( animationTime , mPosKey ) ; mSclInterpolator . animate ( animationTime , mScaleKey ) ; mat . translationRotateScale ( mPosKey [ 0 ] , mPosKey [ 1 ] , mPosKey [ 2 ] , mRotKey...
Obtains the transform for a specific time in animation .
148,618
public void setAmbientIntensity ( float r , float g , float b , float a ) { setVec4 ( "ambient_intensity" , r , g , b , a ) ; }
Set the ambient light intensity .
148,619
public void setDiffuseIntensity ( float r , float g , float b , float a ) { setVec4 ( "diffuse_intensity" , r , g , b , a ) ; }
Set the diffuse light intensity .
148,620
public void setSpecularIntensity ( float r , float g , float b , float a ) { setVec4 ( "specular_intensity" , r , g , b , a ) ; }
Set the specular intensity of the light .
148,621
private float getQuaternionW ( float x , float y , float z ) { return ( float ) Math . cos ( Math . asin ( Math . sqrt ( x * x + y * y + z * z ) ) ) ; }
Finds the missing value . Seems to lose a degree of freedom but it doesn t . That degree of freedom is already lost by the sensor .
148,622
public void shutdown ( ) { debugConnection = null ; shuttingDown = true ; try { if ( serverSocket != null ) { serverSocket . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Shuts down the server . Active connections are not affected .
148,623
public void run ( ) { ExecutorService executorService = Executors . newFixedThreadPool ( maxClients ) ; try { serverSocket = new ServerSocket ( port , maxClients ) ; while ( ! shuttingDown ) { try { Socket socket = serverSocket . accept ( ) ; debugConnection = new DebugConnection ( socket ) ; executorService . submit (...
Runs the server .
148,624
public synchronized void removeAllSceneObjects ( ) { final GVRCameraRig rig = getMainCameraRig ( ) ; final GVRSceneObject head = rig . getOwnerObject ( ) ; rig . removeAllChildren ( ) ; NativeScene . removeAllSceneObjects ( getNative ( ) ) ; for ( final GVRSceneObject child : mSceneRoot . getChildren ( ) ) { child . ge...
Remove all scene objects .
148,625
public void setPickRay ( float ox , float oy , float oz , float dx , float dy , float dz ) { synchronized ( this ) { mRayOrigin . x = ox ; mRayOrigin . y = oy ; mRayOrigin . z = oz ; mRayDirection . x = dx ; mRayDirection . y = dy ; mRayDirection . z = dz ; } }
Sets the origin and direction of the pick ray .
148,626
public void onDrawFrame ( float frameTime ) { if ( isEnabled ( ) && ( mScene != null ) && mPickEventLock . tryLock ( ) ) { try { doPick ( ) ; } finally { mPickEventLock . unlock ( ) ; } } }
Called every frame if the picker is enabled to generate pick events .
148,627
public void processPick ( boolean touched , MotionEvent event ) { mPickEventLock . lock ( ) ; mTouched = touched ; mMotionEvent = event ; doPick ( ) ; mPickEventLock . unlock ( ) ; }
Scans the scene graph to collect picked items and generates appropriate pick and touch events . This function is called by the cursor controller internally but can also be used to funnel a stream of Android motion events into the picker .
148,628
protected void propagateOnNoPick ( GVRPicker picker ) { if ( mEventOptions . contains ( EventOptions . SEND_PICK_EVENTS ) ) { if ( mEventOptions . contains ( EventOptions . SEND_TO_LISTENERS ) ) { getGVRContext ( ) . getEventManager ( ) . sendEvent ( this , IPickEvents . class , "onNoPick" , picker ) ; } if ( mEventOpt...
Propagate onNoPick events to listeners
148,629
protected void propagateOnMotionOutside ( MotionEvent event ) { if ( mEventOptions . contains ( EventOptions . SEND_TOUCH_EVENTS ) ) { if ( mEventOptions . contains ( EventOptions . SEND_TO_LISTENERS ) ) { getGVRContext ( ) . getEventManager ( ) . sendEvent ( this , ITouchEvents . class , "onMotionOutside" , this , eve...
Propagate onMotionOutside events to listeners
148,630
protected void propagateOnEnter ( GVRPickedObject hit ) { GVRSceneObject hitObject = hit . getHitObject ( ) ; GVREventManager eventManager = getGVRContext ( ) . getEventManager ( ) ; if ( mEventOptions . contains ( EventOptions . SEND_TOUCH_EVENTS ) ) { if ( mEventOptions . contains ( EventOptions . SEND_TO_LISTENERS )...
Propagate onEnter events to listeners
148,631
protected void propagateOnTouch ( GVRPickedObject hit ) { if ( mEventOptions . contains ( EventOptions . SEND_TOUCH_EVENTS ) ) { GVREventManager eventManager = getGVRContext ( ) . getEventManager ( ) ; GVRSceneObject hitObject = hit . getHitObject ( ) ; if ( mEventOptions . contains ( EventOptions . SEND_TO_LISTENERS )...
Propagate onTouchStart events to listeners
148,632
protected GVRPickedObject findCollider ( GVRPickedObject [ ] pickList , GVRCollider findme ) { if ( pickList == null ) { return null ; } for ( GVRPickedObject hit : pickList ) { if ( ( hit != null ) && ( hit . hitCollider == findme ) ) { return hit ; } } return null ; }
Find the collision against a specific collider in a list of collisions .
148,633
public static final GVRPickedObject [ ] pickObjects ( GVRScene scene , float ox , float oy , float oz , float dx , float dy , float dz ) { sFindObjectsLock . lock ( ) ; try { final GVRPickedObject [ ] result = NativePicker . pickObjects ( scene . getNative ( ) , 0L , ox , oy , oz , dx , dy , dz ) ; return result ; } fi...
Casts a ray into the scene graph and returns the objects it intersects .
148,634
static GVRPickedObject makeHitMesh ( long colliderPointer , float distance , float hitx , float hity , float hitz , int faceIndex , float barycentricx , float barycentricy , float barycentricz , float texu , float texv , float normalx , float normaly , float normalz ) { GVRCollider collider = GVRCollider . lookup ( col...
Internal utility to help JNI add hit objects to the pick list . Specifically for MeshColliders with picking for UV Barycentric and normal coordinates enabled
148,635
public static List < GVRAtlasInformation > loadAtlasInformation ( InputStream ins ) { try { int size = ins . available ( ) ; byte [ ] buffer = new byte [ size ] ; ins . read ( buffer ) ; return loadAtlasInformation ( new JSONArray ( new String ( buffer , "UTF-8" ) ) ) ; } catch ( JSONException je ) { je . printStackTra...
This method is a sync parse to the JSON stream of atlas information .
148,636
public void setSpeed ( float newValue ) { if ( newValue < 0 ) newValue = 0 ; this . pitch . setValue ( newValue ) ; this . speed . setValue ( newValue ) ; }
Assign float value to inputOutput SFFloat field named speed . Note that our implementation with ExoPlayer that pitch and speed will be set to the same value .
148,637
public String getUniformDescriptor ( GVRContext ctx ) { if ( mShaderTemplate == null ) { mShaderTemplate = makeTemplate ( ID , ctx ) ; ctx . getShaderManager ( ) . addShaderID ( this ) ; } return mShaderTemplate . getUniformDescriptor ( ) ; }
Gets the string describing the uniforms used by shaders of this type .
148,638
public GVRShader getTemplate ( GVRContext ctx ) { if ( mShaderTemplate == null ) { mShaderTemplate = makeTemplate ( ID , ctx ) ; ctx . getShaderManager ( ) . addShaderID ( this ) ; } return mShaderTemplate ; }
Gets the Java subclass of GVRShader which implements this shader type .
148,639
GVRShader makeTemplate ( Class < ? extends GVRShader > id , GVRContext ctx ) { try { Constructor < ? extends GVRShader > maker = id . getDeclaredConstructor ( GVRContext . class ) ; return maker . newInstance ( ctx ) ; } catch ( NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetE...
Instantiates an instance of input Java shader class which must be derived from GVRShader or GVRShaderTemplate .
148,640
public void start ( GVRAccessibilitySpeechListener speechListener ) { mTts . setSpeechListener ( speechListener ) ; mTts . getSpeechRecognizer ( ) . startListening ( mTts . getSpeechRecognizerIntent ( ) ) ; }
Start speech recognizer .
148,641
public void setVertexBuffer ( GVRVertexBuffer vbuf ) { if ( vbuf == null ) { throw new IllegalArgumentException ( "Vertex buffer cannot be null" ) ; } mVertices = vbuf ; NativeMesh . setVertexBuffer ( getNative ( ) , vbuf . getNative ( ) ) ; }
Changes the vertex buffer associated with this mesh .
148,642
public void setIndexBuffer ( GVRIndexBuffer ibuf ) { mIndices = ibuf ; NativeMesh . setIndexBuffer ( getNative ( ) , ( ibuf != null ) ? ibuf . getNative ( ) : 0L ) ; }
Changes the index buffer associated with this mesh .
148,643
public static void rebuild ( final MODE newMode ) { if ( mode != newMode ) { mode = newMode ; TYPE type ; switch ( mode ) { case DEBUG : type = TYPE . ANDROID ; Log . startFullLog ( ) ; break ; case DEVELOPER : type = TYPE . PERSISTENT ; Log . stopFullLog ( ) ; break ; case USER : type = TYPE . ANDROID ; break ; defaul...
Rebuild logging systems with updated mode
148,644
public static int e ( ISubsystem subsystem , String tag , String msg ) { return isEnabled ( subsystem ) ? currentLog . e ( tag , getMsg ( subsystem , msg ) ) : 0 ; }
Send an ERROR log message with specified subsystem . If subsystem is not enabled the message will not be logged
148,645
public static void d ( ISubsystem subsystem , String tag , String pattern , Object ... parameters ) { if ( ! isEnabled ( subsystem ) ) return ; d ( subsystem , tag , format ( pattern , parameters ) ) ; }
Send a DEBUG log message with specified subsystem . If subsystem is not enabled the message will not be logged
148,646
private static void deleteOldAndEmptyFiles ( ) { File dir = LOG_FILE_DIR ; if ( dir . exists ( ) ) { File [ ] files = dir . listFiles ( ) ; for ( File f : files ) { if ( f . length ( ) == 0 || f . lastModified ( ) + MAXFILEAGE < System . currentTimeMillis ( ) ) { f . delete ( ) ; } } } }
delete of files more than 1 day old
148,647
public boolean load ( GVRScene scene ) { GVRAssetLoader loader = getGVRContext ( ) . getAssetLoader ( ) ; if ( scene == null ) { scene = getGVRContext ( ) . getMainScene ( ) ; } if ( mReplaceScene ) { loader . loadScene ( getOwnerObject ( ) , mVolume , mImportSettings , scene , null ) ; } else { loader . loadModel ( ge...
Loads the asset referenced by the file name under the owner of this component . If this component was constructed to replace the scene with the asset the scene will contain only the owner of this component upon return . Otherwise the loaded asset is a child of this component s owner .
148,648
public void load ( IAssetEvents handler ) { GVRAssetLoader loader = getGVRContext ( ) . getAssetLoader ( ) ; if ( mReplaceScene ) { loader . loadScene ( getOwnerObject ( ) , mVolume , mImportSettings , getGVRContext ( ) . getMainScene ( ) , handler ) ; } else { loader . loadModel ( mVolume , getOwnerObject ( ) , mImpor...
Loads the asset referenced by the file name under the owner of this component . If this component was constructed to replace the scene with the asset the main scene of the current context will contain only the owner of this component upon return . Otherwise the loaded asset is a child of this component s owner .
148,649
public String [ ] parseMFString ( String mfString ) { Vector < String > strings = new Vector < String > ( ) ; StringReader sr = new StringReader ( mfString ) ; StreamTokenizer st = new StreamTokenizer ( sr ) ; st . quoteChar ( '"' ) ; st . quoteChar ( '\'' ) ; String [ ] mfStrings = null ; int tokenType ; try { while (...
multi - field string
148,650
private static Point getScreenSize ( Context context , Point p ) { if ( p == null ) { p = new Point ( ) ; } WindowManager windowManager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERVICE ) ; Display display = windowManager . getDefaultDisplay ( ) ; display . getSize ( p ) ; return p ; }
Returns screen height and width
148,651
public float get ( int row , int col ) { if ( row < 0 || row > 3 ) { throw new IndexOutOfBoundsException ( "Index: " + row + ", Size: 4" ) ; } if ( col < 0 || col > 3 ) { throw new IndexOutOfBoundsException ( "Index: " + col + ", Size: 4" ) ; } return m_data [ row * 4 + col ] ; }
Gets an element of the matrix .
148,652
public PeriodicEvent runAfter ( Runnable task , float delay ) { validateDelay ( delay ) ; return new Event ( task , delay ) ; }
Run a task once after a delay .
148,653
public PeriodicEvent runEvery ( Runnable task , float delay , float period ) { return runEvery ( task , delay , period , null ) ; }
Run a task periodically and indefinitely .
148,654
public PeriodicEvent runEvery ( Runnable task , float delay , float period , int repetitions ) { if ( repetitions < 1 ) { return null ; } else if ( repetitions == 1 ) { return runAfter ( task , delay ) ; } else { return runEvery ( task , delay , period , new RunFor ( repetitions ) ) ; } }
Run a task periodically for a set number of times .
148,655
public PeriodicEvent runEvery ( Runnable task , float delay , float period , KeepRunning callback ) { validateDelay ( delay ) ; validatePeriod ( period ) ; return new Event ( task , delay , period , callback ) ; }
Run a task periodically with a callback .
148,656
@ SuppressWarnings ( "unchecked" ) public < V3 , M4 , C , N , Q > N getSceneRoot ( AiWrapperProvider < V3 , M4 , C , N , Q > wrapperProvider ) { return ( N ) m_sceneRoot ; }
Returns the scene graph root .
148,657
public void enableClipRegion ( ) { if ( mClippingEnabled ) { Log . w ( TAG , "Clipping has been enabled already for %s!" , getName ( ) ) ; return ; } Log . d ( Log . SUBSYSTEM . WIDGET , TAG , "enableClipping for %s [%f, %f, %f]" , getName ( ) , getViewPortWidth ( ) , getViewPortHeight ( ) , getViewPortDepth ( ) ) ; mC...
Enable clipping for the Widget . Widget content including its children will be clipped by a rectangular View Port . By default clipping is disabled .
148,658
public float getLayoutSize ( final Layout . Axis axis ) { float size = 0 ; for ( Layout layout : mLayouts ) { size = Math . max ( size , layout . getSize ( axis ) ) ; } Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "getLayoutSize [%s] axis [%s] size [%f]" , getName ( ) , axis , size ) ; return size ; }
Gets Widget layout dimension
148,659
public float getBoundsWidth ( ) { if ( mSceneObject != null ) { GVRSceneObject . BoundingVolume v = mSceneObject . getBoundingVolume ( ) ; return v . maxCorner . x - v . minCorner . x ; } return 0f ; }
Gets Widget bounds width
148,660
public float getBoundsHeight ( ) { if ( mSceneObject != null ) { GVRSceneObject . BoundingVolume v = mSceneObject . getBoundingVolume ( ) ; return v . maxCorner . y - v . minCorner . y ; } return 0f ; }
Gets Widget bounds height
148,661
public float getBoundsDepth ( ) { if ( mSceneObject != null ) { GVRSceneObject . BoundingVolume v = mSceneObject . getBoundingVolume ( ) ; return v . maxCorner . z - v . minCorner . z ; } return 0f ; }
Gets Widget bounds depth
148,662
public void rotateWithPivot ( float w , float x , float y , float z , float pivotX , float pivotY , float pivotZ ) { getTransform ( ) . rotateWithPivot ( w , x , y , z , pivotX , pivotY , pivotZ ) ; if ( mTransformCache . rotateWithPivot ( w , x , y , z , pivotX , pivotY , pivotZ ) ) { onTransformChanged ( ) ; } }
Modify the tranform s current rotation in quaternion terms around a pivot other than the origin .
148,663
public boolean setVisibility ( final Visibility visibility ) { if ( visibility != mVisibility ) { Log . d ( Log . SUBSYSTEM . WIDGET , TAG , "setVisibility(%s) for %s" , visibility , getName ( ) ) ; updateVisibility ( visibility ) ; mVisibility = visibility ; return true ; } return false ; }
Set the visibility of the object .
148,664
public boolean setViewPortVisibility ( final ViewPortVisibility viewportVisibility ) { boolean visibilityIsChanged = viewportVisibility != mIsVisibleInViewPort ; if ( visibilityIsChanged ) { Visibility visibility = mVisibility ; switch ( viewportVisibility ) { case FULLY_VISIBLE : case PARTIALLY_VISIBLE : break ; case ...
Set ViewPort visibility of the object .
148,665
public Widget findChildByName ( final String name ) { final List < Widget > groups = new ArrayList < > ( ) ; groups . add ( this ) ; return findChildByNameInAllGroups ( name , groups ) ; }
Finds the Widget in hierarchy
148,666
protected final boolean isGLThread ( ) { final Thread glThread = sGLThread . get ( ) ; return glThread != null && glThread . equals ( Thread . currentThread ( ) ) ; }
Determine whether the calling thread is the GL thread .
148,667
protected void update ( float scale ) { GVRSceneObject owner = getOwnerObject ( ) ; if ( ( owner != null ) && isEnabled ( ) && owner . isEnabled ( ) ) { convertFromARtoVRSpace ( scale ) ; } }
Update the anchor based on arcore best knowledge of the world
148,668
public void setCastShadow ( boolean enableFlag ) { GVRSceneObject owner = getOwnerObject ( ) ; if ( owner != null ) { GVRShadowMap shadowMap = ( GVRShadowMap ) getComponent ( GVRRenderTarget . getComponentType ( ) ) ; if ( enableFlag ) { if ( shadowMap != null ) { shadowMap . setEnable ( true ) ; } else { GVRCamera sha...
Enables or disabled shadow casting for a direct light . Enabling shadows attaches a GVRShadowMap component to the GVRSceneObject which owns the light and provides the component with an orthographic camera for shadow casting .
148,669
public synchronized void delete ( String name ) { if ( isEmpty ( name ) ) { indexedProps . remove ( name ) ; } else { synchronized ( context ) { int scope = context . getAttributesScope ( name ) ; if ( scope != - 1 ) { context . removeAttribute ( name , scope ) ; } } } }
Removes a named property from the object .
148,670
public synchronized Object [ ] getIds ( ) { String [ ] keys = getAllKeys ( ) ; int size = keys . length + indexedProps . size ( ) ; Object [ ] res = new Object [ size ] ; System . arraycopy ( keys , 0 , res , 0 , keys . length ) ; int i = keys . length ; for ( Object index : indexedProps . keySet ( ) ) { res [ i ++ ] =...
Get an array of property ids .
148,671
public boolean hasInstance ( Scriptable instance ) { Scriptable proto = instance . getPrototype ( ) ; while ( proto != null ) { if ( proto . equals ( this ) ) return true ; proto = proto . getPrototype ( ) ; } return false ; }
Implements the instanceof operator .
148,672
public void setLoop ( boolean doLoop , GVRContext gvrContext ) { if ( this . loop != doLoop ) { for ( GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations ) { if ( doLoop ) gvrKeyFrameAnimation . setRepeatMode ( GVRRepeatMode . REPEATED ) ; else gvrKeyFrameAnimation . setRepeatMode ( GVRRepeatMode . ONCE ) ; }...
SetLoop will either set the GVRNodeAnimation s Repeat Mode to REPEATED if loop is true . or it will set the GVRNodeAnimation s Repeat Mode to ONCE if loop is false if loop is set to TRUE when it was previously FALSE then start the Animation .
148,673
public void setCycleInterval ( float newCycleInterval ) { if ( ( this . cycleInterval != newCycleInterval ) && ( newCycleInterval > 0 ) ) { for ( GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations ) { } this . cycleInterval = newCycleInterval ; } }
Set the TimeSensor s cycleInterval property Currently this does not change the duration of the animation .
148,674
public ExecutionChain setErrorCallback ( ErrorCallback callback ) { if ( state . get ( ) == State . RUNNING ) { throw new IllegalStateException ( "Invalid while ExecutionChain is running" ) ; } errorCallback = callback ; return this ; }
Set a callback to handle any exceptions in the chain of execution .
148,675
public void execute ( ) { State currentState = state . getAndSet ( State . RUNNING ) ; if ( currentState == State . RUNNING ) { throw new IllegalStateException ( "ExecutionChain is already running!" ) ; } executeRunnable = new ExecuteRunnable ( ) ; }
Start the chain of execution running .
148,676
public boolean isHomeKeyPresent ( ) { final GVRApplication application = mApplication . get ( ) ; if ( null != application ) { final String model = getHmtModel ( ) ; if ( null != model && model . contains ( "R323" ) ) { return true ; } } return false ; }
Does the headset the device is docked into have a dedicated home key
148,677
public void addAuxHandler ( Object handler , String prefix ) { if ( handler == null ) { throw new NullPointerException ( ) ; } auxHandlers . put ( prefix , handler ) ; allHandlers . add ( handler ) ; addDeclaredMethods ( handler , prefix ) ; inputConverter . addDeclaredConverters ( handler ) ; outputConverter . addDecl...
This method is very similar to addMainHandler except ShellFactory will pass all handlers registered with this method to all this shell s subshells .
148,678
public void commandLoop ( ) throws IOException { for ( Object handler : allHandlers ) { if ( handler instanceof ShellManageable ) { ( ( ShellManageable ) handler ) . cliEnterLoop ( ) ; } } output . output ( appName , outputConverter ) ; String command = "" ; while ( true ) { try { command = input . readCommand ( path )...
Runs the command session . Create the Shell then run this method to listen to the user and the Shell will invoke Handler s methods .
148,679
public void addVariable ( String varName , Object value ) { synchronized ( mGlobalVariables ) { mGlobalVariables . put ( varName , value ) ; } refreshGlobalBindings ( ) ; }
Add a variable to the scripting context .
148,680
public void attachScriptFile ( IScriptable target , IScriptFile scriptFile ) { mScriptMap . put ( target , scriptFile ) ; scriptFile . invokeFunction ( "onAttach" , new Object [ ] { target } ) ; }
Attach a script file to a scriptable target .
148,681
public void detachScriptFile ( IScriptable target ) { IScriptFile scriptFile = mScriptMap . remove ( target ) ; if ( scriptFile != null ) { scriptFile . invokeFunction ( "onDetach" , new Object [ ] { target } ) ; } }
Detach any script file from a scriptable target .
148,682
public void bindScriptBundleToScene ( GVRScriptBundle scriptBundle , GVRScene scene ) throws IOException , GVRScriptException { for ( GVRSceneObject sceneObject : scene . getSceneObjects ( ) ) { bindBundleToSceneObject ( scriptBundle , sceneObject ) ; } }
Binds a script bundle to a scene .
148,683
public void bindBundleToSceneObject ( GVRScriptBundle scriptBundle , GVRSceneObject rootSceneObject ) throws IOException , GVRScriptException { bindHelper ( scriptBundle , rootSceneObject , BIND_MASK_SCENE_OBJECTS ) ; }
Binds a script bundle to scene graph rooted at a scene object .
148,684
protected void bindHelper ( GVRScriptBundle scriptBundle , GVRSceneObject rootSceneObject , int bindMask ) throws IOException , GVRScriptException { for ( GVRScriptBindingEntry entry : scriptBundle . file . binding ) { GVRAndroidResource rc ; if ( entry . volumeType == null || entry . volumeType . isEmpty ( ) ) { rc = ...
Helper function to bind script bundler to various targets
148,685
private long doMemoryManagementAndPerFrameCallbacks ( ) { long currentTime = GVRTime . getCurrentTime ( ) ; mFrameTime = ( currentTime - mPreviousTimeNanos ) / 1e9f ; mPreviousTimeNanos = currentTime ; if ( ! ( mSensoredScene == null || ! mMainScene . equals ( mSensoredScene ) ) ) { Runnable runnable ; while ( ( runnab...
This is the code that needs to be executed before either eye is drawn .
148,686
protected void capture3DScreenShot ( GVRRenderTarget renderTarget , boolean isMultiview ) { if ( mScreenshot3DCallback == null ) { return ; } final Bitmap [ ] bitmaps = new Bitmap [ 6 ] ; renderSixCamerasAndReadback ( mMainScene . getMainCameraRig ( ) , bitmaps , renderTarget , isMultiview ) ; returnScreenshot3DToCalle...
capture 3D screenshot
148,687
private void captureEye ( GVRScreenshotCallback callback , GVRRenderTarget renderTarget , GVRViewManager . EYE eye , boolean useMultiview ) { if ( null == callback ) { return ; } readRenderResult ( renderTarget , eye , useMultiview ) ; returnScreenshotToCaller ( callback , mReadbackBufferWidth , mReadbackBufferHeight )...
capture screenshot of an eye
148,688
protected void captureCenterEye ( GVRRenderTarget renderTarget , boolean isMultiview ) { if ( mScreenshotCenterCallback == null ) { return ; } final GVRCamera centerCamera = mMainScene . getMainCameraRig ( ) . getCenterCamera ( ) ; final GVRMaterial postEffect = new GVRMaterial ( this , GVRMaterial . GVRShaderType . Ve...
capture center eye
148,689
public boolean runOnMainThreadNext ( Runnable r ) { assert handler != null ; if ( ! sanityCheck ( "runOnMainThreadNext " + r ) ) { return false ; } return handler . post ( r ) ; }
Queues a Runnable to be run on the main thread on the next iteration of the messaging loop . This is handy when code running on the main thread needs to run something else on the main thread but only after the current code has finished executing .
148,690
private void showSettingsMenu ( final Cursor cursor ) { Log . d ( TAG , "showSettingsMenu" ) ; enableSettingsCursor ( cursor ) ; context . runOnGlThread ( new Runnable ( ) { public void run ( ) { new SettingsView ( context , scene , CursorManager . this , settingsCursor . getIoDevice ( ) . getCursorControllerId ( ) , c...
Presents the Cursor Settings to the User . Only works if scene is set .
148,691
private void updateCursorsInScene ( GVRScene scene , boolean add ) { synchronized ( mCursors ) { for ( Cursor cursor : mCursors ) { if ( cursor . isActive ( ) ) { if ( add ) { addCursorToScene ( cursor ) ; } else { removeCursorFromScene ( cursor ) ; } } } } }
Add or remove the active cursors from the provided scene .
148,692
public List < Widget > getAllViews ( ) { List < Widget > views = new ArrayList < > ( ) ; for ( Widget child : mContent . getChildren ( ) ) { Widget item = ( ( ListItemHostWidget ) child ) . getGuest ( ) ; if ( item != null ) { views . add ( item ) ; } } return views ; }
Get all views from the list content
148,693
public boolean clearSelection ( boolean requestLayout ) { Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "clearSelection [%d]" , mSelectedItemsList . size ( ) ) ; boolean updateLayout = false ; List < ListItemHostWidget > views = getAllHosts ( ) ; for ( ListItemHostWidget host : views ) { if ( host . isSelected ( ) ) { hos...
Clear the selection of all items .
148,694
public boolean updateSelectedItemsList ( int dataIndex , boolean select ) { boolean done = false ; boolean contains = isSelected ( dataIndex ) ; if ( select ) { if ( ! contains ) { if ( ! mMultiSelectionSupported ) { clearSelection ( false ) ; } Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "updateSelectedItemsList add in...
Update the selection state of the item
148,695
private void onScrollImpl ( final Vector3Axis offset , final LayoutScroller . OnScrollListener listener ) { if ( ! isScrolling ( ) ) { mScroller = new ScrollingProcessor ( offset , listener ) ; mScroller . scroll ( ) ; } }
This method is called if the data set has been scrolled .
148,696
protected void recycleChildren ( ) { for ( ListItemHostWidget host : getAllHosts ( ) ) { recycle ( host ) ; } mContent . onTransformChanged ( ) ; mContent . requestLayout ( ) ; }
Recycle all views in the list . The host views might be reused for other data to save resources on creating new widgets .
148,697
private void onChangedImpl ( final int preferableCenterPosition ) { for ( ListOnChangedListener listener : mOnChangedListeners ) { listener . onChangedStart ( this ) ; } Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "onChangedImpl(%s): items [%d] views [%d] mLayouts.size() = %d " + "preferableCenterPosition = %d" , getNam...
This method is called if the data set has been changed . Subclasses might want to override this method to add some extra logic .
148,698
static Shell createTerminalConsoleShell ( String prompt , String appName , ShellCommandHandler mainHandler , InputStream input , OutputStream output ) { try { PrintStream out = new PrintStream ( output ) ; jline . Terminal term = TerminalFactory . get ( ) ; final ConsoleReader console = new ConsoleReader ( input , outp...
Facade method for operating the Unix - like terminal supporting line editing and command history .
148,699
static Shell createTelnetConsoleShell ( String prompt , String appName , ShellCommandHandler mainHandler , InputStream input , OutputStream output ) { try { final nvt4j . impl . Terminal nvt4jTerminal = new nvt4j . impl . Terminal ( input , output ) { private boolean cleared ; private boolean moved ; public void clear ...
Facade method for operating the Telnet Shell supporting line editing and command history over a socket .