_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q5100
GVRVertexBuffer.getFloatVec
train
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()); Flo...
java
{ "resource": "" }
q5101
GVRVertexBuffer.getFloatArray
train
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; ...
java
{ "resource": "" }
q5102
GVRVertexBuffer.getIntVec
train
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()); IntBuff...
java
{ "resource": "" }
q5103
GVRVertexBuffer.getIntArray
train
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; }
java
{ "resource": "" }
q5104
GVRVertexBuffer.getSphereBound
train
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 sphe...
java
{ "resource": "" }
q5105
GVRVertexBuffer.getBoxBound
train
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"); ...
java
{ "resource": "" }
q5106
GVRAudioSource.load
train
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", get...
java
{ "resource": "" }
q5107
GVRAudioSource.unload
train
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...
java
{ "resource": "" }
q5108
GVRAudioSource.pause
train
public void pause() { if (mAudioListener != null) { int sourceId = getSourceId(); if (sourceId != GvrAudioEngine.INVALID_ID) { mAudioListener.getAudioEngine().pauseSound(sourceId); } } }
java
{ "resource": "" }
q5109
GVRAudioSource.stop
train
public void stop() { if (mAudioListener != null) { Log.d("SOUND", "stopping audio source %d %s", getSourceId(), getSoundFile()); mAudioListener.getAudioEngine().stopSound(getSourceId()); } }
java
{ "resource": "" }
q5110
GVRAudioSource.setVolume
train
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 mAudioLi...
java
{ "resource": "" }
q5111
Vector3Axis.get
train
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); } }
java
{ "resource": "" }
q5112
Vector3Axis.set
train
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 ne...
java
{ "resource": "" }
q5113
Vector3Axis.delta
train
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)) { re...
java
{ "resource": "" }
q5114
PageIndicatorWidget.setPageCount
train
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; } s...
java
{ "resource": "" }
q5115
PageIndicatorWidget.setCurrentPage
train
public boolean setCurrentPage(final int page) { Log.d(TAG, "setPageId pageId = %d", page); return (page >= 0 && page < getCheckableCount()) && check(page); }
java
{ "resource": "" }
q5116
GVRPhysicsAvatar.loadPhysics
train
public void loadPhysics(String filename, GVRScene scene) throws IOException { GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene); }
java
{ "resource": "" }
q5117
MainScene.rotateToFaceCamera
train
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...
java
{ "resource": "" }
q5118
MainScene.rotateToFaceCamera
train
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; }
java
{ "resource": "" }
q5119
MainScene.updateFrontFacingRotation
train
public void updateFrontFacingRotation(float rotation) { if (!Float.isNaN(rotation) && !equal(rotation, frontFacingRotation)) { final float oldRotation = frontFacingRotation; frontFacingRotation = rotation % 360; for (OnFrontRotationChangedListener listener : mOnFrontRotationC...
java
{ "resource": "" }
q5120
MainScene.rotateToFront
train
public void rotateToFront() { GVRTransform transform = mSceneRootObject.getTransform(); transform.setRotation(1, 0, 0, 0); transform.rotateByAxisWithPivot(-frontFacingRotation + 180, 0, 1, 0, 0, 0, 0); }
java
{ "resource": "" }
q5121
MainScene.setScale
train
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(mLeftCamera...
java
{ "resource": "" }
q5122
GVRAnimation.setRepeatMode
train
public GVRAnimation setRepeatMode(int repeatMode) { if (GVRRepeatMode.invalidRepeatMode(repeatMode)) { throw new IllegalArgumentException(repeatMode + " is not a valid repetition type"); } mRepeatMode = repeatMode; return this; }
java
{ "resource": "" }
q5123
GVRAnimation.setOffset
train
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; ...
java
{ "resource": "" }
q5124
GVRAnimation.setDuration
train
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; }
java
{ "resource": "" }
q5125
GVRAnimation.setOnFinish
train
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; // l...
java
{ "resource": "" }
q5126
GVRRenderData.bindShader
train
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) { templ...
java
{ "resource": "" }
q5127
GVRRenderData.setCullFace
train
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."); ...
java
{ "resource": "" }
q5128
GVRRenderData.setDrawMode
train
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) { t...
java
{ "resource": "" }
q5129
LayoutScroller.fling
train
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...
java
{ "resource": "" }
q5130
LayoutScroller.scrollToNextPage
train
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, "Paginat...
java
{ "resource": "" }
q5131
LayoutScroller.scrollToPage
train
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(...
java
{ "resource": "" }
q5132
LayoutScroller.scrollToItem
train
public int scrollToItem(int position) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "scrollToItem position = %d", position); scrollToPosition(position); return mCurrentItemIndex; }
java
{ "resource": "" }
q5133
LayoutScroller.getCurrentPage
train
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); ...
java
{ "resource": "" }
q5134
GVRBone.getName
train
public String getName() { GVRSceneObject owner = getOwnerObject(); String name = ""; if (owner != null) { name = owner.getName(); if (name == null) return ""; } return name; }
java
{ "resource": "" }
q5135
GVRBone.setFinalTransformMatrix
train
public void setFinalTransformMatrix(Matrix4f finalTransform) { float[] mat = new float[16]; finalTransform.get(mat); NativeBone.setFinalTransformMatrix(getNative(), mat); }
java
{ "resource": "" }
q5136
GVRBone.getFinalTransformMatrix
train
public Matrix4f getFinalTransformMatrix() { final FloatBuffer fb = ByteBuffer.allocateDirect(4*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); NativeBone.getFinalTransformMatrix(getNative(), fb); return new Matrix4f(fb); }
java
{ "resource": "" }
q5137
GVRBone.prettyPrint
train
@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() + ", finalTrans...
java
{ "resource": "" }
q5138
GVRTextureCapturer.update
train
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 GVRRend...
java
{ "resource": "" }
q5139
GVRTextureCapturer.setCapture
train
public void setCapture(boolean capture, float fps) { capturing = capture; NativeTextureCapturer.setCapture(getNative(), capture, fps); }
java
{ "resource": "" }
q5140
GVRRenderTarget.setTexture
train
public void setTexture(GVRRenderTexture texture) { mTexture = texture; NativeRenderTarget.setTexture(getNative(), texture.getNative()); }
java
{ "resource": "" }
q5141
CheckableGroup.addOnCheckChangedListener
train
public <T extends Widget & Checkable> boolean addOnCheckChangedListener (OnCheckChangedListener listener) { final boolean added; synchronized (mListeners) { added = mListeners.add(listener); } if (added) { List<T> c = getCheckableChildren(); ...
java
{ "resource": "" }
q5142
CheckableGroup.check
train
public <T extends Widget & Checkable> boolean check(int checkableIndex) { List<T> children = getCheckableChildren(); T checkableWidget = children.get(checkableIndex); return checkInternal(checkableWidget, true); }
java
{ "resource": "" }
q5143
CheckableGroup.uncheck
train
public <T extends Widget & Checkable> boolean uncheck(int checkableIndex) { List<T> children = getCheckableChildren(); T checkableWidget = children.get(checkableIndex); return checkInternal(checkableWidget, false); }
java
{ "resource": "" }
q5144
CheckableGroup.clearChecks
train
public <T extends Widget & Checkable> void clearChecks() { List<T> children = getCheckableChildren(); for (T c : children) { c.setChecked(false); } }
java
{ "resource": "" }
q5145
CheckableGroup.getCheckedWidgets
train
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; }
java
{ "resource": "" }
q5146
CheckableGroup.getCheckedWidgetIndexes
train
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); ...
java
{ "resource": "" }
q5147
CheckableGroup.getCheckableChildren
train
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 r...
java
{ "resource": "" }
q5148
GVRCameraSceneObject.setUpCameraForVrMode
train
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, ...
java
{ "resource": "" }
q5149
GVRShadowMap.makeOrthoShadowCamera
train
static GVROrthogonalCamera makeOrthoShadowCamera(GVRPerspectiveCamera centerCam) { GVROrthogonalCamera shadowCam = new GVROrthogonalCamera(centerCam.getGVRContext()); float near = centerCam.getNearClippingDistance(); float far = centerCam.getFarClippingDistance(); float fovy = (float...
java
{ "resource": "" }
q5150
GVRShadowMap.makePerspShadowCamera
train
static GVRPerspectiveCamera makePerspShadowCamera(GVRPerspectiveCamera centerCam, float coneAngle) { GVRPerspectiveCamera camera = new GVRPerspectiveCamera(centerCam.getGVRContext()); float near = centerCam.getNearClippingDistance(); float far = centerCam.getFarClippingDistance(); c...
java
{ "resource": "" }
q5151
AnchorImplementation.SetNewViewpoint
train
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; ...
java
{ "resource": "" }
q5152
AnchorImplementation.WebPageCloseOnClick
train
private void WebPageCloseOnClick(GVRViewSceneObject gvrWebViewSceneObject, GVRSceneObject gvrSceneObjectAnchor, String url) { final String urlFinal = url; webPagePlusUISceneObject = new GVRSceneObject(gvrContext); webPagePlusUISceneObject.getTransform().setPosition(webPagePlusUIPosition[0], web...
java
{ "resource": "" }
q5153
OrientedLayout.getOrientationAxis
train
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; ...
java
{ "resource": "" }
q5154
GVRSceneObject.attachComponent
train
public boolean attachComponent(GVRComponent component) { if (component.getNative() != 0) { NativeSceneObject.attachComponent(getNative(), component.getNative()); } synchronized (mComponents) { long type = component.getType(); if (!mComponents.containsKey(type)...
java
{ "resource": "" }
q5155
GVRSceneObject.detachComponent
train
public GVRComponent detachComponent(long type) { NativeSceneObject.detachComponent(getNative(), type); synchronized (mComponents) { GVRComponent component = mComponents.remove(type); if (component != null) { component.setOwnerObject(null); } ...
java
{ "resource": "" }
q5156
GVRSceneObject.getAllComponents
train
@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 : mChil...
java
{ "resource": "" }
q5157
GVRSceneObject.setPickingEnabled
train
public void setPickingEnabled(boolean enabled) { if (enabled != getPickingEnabled()) { if (enabled) { attachComponent(new GVRSphereCollider(getGVRContext())); } else { detachComponent(GVRCollider.getComponentType()); } } }
java
{ "resource": "" }
q5158
GVRSceneObject.removeChildObjectsByName
train
public int removeChildObjectsByName(final String name) { int removed = 0; if (null != name && !name.isEmpty()) { removed = removeChildObjectsByNameImpl(name); } return removed; }
java
{ "resource": "" }
q5159
GVRSceneObject.removeChildObjectByName
train
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) { ...
java
{ "resource": "" }
q5160
GVRSceneObject.onNewParentObject
train
protected void onNewParentObject(GVRSceneObject parent) { for (GVRComponent comp : mComponents.values()) { comp.onNewOwnersParent(parent); } }
java
{ "resource": "" }
q5161
GVRSceneObject.onRemoveParentObject
train
protected void onRemoveParentObject(GVRSceneObject parent) { for (GVRComponent comp : mComponents.values()) { comp.onRemoveOwnersParent(parent); } }
java
{ "resource": "" }
q5162
GVRSceneObject.prettyPrint
train
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(...
java
{ "resource": "" }
q5163
GVRGearCursorController.setControllerModel
train
public void setControllerModel(GVRSceneObject controllerModel) { if (mControllerModel != null) { mControllerGroup.removeChildObject(mControllerModel); } mControllerModel = controllerModel; mControllerGroup.addChildObject(mControllerModel); mControllerModel...
java
{ "resource": "" }
q5164
GVRGearCursorController.setCursorDepth
train
@Override public void setCursorDepth(float depth) { super.setCursorDepth(depth); if (mRayModel != null) { mRayModel.getTransform().setScaleZ(mCursorDepth); } }
java
{ "resource": "" }
q5165
GVRGearCursorController.setPosition
train
@Override public void setPosition(float x, float y, float z) { position.set(x, y, z); pickDir.set(x, y, z); pickDir.normalize(); invalidate(); }
java
{ "resource": "" }
q5166
GVRGearCursorController.getHandedness
train
@SuppressWarnings("unused") public Handedness getHandedness() { if ((currentControllerEvent == null) || currentControllerEvent.isRecycled()) { return null; } return currentControllerEvent.handedness == 0.0f ? Handedness.LEFT : Handedness.RIGHT; }
java
{ "resource": "" }
q5167
GVRCursorController.updatePicker
train
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); }
java
{ "resource": "" }
q5168
JSONHelpers.loadJSONAsset
train
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)); }
java
{ "resource": "" }
q5169
JSONHelpers.getJSONColor
train
public static int getJSONColor(final JSONObject json, String elementName) throws JSONException { Object raw = json.get(elementName); return convertJSONColor(raw); }
java
{ "resource": "" }
q5170
GVRAsynchronousResourceLoader.loadFutureCubemapTexture
train
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....
java
{ "resource": "" }
q5171
GVRAsynchronousResourceLoader.loadCubemapTexture
train
public static void loadCubemapTexture(final GVRContext context, ResourceCache<GVRImage> textureCache, final TextureCallback callback, final GVRAndroidResource resource, int priority, ...
java
{ "resource": "" }
q5172
GVRAsynchronousResourceLoader.decodeStream
train
public static Bitmap decodeStream(InputStream stream, boolean closeStream) { return AsyncBitmapTexture.decodeStream(stream, AsyncBitmapTexture.glMaxTextureSize, AsyncBitmapTexture.glMaxTextureSize, true, null, closeStream); }
java
{ "resource": "" }
q5173
GVRShaderManager.getShaderType
train
public GVRShaderId getShaderType(Class<? extends GVRShader> shaderClass) { GVRShaderId shaderId = mShaderTemplates.get(shaderClass); if (shaderId == null) { GVRContext ctx = getGVRContext(); shaderId = new GVRShaderId(shaderClass); mShaderTemplates.put(sh...
java
{ "resource": "" }
q5174
GVRShaderManager.makeLayout
train
static String makeLayout(String descriptor, String blockName, boolean useUBO) { return NativeShaderManager.makeLayout(descriptor, blockName, useUBO); }
java
{ "resource": "" }
q5175
GVRTransform.rotateWithPivot
train
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); }
java
{ "resource": "" }
q5176
GVRCubemapImage.setFaceNames
train
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); } }
java
{ "resource": "" }
q5177
GVRWorld.startDrag
train
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() != GVRRigi...
java
{ "resource": "" }
q5178
GVRWorld.stopDrag
train
public void stopDrag() { mPhysicsDragger.stopDrag(); mPhysicsContext.runOnPhysicsThread(new Runnable() { @Override public void run() { if (mRigidBodyDragMe != null) { NativePhysics3DWorld.stopDrag(getNative()); mRigidBodyDr...
java
{ "resource": "" }
q5179
GVRScaleKey.setValue
train
public void setValue(Vector3f scale) { mX = scale.x; mY = scale.y; mZ = scale.z; }
java
{ "resource": "" }
q5180
GVRSwitch.selectByName
train
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)) { ...
java
{ "resource": "" }
q5181
GVRMeshMorph.onAttach
train
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"); } ...
java
{ "resource": "" }
q5182
GVRObjectPicker.intersect
train
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.maxCorne...
java
{ "resource": "" }
q5183
GVRVideoSceneObject.makePlayerInstance
train
public static GVRVideoSceneObjectPlayer<MediaPlayer> makePlayerInstance(final MediaPlayer mediaPlayer) { return new GVRVideoSceneObjectPlayer<MediaPlayer>() { @Override public MediaPlayer getPlayer() { return mediaPlayer; } @Override p...
java
{ "resource": "" }
q5184
GVRTextViewSceneObject.setRefreshFrequency
train
public void setRefreshFrequency(IntervalFrequency frequency) { if (NONE_REFRESH_INTERVAL == mRefreshInterval && IntervalFrequency.NONE != frequency) { // Install draw-frame listener if frequency is no longer NONE getGVRContext().unregisterDrawFrameListener(mFrameListener); ge...
java
{ "resource": "" }
q5185
GVRTextViewSceneObject.getRefreshFrequency
train
public IntervalFrequency getRefreshFrequency() { switch (mRefreshInterval) { case REALTIME_REFRESH_INTERVAL: return IntervalFrequency.REALTIME; case HIGH_REFRESH_INTERVAL: return IntervalFrequency.HIGH; case LOW_REFRESH_INTERVAL: ...
java
{ "resource": "" }
q5186
GVRPlaneEmitter.generateParticleVelocities
train
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+...
java
{ "resource": "" }
q5187
GVRPlaneEmitter.generateParticleTimeStamps
train
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; ...
java
{ "resource": "" }
q5188
WidgetLib.init
train
public static WidgetLib init(GVRContext gvrContext, String customPropertiesAsset) throws InterruptedException, JSONException, NoSuchMethodException { if (mInstance == null) { // Constructor sets mInstance to ensure the initialization order new WidgetLib(gvrContext, customProp...
java
{ "resource": "" }
q5189
AnimationInteractivityManager.BuildInteractiveObjectFromAnchor
train
public void BuildInteractiveObjectFromAnchor(Sensor anchorSensor, String anchorDestination) { InteractiveObject interactiveObject = new InteractiveObject(); interactiveObject.setSensor(anchorSensor, anchorDestination); interactiveObjects.add(interactiveObject); }
java
{ "resource": "" }
q5190
AnimationInteractivityManager.RunScript
train
private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) { boolean complete = false; if ( V8JavaScriptEngine) { GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File(); String paramString ...
java
{ "resource": "" }
q5191
AnimationInteractivityManager.ConvertDirectionalVectorToQuaternion
train
public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) { d.negate(); Quaternionf q = new Quaternionf(); // check for exception condition if ((d.x == 0) && (d.z == 0)) { // exception condition if direction is (0,y,0): // straight up, straight down or a...
java
{ "resource": "" }
q5192
FPSCounter.count
train
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); }
java
{ "resource": "" }
q5193
FPSCounter.startCheck
train
public static void startCheck(String extra) { startCheckTime = System.currentTimeMillis(); nextCheckTime = startCheckTime; Log.d(Log.SUBSYSTEM.TRACING, "FPSCounter" , "[%d] startCheck %s", startCheckTime, extra); }
java
{ "resource": "" }
q5194
FPSCounter.timeCheck
train
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); } ...
java
{ "resource": "" }
q5195
GVRMorphAnimation.animate
train
public void animate(GVRHybridObject object, float animationTime) { GVRMeshMorph morph = (GVRMeshMorph) mTarget; mKeyInterpolator.animate(animationTime * mDuration, mCurrentValues); morph.setWeights(mCurrentValues); }
java
{ "resource": "" }
q5196
GVRLODGroup.addRange
train
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");...
java
{ "resource": "" }
q5197
GVRLODGroup.onDrawFrame
train
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(); ...
java
{ "resource": "" }
q5198
ShellFactory.createConsoleShell
train
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>(); modif...
java
{ "resource": "" }
q5199
ShellFactory.createConsoleShell
train
public static Shell createConsoleShell(String prompt, String appName, Object mainHandler) { return createConsoleShell(prompt, appName, mainHandler, new EmptyMultiMap<String, Object>()); }
java
{ "resource": "" }