repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getNormalX | public float getNormalX(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat(vertex * 3 * SIZEOF_FLOAT);
} | java | public float getNormalX(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat(vertex * 3 * SIZEOF_FLOAT);
} | [
"public",
"float",
"getNormalX",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasNormals",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no normals\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"ret... | Returns the x-coordinate of a vertex normal.
@param vertex the vertex index
@return the x coordinate | [
"Returns",
"the",
"x",
"-",
"coordinate",
"of",
"a",
"vertex",
"normal",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L716-L724 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getNormalY | public float getNormalY(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | java | public float getNormalY(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | [
"public",
"float",
"getNormalY",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasNormals",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no normals\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"ret... | Returns the y-coordinate of a vertex normal.
@param vertex the vertex index
@return the y coordinate | [
"Returns",
"the",
"y",
"-",
"coordinate",
"of",
"a",
"vertex",
"normal",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L733-L741 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getNormalZ | public float getNormalZ(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
} | java | public float getNormalZ(int vertex) {
if (!hasNormals()) {
throw new IllegalStateException("mesh has no normals");
}
checkVertexIndexBounds(vertex);
return m_normals.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
} | [
"public",
"float",
"getNormalZ",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasNormals",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no normals\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"ret... | Returns the z-coordinate of a vertex normal.
@param vertex the vertex index
@return the z coordinate | [
"Returns",
"the",
"z",
"-",
"coordinate",
"of",
"a",
"vertex",
"normal",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L750-L758 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getTangentY | public float getTangentY(int vertex) {
if (!hasTangentsAndBitangents()) {
throw new IllegalStateException("mesh has no bitangents");
}
checkVertexIndexBounds(vertex);
return m_tangents.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | java | public float getTangentY(int vertex) {
if (!hasTangentsAndBitangents()) {
throw new IllegalStateException("mesh has no bitangents");
}
checkVertexIndexBounds(vertex);
return m_tangents.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | [
"public",
"float",
"getTangentY",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasTangentsAndBitangents",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no bitangents\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
... | Returns the y-coordinate of a vertex bitangent.
@param vertex the vertex index
@return the y coordinate | [
"Returns",
"the",
"y",
"-",
"coordinate",
"of",
"a",
"vertex",
"bitangent",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L784-L792 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getBitangentY | public float getBitangentY(int vertex) {
if (!hasTangentsAndBitangents()) {
throw new IllegalStateException("mesh has no bitangents");
}
checkVertexIndexBounds(vertex);
return m_bitangents.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | java | public float getBitangentY(int vertex) {
if (!hasTangentsAndBitangents()) {
throw new IllegalStateException("mesh has no bitangents");
}
checkVertexIndexBounds(vertex);
return m_bitangents.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
} | [
"public",
"float",
"getBitangentY",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasTangentsAndBitangents",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no bitangents\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
... | Returns the y-coordinate of a vertex tangent.
@param vertex the vertex index
@return the y coordinate | [
"Returns",
"the",
"y",
"-",
"coordinate",
"of",
"a",
"vertex",
"tangent",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L835-L843 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getColorR | public float getColorR(int vertex, int colorset) {
if (!hasColors(colorset)) {
throw new IllegalStateException("mesh has no colorset " + colorset);
}
checkVertexIndexBounds(vertex);
/* bound checks for colorset are done by java for us */
return m_colorsets[colorset].getFloat(vertex * 4 * SIZEOF_FLOAT);
} | java | public float getColorR(int vertex, int colorset) {
if (!hasColors(colorset)) {
throw new IllegalStateException("mesh has no colorset " + colorset);
}
checkVertexIndexBounds(vertex);
/* bound checks for colorset are done by java for us */
return m_colorsets[colorset].getFloat(vertex * 4 * SIZEOF_FLOAT);
} | [
"public",
"float",
"getColorR",
"(",
"int",
"vertex",
",",
"int",
"colorset",
")",
"{",
"if",
"(",
"!",
"hasColors",
"(",
"colorset",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no colorset \"",
"+",
"colorset",
")",
";",
"}",
... | Returns the red color component of a color from a vertex color set.
@param vertex the vertex index
@param colorset the color set
@return the red color component | [
"Returns",
"the",
"red",
"color",
"component",
"of",
"a",
"color",
"from",
"a",
"vertex",
"color",
"set",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L870-L879 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getTexCoordU | public float getTexCoordU(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
return m_texcoords[coords].getFloat(
vertex * m_numUVComponents[coords] * SIZEOF_FLOAT);
} | java | public float getTexCoordU(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
return m_texcoords[coords].getFloat(
vertex * m_numUVComponents[coords] * SIZEOF_FLOAT);
} | [
"public",
"float",
"getTexCoordU",
"(",
"int",
"vertex",
",",
"int",
"coords",
")",
"{",
"if",
"(",
"!",
"hasTexCoords",
"(",
"coords",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no texture coordinate set \"",
"+",
"coords",
")",
... | Returns the u component of a coordinate from a texture coordinate set.
@param vertex the vertex index
@param coords the texture coordinate set
@return the u component | [
"Returns",
"the",
"u",
"component",
"of",
"a",
"coordinate",
"from",
"a",
"texture",
"coordinate",
"set",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L946-L957 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/NodeEntry.java | NodeEntry.getProperty | @SuppressWarnings("WeakerAccess")
public String getProperty(Enum<?> key, boolean lowerCase) {
final String keyName;
if (lowerCase) {
keyName = key.name().toLowerCase(Locale.ENGLISH);
} else {
keyName = key.name();
}
return getProperty(keyName);
} | java | @SuppressWarnings("WeakerAccess")
public String getProperty(Enum<?> key, boolean lowerCase) {
final String keyName;
if (lowerCase) {
keyName = key.name().toLowerCase(Locale.ENGLISH);
} else {
keyName = key.name();
}
return getProperty(keyName);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"String",
"getProperty",
"(",
"Enum",
"<",
"?",
">",
"key",
",",
"boolean",
"lowerCase",
")",
"{",
"final",
"String",
"keyName",
";",
"if",
"(",
"lowerCase",
")",
"{",
"keyName",
"=",
"key",
... | Gets the property by key converted to lowercase if requested
@param key property key
@param lowerCase convert property to lowercase if it is true, keep the original one if it is
false
@return node property | [
"Gets",
"the",
"property",
"by",
"key",
"converted",
"to",
"lowercase",
"if",
"requested"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/NodeEntry.java#L123-L132 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/NodeEntry.java | NodeEntry.toJSON | public JSONObject toJSON() {
try {
return new JSONObject(properties).putOpt("name", getName());
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, e, "toJSON()");
throw new RuntimeAssertion("NodeEntry.toJSON() failed for '%s'", this);
}
} | java | public JSONObject toJSON() {
try {
return new JSONObject(properties).putOpt("name", getName());
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, e, "toJSON()");
throw new RuntimeAssertion("NodeEntry.toJSON() failed for '%s'", this);
}
} | [
"public",
"JSONObject",
"toJSON",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"JSONObject",
"(",
"properties",
")",
".",
"putOpt",
"(",
"\"name\"",
",",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"e",
".",
"prin... | Converts the node to JSON
@return JSON object | [
"Converts",
"the",
"node",
"to",
"JSON"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/NodeEntry.java#L138-L146 | train |
Samsung/GearVRf | GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicViewManager.java | MonoscopicViewManager.onRotationSensor | @Override
public void onRotationSensor(long timeStamp, float rotationW, float rotationX, float rotationY, float rotationZ,
float gyroX, float gyroY, float gyroZ) {
GVRCameraRig cameraRig = null;
if (mMainScene != null) {
cameraRig = mMainScene.getMainCameraRig();
}
if (cameraRig != null) {
cameraRig.setRotationSensorData(timeStamp, rotationW, rotationX, rotationY, rotationZ, gyroX, gyroY, gyroZ);
updateSensoredScene();
}
} | java | @Override
public void onRotationSensor(long timeStamp, float rotationW, float rotationX, float rotationY, float rotationZ,
float gyroX, float gyroY, float gyroZ) {
GVRCameraRig cameraRig = null;
if (mMainScene != null) {
cameraRig = mMainScene.getMainCameraRig();
}
if (cameraRig != null) {
cameraRig.setRotationSensorData(timeStamp, rotationW, rotationX, rotationY, rotationZ, gyroX, gyroY, gyroZ);
updateSensoredScene();
}
} | [
"@",
"Override",
"public",
"void",
"onRotationSensor",
"(",
"long",
"timeStamp",
",",
"float",
"rotationW",
",",
"float",
"rotationX",
",",
"float",
"rotationY",
",",
"float",
"rotationZ",
",",
"float",
"gyroX",
",",
"float",
"gyroY",
",",
"float",
"gyroZ",
... | Called to reset current sensor data.
@param timeStamp
current time stamp
@param rotationW
Quaternion rotation W
@param rotationX
Quaternion rotation X
@param rotationY
Quaternion rotation Y
@param rotationZ
Quaternion rotation Z
@param gyroX
Gyro rotation X
@param gyroY
Gyro rotation Y
@param gyroZ
Gyro rotation Z | [
"Called",
"to",
"reset",
"current",
"sensor",
"data",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/backend_monoscopic/src/main/java/org/gearvrf/MonoscopicViewManager.java#L437-L449 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java | GVRAndroidResource.setStream | protected synchronized void setStream(InputStream s)
{
if (stream != null)
{
throw new UnsupportedOperationException("Cannot set the stream of an open resource");
}
stream = s;
streamState = StreamStates.OPEN;
} | java | protected synchronized void setStream(InputStream s)
{
if (stream != null)
{
throw new UnsupportedOperationException("Cannot set the stream of an open resource");
}
stream = s;
streamState = StreamStates.OPEN;
} | [
"protected",
"synchronized",
"void",
"setStream",
"(",
"InputStream",
"s",
")",
"{",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot set the stream of an open resource\"",
")",
";",
"}",
"stream",
"=",
"... | Sets the stream for a resource.
This function allows you to provide a stream that is already open to
an existing resource. It will throw an exception if that resource
already has an open stream.
@param s InputStream currently open stream to use for I/O. | [
"Sets",
"the",
"stream",
"for",
"a",
"resource",
".",
"This",
"function",
"allows",
"you",
"to",
"provide",
"a",
"stream",
"that",
"is",
"already",
"open",
"to",
"an",
"existing",
"resource",
".",
"It",
"will",
"throw",
"an",
"exception",
"if",
"that",
"... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java#L324-L332 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java | GVRAndroidResource.closeStream | public synchronized final void closeStream() {
try {
if ((stream != null) && (streamState == StreamStates.OPEN)) {
stream.close();
stream = null;
}
streamState = StreamStates.CLOSED;
} catch (IOException e) {
e.printStackTrace();
}
} | java | public synchronized final void closeStream() {
try {
if ((stream != null) && (streamState == StreamStates.OPEN)) {
stream.close();
stream = null;
}
streamState = StreamStates.CLOSED;
} catch (IOException e) {
e.printStackTrace();
}
} | [
"public",
"synchronized",
"final",
"void",
"closeStream",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"stream",
"!=",
"null",
")",
"&&",
"(",
"streamState",
"==",
"StreamStates",
".",
"OPEN",
")",
")",
"{",
"stream",
".",
"close",
"(",
")",
";",
"stre... | Close the open stream.
Close the stream if it was opened before | [
"Close",
"the",
"open",
"stream",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java#L346-L356 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java | GVRAndroidResource.getResourcePath | public String getResourcePath()
{
switch (resourceType)
{
case ANDROID_ASSETS: return assetPath;
case ANDROID_RESOURCE: return resourceFilePath;
case LINUX_FILESYSTEM: return filePath;
case NETWORK: return url.getPath();
case INPUT_STREAM: return inputStreamName;
default: return null;
}
} | java | public String getResourcePath()
{
switch (resourceType)
{
case ANDROID_ASSETS: return assetPath;
case ANDROID_RESOURCE: return resourceFilePath;
case LINUX_FILESYSTEM: return filePath;
case NETWORK: return url.getPath();
case INPUT_STREAM: return inputStreamName;
default: return null;
}
} | [
"public",
"String",
"getResourcePath",
"(",
")",
"{",
"switch",
"(",
"resourceType",
")",
"{",
"case",
"ANDROID_ASSETS",
":",
"return",
"assetPath",
";",
"case",
"ANDROID_RESOURCE",
":",
"return",
"resourceFilePath",
";",
"case",
"LINUX_FILESYSTEM",
":",
"return",... | Returns the full path of the resource file with extension.
@return path of the GVRAndroidResource. May return null if the
resource is not associated with any file | [
"Returns",
"the",
"full",
"path",
"of",
"the",
"resource",
"file",
"with",
"extension",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java#L464-L480 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java | GVRAndroidResource.getResourceFilename | public String getResourceFilename() {
switch (resourceType) {
case ANDROID_ASSETS:
return assetPath
.substring(assetPath.lastIndexOf(File.separator) + 1);
case ANDROID_RESOURCE:
return resourceFilePath.substring(
resourceFilePath.lastIndexOf(File.separator) + 1);
case LINUX_FILESYSTEM:
return filePath.substring(filePath.lastIndexOf(File.separator) + 1);
case NETWORK:
return url.getPath().substring(url.getPath().lastIndexOf("/") + 1);
case INPUT_STREAM:
return inputStreamName;
default:
return null;
}
} | java | public String getResourceFilename() {
switch (resourceType) {
case ANDROID_ASSETS:
return assetPath
.substring(assetPath.lastIndexOf(File.separator) + 1);
case ANDROID_RESOURCE:
return resourceFilePath.substring(
resourceFilePath.lastIndexOf(File.separator) + 1);
case LINUX_FILESYSTEM:
return filePath.substring(filePath.lastIndexOf(File.separator) + 1);
case NETWORK:
return url.getPath().substring(url.getPath().lastIndexOf("/") + 1);
case INPUT_STREAM:
return inputStreamName;
default:
return null;
}
} | [
"public",
"String",
"getResourceFilename",
"(",
")",
"{",
"switch",
"(",
"resourceType",
")",
"{",
"case",
"ANDROID_ASSETS",
":",
"return",
"assetPath",
".",
"substring",
"(",
"assetPath",
".",
"lastIndexOf",
"(",
"File",
".",
"separator",
")",
"+",
"1",
")"... | Returns the filename of the resource with extension.
@return Filename of the GVRAndroidResource. May return null if the
resource is not associated with any file | [
"Returns",
"the",
"filename",
"of",
"the",
"resource",
"with",
"extension",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java#L488-L510 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.loadModel | public void loadModel(GVRAndroidResource avatarResource)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
mAvatarRoot.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | java | public void loadModel(GVRAndroidResource avatarResource)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
mAvatarRoot.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | [
"public",
"void",
"loadModel",
"(",
"GVRAndroidResource",
"avatarResource",
")",
"{",
"EnumSet",
"<",
"GVRImportSettings",
">",
"settings",
"=",
"GVRImportSettings",
".",
"getRecommendedSettingsWith",
"(",
"EnumSet",
".",
"of",
"(",
"GVRImportSettings",
".",
"OPTIMIZE... | Load the avatar base model
@param avatarResource resource with avatar model | [
"Load",
"the",
"avatar",
"base",
"model"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L191-L200 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.loadModel | public void loadModel(GVRAndroidResource avatarResource, String attachBone)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
GVRSceneObject boneObject;
int boneIndex;
if (mSkeleton == null)
{
throw new IllegalArgumentException("Cannot attach model to avatar - there is no skeleton");
}
boneIndex = mSkeleton.getBoneIndex(attachBone);
if (boneIndex < 0)
{
throw new IllegalArgumentException(attachBone + " is not a bone in the avatar skeleton");
}
boneObject = mSkeleton.getBone(boneIndex);
if (boneObject == null)
{
throw new IllegalArgumentException(attachBone +
" does not have a bone object in the avatar skeleton");
}
boneObject.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | java | public void loadModel(GVRAndroidResource avatarResource, String attachBone)
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_ANIMATION));
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, avatarResource);
GVRSceneObject modelRoot = new GVRSceneObject(ctx);
GVRSceneObject boneObject;
int boneIndex;
if (mSkeleton == null)
{
throw new IllegalArgumentException("Cannot attach model to avatar - there is no skeleton");
}
boneIndex = mSkeleton.getBoneIndex(attachBone);
if (boneIndex < 0)
{
throw new IllegalArgumentException(attachBone + " is not a bone in the avatar skeleton");
}
boneObject = mSkeleton.getBone(boneIndex);
if (boneObject == null)
{
throw new IllegalArgumentException(attachBone +
" does not have a bone object in the avatar skeleton");
}
boneObject.addChildObject(modelRoot);
ctx.getAssetLoader().loadModel(volume, modelRoot, settings, false, mLoadModelHandler);
} | [
"public",
"void",
"loadModel",
"(",
"GVRAndroidResource",
"avatarResource",
",",
"String",
"attachBone",
")",
"{",
"EnumSet",
"<",
"GVRImportSettings",
">",
"settings",
"=",
"GVRImportSettings",
".",
"getRecommendedSettingsWith",
"(",
"EnumSet",
".",
"of",
"(",
"GVR... | Load a model to attach to the avatar
@param avatarResource resource with avatar model
@param attachBone name of bone to attach model to | [
"Load",
"a",
"model",
"to",
"attach",
"to",
"the",
"avatar"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L207-L233 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.loadAnimation | public void loadAnimation(GVRAndroidResource animResource, String boneMap)
{
String filePath = animResource.getResourcePath();
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, animResource);
if (filePath.endsWith(".bvh"))
{
GVRAnimator animator = new GVRAnimator(ctx);
animator.setName(filePath);
try
{
BVHImporter importer = new BVHImporter(ctx);
GVRSkeletonAnimation skelAnim;
if (boneMap != null)
{
GVRSkeleton skel = importer.importSkeleton(animResource);
skelAnim = importer.readMotion(skel);
animator.addAnimation(skelAnim);
GVRPoseMapper retargeter = new GVRPoseMapper(mSkeleton, skel, skelAnim.getDuration());
retargeter.setBoneMap(boneMap);
animator.addAnimation(retargeter);
}
else
{
skelAnim = importer.importAnimation(animResource, mSkeleton);
animator.addAnimation(skelAnim);
}
addAnimation(animator);
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
animator,
filePath,
null);
}
catch (IOException ex)
{
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
null,
filePath,
ex.getMessage());
}
}
else
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_TEXTURING));
GVRSceneObject animRoot = new GVRSceneObject(ctx);
ctx.getAssetLoader().loadModel(volume, animRoot, settings, false, mLoadAnimHandler);
}
} | java | public void loadAnimation(GVRAndroidResource animResource, String boneMap)
{
String filePath = animResource.getResourcePath();
GVRContext ctx = mAvatarRoot.getGVRContext();
GVRResourceVolume volume = new GVRResourceVolume(ctx, animResource);
if (filePath.endsWith(".bvh"))
{
GVRAnimator animator = new GVRAnimator(ctx);
animator.setName(filePath);
try
{
BVHImporter importer = new BVHImporter(ctx);
GVRSkeletonAnimation skelAnim;
if (boneMap != null)
{
GVRSkeleton skel = importer.importSkeleton(animResource);
skelAnim = importer.readMotion(skel);
animator.addAnimation(skelAnim);
GVRPoseMapper retargeter = new GVRPoseMapper(mSkeleton, skel, skelAnim.getDuration());
retargeter.setBoneMap(boneMap);
animator.addAnimation(retargeter);
}
else
{
skelAnim = importer.importAnimation(animResource, mSkeleton);
animator.addAnimation(skelAnim);
}
addAnimation(animator);
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
animator,
filePath,
null);
}
catch (IOException ex)
{
ctx.getEventManager().sendEvent(this,
IAvatarEvents.class,
"onAnimationLoaded",
GVRAvatar.this,
null,
filePath,
ex.getMessage());
}
}
else
{
EnumSet<GVRImportSettings> settings = GVRImportSettings.getRecommendedSettingsWith(EnumSet.of(GVRImportSettings.OPTIMIZE_GRAPH, GVRImportSettings.NO_TEXTURING));
GVRSceneObject animRoot = new GVRSceneObject(ctx);
ctx.getAssetLoader().loadModel(volume, animRoot, settings, false, mLoadAnimHandler);
}
} | [
"public",
"void",
"loadAnimation",
"(",
"GVRAndroidResource",
"animResource",
",",
"String",
"boneMap",
")",
"{",
"String",
"filePath",
"=",
"animResource",
".",
"getResourcePath",
"(",
")",
";",
"GVRContext",
"ctx",
"=",
"mAvatarRoot",
".",
"getGVRContext",
"(",
... | Load an animation for the current avatar.
@param animResource resource with the animation
@param boneMap optional bone map to map animation skeleton to avatar | [
"Load",
"an",
"animation",
"for",
"the",
"current",
"avatar",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L251-L308 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.start | public void start(String name)
{
GVRAnimator anim = findAnimation(name);
if (name.equals(anim.getName()))
{
start(anim);
return;
}
} | java | public void start(String name)
{
GVRAnimator anim = findAnimation(name);
if (name.equals(anim.getName()))
{
start(anim);
return;
}
} | [
"public",
"void",
"start",
"(",
"String",
"name",
")",
"{",
"GVRAnimator",
"anim",
"=",
"findAnimation",
"(",
"name",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"anim",
".",
"getName",
"(",
")",
")",
")",
"{",
"start",
"(",
"anim",
")",
";",
... | Starts the named animation.
@see GVRAvatar#stop(String)
@see GVRAnimationEngine#start(GVRAnimation) | [
"Starts",
"the",
"named",
"animation",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L363-L372 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.findAnimation | public GVRAnimator findAnimation(String name)
{
for (GVRAnimator anim : mAnimations)
{
if (name.equals(anim.getName()))
{
return anim;
}
}
return null;
} | java | public GVRAnimator findAnimation(String name)
{
for (GVRAnimator anim : mAnimations)
{
if (name.equals(anim.getName()))
{
return anim;
}
}
return null;
} | [
"public",
"GVRAnimator",
"findAnimation",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"GVRAnimator",
"anim",
":",
"mAnimations",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"anim",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"anim",
";",
... | Find the animation associated with this avatar with the given name.
@param name name of animation to look for
@return {@link GVRAnimator} animation found or null if none with that name | [
"Find",
"the",
"animation",
"associated",
"with",
"this",
"avatar",
"with",
"the",
"given",
"name",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L379-L389 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.start | public GVRAnimator start(int animIndex)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
start(anim);
return anim;
} | java | public GVRAnimator start(int animIndex)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
start(anim);
return anim;
} | [
"public",
"GVRAnimator",
"start",
"(",
"int",
"animIndex",
")",
"{",
"if",
"(",
"(",
"animIndex",
"<",
"0",
")",
"||",
"(",
"animIndex",
">=",
"mAnimations",
".",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Anima... | Starts the animation with the given index.
@param animIndex 0-based index of {@link GVRAnimator} to start;
@see GVRAvatar#stop()
@see #start(String) | [
"Starts",
"the",
"animation",
"with",
"the",
"given",
"index",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L397-L406 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.animate | public GVRAnimator animate(int animIndex, float timeInSec)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
anim.animate(timeInSec);
return anim;
} | java | public GVRAnimator animate(int animIndex, float timeInSec)
{
if ((animIndex < 0) || (animIndex >= mAnimations.size()))
{
throw new IndexOutOfBoundsException("Animation index out of bounds");
}
GVRAnimator anim = mAnimations.get(animIndex);
anim.animate(timeInSec);
return anim;
} | [
"public",
"GVRAnimator",
"animate",
"(",
"int",
"animIndex",
",",
"float",
"timeInSec",
")",
"{",
"if",
"(",
"(",
"animIndex",
"<",
"0",
")",
"||",
"(",
"animIndex",
">=",
"mAnimations",
".",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOf... | Evaluates the animation with the given index at the specified time.
@param animIndex 0-based index of {@link GVRAnimator} to start
@param timeInSec time to evaluate the animation at
@see GVRAvatar#stop()
@see #start(String) | [
"Evaluates",
"the",
"animation",
"with",
"the",
"given",
"index",
"at",
"the",
"specified",
"time",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L449-L458 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java | GVRAvatar.stop | public void stop()
{
synchronized (mAnimQueue)
{
if (mIsRunning && (mAnimQueue.size() > 0))
{
mIsRunning = false;
GVRAnimator animator = mAnimQueue.get(0);
mAnimQueue.clear();
animator.stop();
}
}
} | java | public void stop()
{
synchronized (mAnimQueue)
{
if (mIsRunning && (mAnimQueue.size() > 0))
{
mIsRunning = false;
GVRAnimator animator = mAnimQueue.get(0);
mAnimQueue.clear();
animator.stop();
}
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"synchronized",
"(",
"mAnimQueue",
")",
"{",
"if",
"(",
"mIsRunning",
"&&",
"(",
"mAnimQueue",
".",
"size",
"(",
")",
">",
"0",
")",
")",
"{",
"mIsRunning",
"=",
"false",
";",
"GVRAnimator",
"animator",
"=",
"... | Stops the currently running animation, if any.
@see GVRAvatar#start(String)
@see GVRAnimationEngine#stop(GVRAnimation) | [
"Stops",
"the",
"currently",
"running",
"animation",
"if",
"any",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAvatar.java#L481-L493 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMain.java | GVRMain.getSplashTexture | public GVRTexture getSplashTexture(GVRContext gvrContext) {
Bitmap bitmap = BitmapFactory.decodeResource( //
gvrContext.getContext().getResources(), //
R.drawable.__default_splash_screen__);
GVRTexture tex = new GVRTexture(gvrContext);
tex.setImage(new GVRBitmapImage(gvrContext, bitmap));
return tex;
} | java | public GVRTexture getSplashTexture(GVRContext gvrContext) {
Bitmap bitmap = BitmapFactory.decodeResource( //
gvrContext.getContext().getResources(), //
R.drawable.__default_splash_screen__);
GVRTexture tex = new GVRTexture(gvrContext);
tex.setImage(new GVRBitmapImage(gvrContext, bitmap));
return tex;
} | [
"public",
"GVRTexture",
"getSplashTexture",
"(",
"GVRContext",
"gvrContext",
")",
"{",
"Bitmap",
"bitmap",
"=",
"BitmapFactory",
".",
"decodeResource",
"(",
"//",
"gvrContext",
".",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
",",
"//",
"R",
".",
... | Override this method to supply a custom splash screen image.
@param gvrContext
The new {@link GVRContext}
@return Texture to display
@since 1.6.4 | [
"Override",
"this",
"method",
"to",
"supply",
"a",
"custom",
"splash",
"screen",
"image",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMain.java#L280-L287 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMain.java | GVRMain.onSplashScreenCreated | public void onSplashScreenCreated(GVRSceneObject splashScreen) {
GVRTransform transform = splashScreen.getTransform();
transform.setPosition(0, 0, DEFAULT_SPLASH_Z);
} | java | public void onSplashScreenCreated(GVRSceneObject splashScreen) {
GVRTransform transform = splashScreen.getTransform();
transform.setPosition(0, 0, DEFAULT_SPLASH_Z);
} | [
"public",
"void",
"onSplashScreenCreated",
"(",
"GVRSceneObject",
"splashScreen",
")",
"{",
"GVRTransform",
"transform",
"=",
"splashScreen",
".",
"getTransform",
"(",
")",
";",
"transform",
".",
"setPosition",
"(",
"0",
",",
"0",
",",
"DEFAULT_SPLASH_Z",
")",
"... | Override this method to change the default splash screen size or
position.
This method will be called <em>before</em> {@link #onInit(GVRContext)
onInit()} and before the normal render pipeline starts up. In particular,
this means that any {@linkplain GVRAnimation animations} will not start
until the first {@link #onStep()} and normal rendering starts.
@param splashScreen
The splash object created from
{@link #getSplashTexture(GVRContext)},
{@link #getSplashMesh(GVRContext)}, and
{@link #getSplashShader(GVRContext)}.
@since 1.6.4 | [
"Override",
"this",
"method",
"to",
"change",
"the",
"default",
"splash",
"screen",
"size",
"or",
"position",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMain.java#L339-L342 | train |
Samsung/GearVRf | GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java | Cursor.setPosition | public void setPosition(float x, float y, float z) {
if (isActive()) {
mIODevice.setPosition(x, y, z);
}
} | java | public void setPosition(float x, float y, float z) {
if (isActive()) {
mIODevice.setPosition(x, y, z);
}
} | [
"public",
"void",
"setPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"mIODevice",
".",
"setPosition",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"}",
"}"
] | Set a new Cursor position if active and enabled.
@param x x value of the position
@param y y value of the position
@param z z value of the position | [
"Set",
"a",
"new",
"Cursor",
"position",
"if",
"active",
"and",
"enabled",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java#L201-L205 | train |
Samsung/GearVRf | GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java | Cursor.close | void close() {
mIODevice = null;
GVRSceneObject owner = getOwnerObject();
if (owner.getParent() != null) {
owner.getParent().removeChildObject(owner);
}
} | java | void close() {
mIODevice = null;
GVRSceneObject owner = getOwnerObject();
if (owner.getParent() != null) {
owner.getParent().removeChildObject(owner);
}
} | [
"void",
"close",
"(",
")",
"{",
"mIODevice",
"=",
"null",
";",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"owner",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"owner",
".",
"getParent",
"(",
")",
".",
"removeC... | Perform all Cursor cleanup here. | [
"Perform",
"all",
"Cursor",
"cleanup",
"here",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java#L360-L366 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java | GVRAssetLoader.findMesh | public GVRMesh findMesh(GVRSceneObject model)
{
class MeshFinder implements GVRSceneObject.ComponentVisitor
{
private GVRMesh meshFound = null;
public GVRMesh getMesh() { return meshFound; }
public boolean visit(GVRComponent comp)
{
GVRRenderData rdata = (GVRRenderData) comp;
meshFound = rdata.getMesh();
return (meshFound == null);
}
};
MeshFinder findMesh = new MeshFinder();
model.forAllComponents(findMesh, GVRRenderData.getComponentType());
return findMesh.getMesh();
} | java | public GVRMesh findMesh(GVRSceneObject model)
{
class MeshFinder implements GVRSceneObject.ComponentVisitor
{
private GVRMesh meshFound = null;
public GVRMesh getMesh() { return meshFound; }
public boolean visit(GVRComponent comp)
{
GVRRenderData rdata = (GVRRenderData) comp;
meshFound = rdata.getMesh();
return (meshFound == null);
}
};
MeshFinder findMesh = new MeshFinder();
model.forAllComponents(findMesh, GVRRenderData.getComponentType());
return findMesh.getMesh();
} | [
"public",
"GVRMesh",
"findMesh",
"(",
"GVRSceneObject",
"model",
")",
"{",
"class",
"MeshFinder",
"implements",
"GVRSceneObject",
".",
"ComponentVisitor",
"{",
"private",
"GVRMesh",
"meshFound",
"=",
"null",
";",
"public",
"GVRMesh",
"getMesh",
"(",
")",
"{",
"r... | Finds the first mesh in the given model.
@param model root of a model loaded by the asset loader.
@return GVRMesh found or null if model does not contain meshes
@see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) | [
"Finds",
"the",
"first",
"mesh",
"in",
"the",
"given",
"model",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1699-L1715 | train |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptFile.java | GVRScriptFile.invokeFunction | @Override
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | java | @Override
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"invokeFunction",
"(",
"String",
"funcName",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"// Run script if it is dirty. This makes sure the script is run",
"// on the same thread as the caller (suppose the caller is always",
"// calling from t... | Invokes a function defined in the script.
@param funcName
The function name.
@param params
The parameter array.
@return
A boolean value representing whether the function is
executed correctly. If the function cannot be found, or
parameters don't match, {@code false} is returned. | [
"Invokes",
"a",
"function",
"defined",
"in",
"the",
"script",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptFile.java#L172-L208 | train |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java | GearWearableDevice.isInInnerCircle | private boolean isInInnerCircle(float x, float y) {
return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, INNER_RADIUS);
} | java | private boolean isInInnerCircle(float x, float y) {
return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, INNER_RADIUS);
} | [
"private",
"boolean",
"isInInnerCircle",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"return",
"GearWearableUtility",
".",
"isInCircle",
"(",
"x",
",",
"y",
",",
"CENTER_X",
",",
"CENTER_Y",
",",
"INNER_RADIUS",
")",
";",
"}"
] | Check if position is in inner circle
@param x x position
@param y y position
@return true if in inner circle, false otherwise | [
"Check",
"if",
"position",
"is",
"in",
"inner",
"circle"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java#L639-L641 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiCamera.java | AiCamera.getUp | @SuppressWarnings("unchecked")
public <V3, M4, C, N, Q> V3 getUp(AiWrapperProvider<V3, M4, C, N, Q>
wrapperProvider) {
return (V3) m_up;
} | java | @SuppressWarnings("unchecked")
public <V3, M4, C, N, Q> V3 getUp(AiWrapperProvider<V3, M4, C, N, Q>
wrapperProvider) {
return (V3) m_up;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"V3",
",",
"M4",
",",
"C",
",",
"N",
",",
"Q",
">",
"V3",
"getUp",
"(",
"AiWrapperProvider",
"<",
"V3",
",",
"M4",
",",
"C",
",",
"N",
",",
"Q",
">",
"wrapperProvider",
")",
"{",
... | Returns the 'Up' - vector of the camera coordinate system.
The returned vector is relative to the coordinate space defined by the
corresponding node.<p>
The 'right' vector of the camera coordinate system is the cross product
of the up and lookAt vectors. The default value is 0|1|0. The vector
may be normalized, but it needn't.<p>
This method is part of the wrapped API (see {@link AiWrapperProvider}
for details on wrappers).<p>
The built-in behavior is to return a {@link AiVector}.
@param wrapperProvider the wrapper provider (used for type inference)
@return the 'Up' vector | [
"Returns",
"the",
"Up",
"-",
"vector",
"of",
"the",
"camera",
"coordinate",
"system",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiCamera.java#L167-L172 | train |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java | TemplateDevice.dispatchKeyEvent | public void dispatchKeyEvent(int code, int action) {
int keyCode = 0;
int keyAction = 0;
if (code == BUTTON_1) {
keyCode = KeyEvent.KEYCODE_BUTTON_1;
} else if (code == BUTTON_2) {
keyCode = KeyEvent.KEYCODE_BUTTON_2;
}
if (action == ACTION_DOWN) {
keyAction = KeyEvent.ACTION_DOWN;
} else if (action == ACTION_UP) {
keyAction = KeyEvent.ACTION_UP;
}
KeyEvent keyEvent = new KeyEvent(keyAction, keyCode);
setKeyEvent(keyEvent);
} | java | public void dispatchKeyEvent(int code, int action) {
int keyCode = 0;
int keyAction = 0;
if (code == BUTTON_1) {
keyCode = KeyEvent.KEYCODE_BUTTON_1;
} else if (code == BUTTON_2) {
keyCode = KeyEvent.KEYCODE_BUTTON_2;
}
if (action == ACTION_DOWN) {
keyAction = KeyEvent.ACTION_DOWN;
} else if (action == ACTION_UP) {
keyAction = KeyEvent.ACTION_UP;
}
KeyEvent keyEvent = new KeyEvent(keyAction, keyCode);
setKeyEvent(keyEvent);
} | [
"public",
"void",
"dispatchKeyEvent",
"(",
"int",
"code",
",",
"int",
"action",
")",
"{",
"int",
"keyCode",
"=",
"0",
";",
"int",
"keyAction",
"=",
"0",
";",
"if",
"(",
"code",
"==",
"BUTTON_1",
")",
"{",
"keyCode",
"=",
"KeyEvent",
".",
"KEYCODE_BUTTO... | Synthesize and forward a KeyEvent to the library.
This call is made from the native layer.
@param code id of the button
@param action integer representing the action taken on the button | [
"Synthesize",
"and",
"forward",
"a",
"KeyEvent",
"to",
"the",
"library",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java#L147-L164 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetState.java | WidgetState.setState | void setState(final WidgetState.State state) {
Log.d(TAG, "setState(%s): state is %s, setting to %s", mWidget.getName(), mState, state);
if (state != mState) {
final WidgetState.State nextState = getNextState(state);
Log.d(TAG, "setState(%s): next state '%s'", mWidget.getName(), nextState);
if (nextState != mState) {
Log.d(TAG, "setState(%s): setting state to '%s'", mWidget.getName(), nextState);
setCurrentState(false);
mState = nextState;
setCurrentState(true);
}
}
} | java | void setState(final WidgetState.State state) {
Log.d(TAG, "setState(%s): state is %s, setting to %s", mWidget.getName(), mState, state);
if (state != mState) {
final WidgetState.State nextState = getNextState(state);
Log.d(TAG, "setState(%s): next state '%s'", mWidget.getName(), nextState);
if (nextState != mState) {
Log.d(TAG, "setState(%s): setting state to '%s'", mWidget.getName(), nextState);
setCurrentState(false);
mState = nextState;
setCurrentState(true);
}
}
} | [
"void",
"setState",
"(",
"final",
"WidgetState",
".",
"State",
"state",
")",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"setState(%s): state is %s, setting to %s\"",
",",
"mWidget",
".",
"getName",
"(",
")",
",",
"mState",
",",
"state",
")",
";",
"if",
"(",
... | Sets current state
@param state new state | [
"Sets",
"current",
"state"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetState.java#L85-L97 | train |
Samsung/GearVRf | GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java | GVRAudioManager.setEnable | public void setEnable(boolean flag)
{
if (mEnabled == flag)
{
return;
}
mEnabled = flag;
if (flag)
{
mContext.registerDrawFrameListener(this);
mContext.getApplication().getEventReceiver().addListener(this);
mAudioEngine.resume();
}
else
{
mContext.unregisterDrawFrameListener(this);
mContext.getApplication().getEventReceiver().removeListener(this);
mAudioEngine.pause();
}
} | java | public void setEnable(boolean flag)
{
if (mEnabled == flag)
{
return;
}
mEnabled = flag;
if (flag)
{
mContext.registerDrawFrameListener(this);
mContext.getApplication().getEventReceiver().addListener(this);
mAudioEngine.resume();
}
else
{
mContext.unregisterDrawFrameListener(this);
mContext.getApplication().getEventReceiver().removeListener(this);
mAudioEngine.pause();
}
} | [
"public",
"void",
"setEnable",
"(",
"boolean",
"flag",
")",
"{",
"if",
"(",
"mEnabled",
"==",
"flag",
")",
"{",
"return",
";",
"}",
"mEnabled",
"=",
"flag",
";",
"if",
"(",
"flag",
")",
"{",
"mContext",
".",
"registerDrawFrameListener",
"(",
"this",
")... | Enables or disables sound.
When sound is disabled, nothing is played but the
audio sources remain intact.
@param flag true to enable sound, false to disable. | [
"Enables",
"or",
"disables",
"sound",
".",
"When",
"sound",
"is",
"disabled",
"nothing",
"is",
"played",
"but",
"the",
"audio",
"sources",
"remain",
"intact",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java#L71-L90 | train |
Samsung/GearVRf | GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java | GVRAudioManager.addSource | public void addSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
if (!mAudioSources.contains(audioSource))
{
audioSource.setListener(this);
mAudioSources.add(audioSource);
}
}
} | java | public void addSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
if (!mAudioSources.contains(audioSource))
{
audioSource.setListener(this);
mAudioSources.add(audioSource);
}
}
} | [
"public",
"void",
"addSource",
"(",
"GVRAudioSource",
"audioSource",
")",
"{",
"synchronized",
"(",
"mAudioSources",
")",
"{",
"if",
"(",
"!",
"mAudioSources",
".",
"contains",
"(",
"audioSource",
")",
")",
"{",
"audioSource",
".",
"setListener",
"(",
"this",
... | Adds an audio source to the audio manager.
An audio source cannot be played unless it is
added to the audio manager. A source cannot be
added twice.
@param audioSource audio source to add | [
"Adds",
"an",
"audio",
"source",
"to",
"the",
"audio",
"manager",
".",
"An",
"audio",
"source",
"cannot",
"be",
"played",
"unless",
"it",
"is",
"added",
"to",
"the",
"audio",
"manager",
".",
"A",
"source",
"cannot",
"be",
"added",
"twice",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java#L108-L118 | train |
Samsung/GearVRf | GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java | GVRAudioManager.removeSource | public void removeSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
audioSource.setListener(null);
mAudioSources.remove(audioSource);
}
} | java | public void removeSource(GVRAudioSource audioSource)
{
synchronized (mAudioSources)
{
audioSource.setListener(null);
mAudioSources.remove(audioSource);
}
} | [
"public",
"void",
"removeSource",
"(",
"GVRAudioSource",
"audioSource",
")",
"{",
"synchronized",
"(",
"mAudioSources",
")",
"{",
"audioSource",
".",
"setListener",
"(",
"null",
")",
";",
"mAudioSources",
".",
"remove",
"(",
"audioSource",
")",
";",
"}",
"}"
] | Removes an audio source from the audio manager.
@param audioSource audio source to remove | [
"Removes",
"an",
"audio",
"source",
"from",
"the",
"audio",
"manager",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java#L124-L131 | train |
Samsung/GearVRf | GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java | GVRAudioManager.clearSources | public void clearSources()
{
synchronized (mAudioSources)
{
for (GVRAudioSource source : mAudioSources)
{
source.setListener(null);
}
mAudioSources.clear();
}
} | java | public void clearSources()
{
synchronized (mAudioSources)
{
for (GVRAudioSource source : mAudioSources)
{
source.setListener(null);
}
mAudioSources.clear();
}
} | [
"public",
"void",
"clearSources",
"(",
")",
"{",
"synchronized",
"(",
"mAudioSources",
")",
"{",
"for",
"(",
"GVRAudioSource",
"source",
":",
"mAudioSources",
")",
"{",
"source",
".",
"setListener",
"(",
"null",
")",
";",
"}",
"mAudioSources",
".",
"clear",
... | Remove all of the audio sources from the audio manager.
This will stop all sound from playing. | [
"Remove",
"all",
"of",
"the",
"audio",
"sources",
"from",
"the",
"audio",
"manager",
".",
"This",
"will",
"stop",
"all",
"sound",
"from",
"playing",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/ResonanceAudio/resonanceaudio/src/main/java/org/gearvrf/resonanceaudio/GVRAudioManager.java#L153-L163 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java | GVRSphericalEmitter.generateParticleTimeStamps | private float[] generateParticleTimeStamps(float totalTime)
{
float timeStamps[] = new float[mEmitRate * 2];
if ( burstMode ) {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime;
timeStamps[i + 1] = 0;
}
}
else {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime + mRandom.nextFloat();
timeStamps[i + 1] = 0;
}
}
return timeStamps;
} | java | private float[] generateParticleTimeStamps(float totalTime)
{
float timeStamps[] = new float[mEmitRate * 2];
if ( burstMode ) {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime;
timeStamps[i + 1] = 0;
}
}
else {
for (int i = 0; i < mEmitRate * 2; i += 2) {
timeStamps[i] = totalTime + mRandom.nextFloat();
timeStamps[i + 1] = 0;
}
}
return timeStamps;
} | [
"private",
"float",
"[",
"]",
"generateParticleTimeStamps",
"(",
"float",
"totalTime",
")",
"{",
"float",
"timeStamps",
"[",
"]",
"=",
"new",
"float",
"[",
"mEmitRate",
"*",
"2",
"]",
";",
"if",
"(",
"burstMode",
")",
"{",
"for",
"(",
"int",
"i",
"=",
... | 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.
@param totalTime
@return | [
"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",
... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L86-L104 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java | GVRSphericalEmitter.generateParticleVelocities | private float[] generateParticleVelocities()
{
float [] particleVelocities = new float[mEmitRate * 3];
Vector3f temp = new Vector3f(0,0,0);
for ( int i = 0; i < mEmitRate * 3 ; i +=3 )
{
temp.x = mParticlePositions[i];
temp.y = mParticlePositions[i+1];
temp.z = mParticlePositions[i+2];
float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x)
+ minVelocity.x;
float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y)
+ minVelocity.y;
float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z)
+ minVelocity.z;
temp = temp.normalize();
temp.mul(velx, vely, velz, temp);
particleVelocities[i] = temp.x;
particleVelocities[i+1] = temp.y;
particleVelocities[i+2] = temp.z;
}
return particleVelocities;
} | java | private float[] generateParticleVelocities()
{
float [] particleVelocities = new float[mEmitRate * 3];
Vector3f temp = new Vector3f(0,0,0);
for ( int i = 0; i < mEmitRate * 3 ; i +=3 )
{
temp.x = mParticlePositions[i];
temp.y = mParticlePositions[i+1];
temp.z = mParticlePositions[i+2];
float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x)
+ minVelocity.x;
float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y)
+ minVelocity.y;
float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z)
+ minVelocity.z;
temp = temp.normalize();
temp.mul(velx, vely, velz, temp);
particleVelocities[i] = temp.x;
particleVelocities[i+1] = temp.y;
particleVelocities[i+2] = temp.z;
}
return particleVelocities;
} | [
"private",
"float",
"[",
"]",
"generateParticleVelocities",
"(",
")",
"{",
"float",
"[",
"]",
"particleVelocities",
"=",
"new",
"float",
"[",
"mEmitRate",
"*",
"3",
"]",
";",
"Vector3f",
"temp",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"0",
",",
"0",
")"... | Generate random velocities for every particle. The direction is obtained by assuming
the position of a particle as a vector. This normalised vector is scaled by
the speed range.
@return | [
"Generate",
"random",
"velocities",
"for",
"every",
"particle",
".",
"The",
"direction",
"is",
"obtained",
"by",
"assuming",
"the",
"position",
"of",
"a",
"particle",
"as",
"a",
"vector",
".",
"This",
"normalised",
"vector",
"is",
"scaled",
"by",
"the",
"spe... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L113-L142 | train |
Samsung/GearVRf | GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/CameraPermissionHelper.java | CameraPermissionHelper.launchPermissionSettings | public static void launchPermissionSettings(Activity activity) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
activity.startActivity(intent);
} | java | public static void launchPermissionSettings(Activity activity) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
activity.startActivity(intent);
} | [
"public",
"static",
"void",
"launchPermissionSettings",
"(",
"Activity",
"activity",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setAction",
"(",
"Settings",
".",
"ACTION_APPLICATION_DETAILS_SETTINGS",
")",
";",
"intent",
"... | Launch Application Setting to grant permission. | [
"Launch",
"Application",
"Setting",
"to",
"grant",
"permission",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/CameraPermissionHelper.java#L36-L41 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/basic/TextParams.java | TextParams.setFromJSON | public void setFromJSON(Context context, JSONObject properties) {
String backgroundResStr = optString(properties, Properties.background);
if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
final int backgroundResId = getId(context, backgroundResStr, "drawable");
setBackGround(context.getResources().getDrawable(backgroundResId, null));
}
setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
setText(optString(properties, Properties.text, (String) getText()));
setTextSize(optFloat(properties, Properties.text_size, getTextSize()));
final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);
if (typefaceJson != null) {
try {
Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
setTypeface(typeface);
} catch (Throwable e) {
Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
}
}
} | java | public void setFromJSON(Context context, JSONObject properties) {
String backgroundResStr = optString(properties, Properties.background);
if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
final int backgroundResId = getId(context, backgroundResStr, "drawable");
setBackGround(context.getResources().getDrawable(backgroundResId, null));
}
setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
setText(optString(properties, Properties.text, (String) getText()));
setTextSize(optFloat(properties, Properties.text_size, getTextSize()));
final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);
if (typefaceJson != null) {
try {
Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
setTypeface(typeface);
} catch (Throwable e) {
Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
}
}
} | [
"public",
"void",
"setFromJSON",
"(",
"Context",
"context",
",",
"JSONObject",
"properties",
")",
"{",
"String",
"backgroundResStr",
"=",
"optString",
"(",
"properties",
",",
"Properties",
".",
"background",
")",
";",
"if",
"(",
"backgroundResStr",
"!=",
"null",... | Set text parameters from properties
@param context Valid Android {@link Context}
@param properties JSON text properties | [
"Set",
"text",
"parameters",
"from",
"properties"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/basic/TextParams.java#L57-L81 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.onLayoutApplied | public void onLayoutApplied(final WidgetContainer container, final Vector3Axis viewPortSize) {
mContainer = container;
mViewPort.setSize(viewPortSize);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
} | java | public void onLayoutApplied(final WidgetContainer container, final Vector3Axis viewPortSize) {
mContainer = container;
mViewPort.setSize(viewPortSize);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
} | [
"public",
"void",
"onLayoutApplied",
"(",
"final",
"WidgetContainer",
"container",
",",
"final",
"Vector3Axis",
"viewPortSize",
")",
"{",
"mContainer",
"=",
"container",
";",
"mViewPort",
".",
"setSize",
"(",
"viewPortSize",
")",
";",
"if",
"(",
"mContainer",
"!... | Called when the layout is applied to the data
@param container WidgetContainer to access the org.gearvrf.org.gearvrf.widgetlib in the layout
@param viewPortSize View port for data set | [
"Called",
"when",
"the",
"layout",
"is",
"applied",
"to",
"the",
"data"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L109-L115 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.invalidate | public void invalidate() {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate all [%d]", mMeasuredChildren.size());
mMeasuredChildren.clear();
}
} | java | public void invalidate() {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate all [%d]", mMeasuredChildren.size());
mMeasuredChildren.clear();
}
} | [
"public",
"void",
"invalidate",
"(",
")",
"{",
"synchronized",
"(",
"mMeasuredChildren",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"invalidate all [%d]\"",
",",
"mMeasuredChildren",
".",
"size",
"(",
")",
")... | Invalidate layout setup. | [
"Invalidate",
"layout",
"setup",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L120-L125 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.invalidate | public void invalidate(final int dataIndex) {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate [%d]", dataIndex);
mMeasuredChildren.remove(dataIndex);
}
} | java | public void invalidate(final int dataIndex) {
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "invalidate [%d]", dataIndex);
mMeasuredChildren.remove(dataIndex);
}
} | [
"public",
"void",
"invalidate",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"synchronized",
"(",
"mMeasuredChildren",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"invalidate [%d]\"",
",",
"dataIndex",
")",
";"... | Invalidate the item in layout
@param dataIndex data index | [
"Invalidate",
"the",
"item",
"in",
"layout"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L131-L136 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.getChildSize | public float getChildSize(final int dataIndex, final Axis axis) {
float size = 0;
Widget child = mContainer.get(dataIndex);
if (child != null) {
switch (axis) {
case X:
size = child.getLayoutWidth();
break;
case Y:
size = child.getLayoutHeight();
break;
case Z:
size = child.getLayoutDepth();
break;
default:
throw new RuntimeAssertion("Bad axis specified: %s", axis);
}
}
return size;
} | java | public float getChildSize(final int dataIndex, final Axis axis) {
float size = 0;
Widget child = mContainer.get(dataIndex);
if (child != null) {
switch (axis) {
case X:
size = child.getLayoutWidth();
break;
case Y:
size = child.getLayoutHeight();
break;
case Z:
size = child.getLayoutDepth();
break;
default:
throw new RuntimeAssertion("Bad axis specified: %s", axis);
}
}
return size;
} | [
"public",
"float",
"getChildSize",
"(",
"final",
"int",
"dataIndex",
",",
"final",
"Axis",
"axis",
")",
"{",
"float",
"size",
"=",
"0",
";",
"Widget",
"child",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"child",
"!=",
"null",... | Calculate the child size along the axis
@param dataIndex data index
@param axis {@link Axis}
@return child size | [
"Calculate",
"the",
"child",
"size",
"along",
"the",
"axis"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L161-L180 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.getSize | public float getSize(final Axis axis) {
float size = 0;
if (mViewPort != null && mViewPort.isClippingEnabled(axis)) {
size = mViewPort.get(axis);
} else if (mContainer != null) {
size = getSizeImpl(axis);
}
return size;
} | java | public float getSize(final Axis axis) {
float size = 0;
if (mViewPort != null && mViewPort.isClippingEnabled(axis)) {
size = mViewPort.get(axis);
} else if (mContainer != null) {
size = getSizeImpl(axis);
}
return size;
} | [
"public",
"float",
"getSize",
"(",
"final",
"Axis",
"axis",
")",
"{",
"float",
"size",
"=",
"0",
";",
"if",
"(",
"mViewPort",
"!=",
"null",
"&&",
"mViewPort",
".",
"isClippingEnabled",
"(",
"axis",
")",
")",
"{",
"size",
"=",
"mViewPort",
".",
"get",
... | Calculate the layout container size along the axis
@param axis {@link Axis}
@return size | [
"Calculate",
"the",
"layout",
"container",
"size",
"along",
"the",
"axis"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L187-L195 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.setDividerPadding | public void setDividerPadding(float padding, final Axis axis) {
if (!equal(mDividerPadding.get(axis), padding)) {
mDividerPadding.set(padding, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | java | public void setDividerPadding(float padding, final Axis axis) {
if (!equal(mDividerPadding.get(axis), padding)) {
mDividerPadding.set(padding, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | [
"public",
"void",
"setDividerPadding",
"(",
"float",
"padding",
",",
"final",
"Axis",
"axis",
")",
"{",
"if",
"(",
"!",
"equal",
"(",
"mDividerPadding",
".",
"get",
"(",
"axis",
")",
",",
"padding",
")",
")",
"{",
"mDividerPadding",
".",
"set",
"(",
"p... | Set the amount of padding between child objects.
@param axis {@link Axis}
@param padding | [
"Set",
"the",
"amount",
"of",
"padding",
"between",
"child",
"objects",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L218-L225 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.setOffset | public void setOffset(float offset, final Axis axis) {
if (!equal(mOffset.get(axis), offset)) {
mOffset.set(offset, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | java | public void setOffset(float offset, final Axis axis) {
if (!equal(mOffset.get(axis), offset)) {
mOffset.set(offset, axis);
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
} | [
"public",
"void",
"setOffset",
"(",
"float",
"offset",
",",
"final",
"Axis",
"axis",
")",
"{",
"if",
"(",
"!",
"equal",
"(",
"mOffset",
".",
"get",
"(",
"axis",
")",
",",
"offset",
")",
")",
"{",
"mOffset",
".",
"set",
"(",
"offset",
",",
"axis",
... | Set the amount of offset between child objects and parent.
@param axis {@link Axis}
@param offset | [
"Set",
"the",
"amount",
"of",
"offset",
"between",
"child",
"objects",
"and",
"parent",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L232-L239 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.measureChild | public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);
Widget widget = mContainer.get(dataIndex);
if (widget != null) {
synchronized (mMeasuredChildren) {
mMeasuredChildren.add(dataIndex);
}
}
return widget;
} | java | public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);
Widget widget = mContainer.get(dataIndex);
if (widget != null) {
synchronized (mMeasuredChildren) {
mMeasuredChildren.add(dataIndex);
}
}
return widget;
} | [
"public",
"synchronized",
"Widget",
"measureChild",
"(",
"final",
"int",
"dataIndex",
",",
"boolean",
"calculateOffset",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"measureChild dataIndex = %d\"",
",",
"dataIndex",... | Calculate the child size along the axis and measure the offset inside the
layout container
@param dataIndex of child in Container
@return true item fits the container, false - otherwise | [
"Calculate",
"the",
"child",
"size",
"along",
"the",
"axis",
"and",
"measure",
"the",
"offset",
"inside",
"the",
"layout",
"container"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L247-L257 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.measureAll | public boolean measureAll(List<Widget> measuredChildren) {
boolean changed = false;
for (int i = 0; i < mContainer.size(); ++i) {
if (!isChildMeasured(i)) {
Widget child = measureChild(i, false);
if (child != null) {
if (measuredChildren != null) {
measuredChildren.add(child);
}
changed = true;
}
}
}
if (changed) {
postMeasurement();
}
return changed;
} | java | public boolean measureAll(List<Widget> measuredChildren) {
boolean changed = false;
for (int i = 0; i < mContainer.size(); ++i) {
if (!isChildMeasured(i)) {
Widget child = measureChild(i, false);
if (child != null) {
if (measuredChildren != null) {
measuredChildren.add(child);
}
changed = true;
}
}
}
if (changed) {
postMeasurement();
}
return changed;
} | [
"public",
"boolean",
"measureAll",
"(",
"List",
"<",
"Widget",
">",
"measuredChildren",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mContainer",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{... | Measure all children from container if needed
@param measuredChildren the list of measured children
measuredChildren list can be passed as null if it's not needed to
create the list of the measured items
@return true if the layout was recalculated, otherwise - false | [
"Measure",
"all",
"children",
"from",
"container",
"if",
"needed"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L314-L332 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.layoutChildren | public void layoutChildren() {
Set<Integer> copySet;
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
mMeasuredChildren.size(), this);
copySet = new HashSet<>(mMeasuredChildren);
}
for (int nextMeasured: copySet) {
Widget child = mContainer.get(nextMeasured);
if (child != null) {
child.preventTransformChanged(true);
layoutChild(nextMeasured);
postLayoutChild(nextMeasured);
child.preventTransformChanged(false);
}
}
} | java | public void layoutChildren() {
Set<Integer> copySet;
synchronized (mMeasuredChildren) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "layoutChildren [%d] layout = %s",
mMeasuredChildren.size(), this);
copySet = new HashSet<>(mMeasuredChildren);
}
for (int nextMeasured: copySet) {
Widget child = mContainer.get(nextMeasured);
if (child != null) {
child.preventTransformChanged(true);
layoutChild(nextMeasured);
postLayoutChild(nextMeasured);
child.preventTransformChanged(false);
}
}
} | [
"public",
"void",
"layoutChildren",
"(",
")",
"{",
"Set",
"<",
"Integer",
">",
"copySet",
";",
"synchronized",
"(",
"mMeasuredChildren",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"layoutChildren [%d] layout = ... | Layout children inside the layout container | [
"Layout",
"children",
"inside",
"the",
"layout",
"container"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L422-L440 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.getViewPortSize | protected float getViewPortSize(final Axis axis) {
float size = mViewPort == null ? 0 : mViewPort.get(axis);
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getViewPortSize for %s %f mViewPort = %s", axis, size, mViewPort);
return size;
} | java | protected float getViewPortSize(final Axis axis) {
float size = mViewPort == null ? 0 : mViewPort.get(axis);
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "getViewPortSize for %s %f mViewPort = %s", axis, size, mViewPort);
return size;
} | [
"protected",
"float",
"getViewPortSize",
"(",
"final",
"Axis",
"axis",
")",
"{",
"float",
"size",
"=",
"mViewPort",
"==",
"null",
"?",
"0",
":",
"mViewPort",
".",
"get",
"(",
"axis",
")",
";",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYO... | Get viewport size along the axis
@param axis {@link Axis}
@return size | [
"Get",
"viewport",
"size",
"along",
"the",
"axis"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L740-L744 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.layoutChild | protected void layoutChild(final int dataIndex) {
Widget child = mContainer.get(dataIndex);
if (child != null) {
float offset = mOffset.get(Axis.X);
if (!equal(offset, 0)) {
updateTransform(child, Axis.X, offset);
}
offset = mOffset.get(Axis.Y);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Y, offset);
}
offset = mOffset.get(Axis.Z);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Z, offset);
}
}
} | java | protected void layoutChild(final int dataIndex) {
Widget child = mContainer.get(dataIndex);
if (child != null) {
float offset = mOffset.get(Axis.X);
if (!equal(offset, 0)) {
updateTransform(child, Axis.X, offset);
}
offset = mOffset.get(Axis.Y);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Y, offset);
}
offset = mOffset.get(Axis.Z);
if (!equal(offset, 0)) {
updateTransform(child, Axis.Z, offset);
}
}
} | [
"protected",
"void",
"layoutChild",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"Widget",
"child",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"float",
"offset",
"=",
"mOffset",
".",
"get",
"("... | Position the child inside the layout based on the offset and axis-s factors
@param dataIndex data index | [
"Position",
"the",
"child",
"inside",
"the",
"layout",
"based",
"on",
"the",
"offset",
"and",
"axis",
"-",
"s",
"factors"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L780-L798 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.postLayoutChild | protected void postLayoutChild(final int dataIndex) {
if (!mContainer.isDynamic()) {
boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
ViewPortVisibility visibility = visibleInLayout ?
ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
dataIndex, visibility);
Widget childWidget = mContainer.get(dataIndex);
if (childWidget != null) {
childWidget.setViewPortVisibility(visibility);
}
}
} | java | protected void postLayoutChild(final int dataIndex) {
if (!mContainer.isDynamic()) {
boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);
ViewPortVisibility visibility = visibleInLayout ?
ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "onLayout: child with dataId [%d] viewportVisibility = %s",
dataIndex, visibility);
Widget childWidget = mContainer.get(dataIndex);
if (childWidget != null) {
childWidget.setViewPortVisibility(visibility);
}
}
} | [
"protected",
"void",
"postLayoutChild",
"(",
"final",
"int",
"dataIndex",
")",
"{",
"if",
"(",
"!",
"mContainer",
".",
"isDynamic",
"(",
")",
")",
"{",
"boolean",
"visibleInLayout",
"=",
"!",
"mViewPort",
".",
"isClippingEnabled",
"(",
")",
"||",
"inViewPort... | Do post exam of child inside the layout after it has been positioned in parent
@param dataIndex data index | [
"Do",
"post",
"exam",
"of",
"child",
"inside",
"the",
"layout",
"after",
"it",
"has",
"been",
"positioned",
"in",
"parent"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L804-L817 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCollider.java | GVRCollider.lookup | static GVRCollider lookup(long nativePointer)
{
synchronized (sColliders)
{
WeakReference<GVRCollider> weakReference = sColliders.get(nativePointer);
return weakReference == null ? null : weakReference.get();
}
} | java | static GVRCollider lookup(long nativePointer)
{
synchronized (sColliders)
{
WeakReference<GVRCollider> weakReference = sColliders.get(nativePointer);
return weakReference == null ? null : weakReference.get();
}
} | [
"static",
"GVRCollider",
"lookup",
"(",
"long",
"nativePointer",
")",
"{",
"synchronized",
"(",
"sColliders",
")",
"{",
"WeakReference",
"<",
"GVRCollider",
">",
"weakReference",
"=",
"sColliders",
".",
"get",
"(",
"nativePointer",
")",
";",
"return",
"weakRefer... | Lookup a native pointer to a collider and return its Java object.
@param nativePointer native pointer to C++ Collider
@return Java GVRCollider object | [
"Lookup",
"a",
"native",
"pointer",
"to",
"a",
"collider",
"and",
"return",
"its",
"Java",
"object",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCollider.java#L87-L94 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java | GVRCubeSceneObject.createSimpleCubeSixMeshes | private void createSimpleCubeSixMeshes(GVRContext gvrContext,
boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList)
{
GVRSceneObject[] children = new GVRSceneObject[6];
GVRMesh[] meshes = new GVRMesh[6];
GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3);
if (facingOut)
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES);
}
else
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES);
}
for (int i = 0; i < 6; i++)
{
children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i));
addChildObject(children[i]);
}
// attached an empty renderData for parent object, so that we can set some common properties
GVRRenderData renderData = new GVRRenderData(gvrContext);
attachRenderData(renderData);
} | java | private void createSimpleCubeSixMeshes(GVRContext gvrContext,
boolean facingOut, String vertexDesc, ArrayList<GVRTexture> textureList)
{
GVRSceneObject[] children = new GVRSceneObject[6];
GVRMesh[] meshes = new GVRMesh[6];
GVRVertexBuffer vbuf = new GVRVertexBuffer(gvrContext, vertexDesc, SIMPLE_VERTICES.length / 3);
if (facingOut)
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_OUTWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_OUTWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_OUTWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_OUTWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_OUTWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_OUTWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_OUTWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_OUTWARD_BOTTOM_INDICES);
}
else
{
vbuf.setFloatArray("a_position", SIMPLE_VERTICES, 3, 0);
vbuf.setFloatArray("a_normal", SIMPLE_INWARD_NORMALS, 3, 0);
vbuf.setFloatArray("a_texcoord", SIMPLE_INWARD_TEXCOORDS, 2, 0);
meshes[0] = createMesh(vbuf, SIMPLE_INWARD_FRONT_INDICES);
meshes[1] = createMesh(vbuf, SIMPLE_INWARD_RIGHT_INDICES);
meshes[2] = createMesh(vbuf, SIMPLE_INWARD_BACK_INDICES);
meshes[3] = createMesh(vbuf, SIMPLE_INWARD_LEFT_INDICES);
meshes[4] = createMesh(vbuf, SIMPLE_INWARD_TOP_INDICES);
meshes[5] = createMesh(vbuf, SIMPLE_INWARD_BOTTOM_INDICES);
}
for (int i = 0; i < 6; i++)
{
children[i] = new GVRSceneObject(gvrContext, meshes[i], textureList.get(i));
addChildObject(children[i]);
}
// attached an empty renderData for parent object, so that we can set some common properties
GVRRenderData renderData = new GVRRenderData(gvrContext);
attachRenderData(renderData);
} | [
"private",
"void",
"createSimpleCubeSixMeshes",
"(",
"GVRContext",
"gvrContext",
",",
"boolean",
"facingOut",
",",
"String",
"vertexDesc",
",",
"ArrayList",
"<",
"GVRTexture",
">",
"textureList",
")",
"{",
"GVRSceneObject",
"[",
"]",
"children",
"=",
"new",
"GVRSc... | Creates a cube with each face as a separate mesh using a different texture.
The meshes will share a common vertex array but will have separate index buffers.
@param gvrContext context to use for creating cube
@param facingOut true for outward normals, false for inward normals
@param vertexDesc string describing which vertex components are desired
@param textureList list of 6 textures, one for each face | [
"Creates",
"a",
"cube",
"with",
"each",
"face",
"as",
"a",
"separate",
"mesh",
"using",
"a",
"different",
"texture",
".",
"The",
"meshes",
"will",
"share",
"a",
"common",
"vertex",
"array",
"but",
"will",
"have",
"separate",
"index",
"buffers",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRCubeSceneObject.java#L553-L594 | train |
Samsung/GearVRf | GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCorePlane.java | ARCorePlane.update | protected void update(float scale) {
GVRSceneObject owner = getOwnerObject();
if (isEnabled() && (owner != null) && owner.isEnabled())
{
float w = getWidth();
float h = getHeight();
mPose.update(mARPlane.getCenterPose(), scale);
Matrix4f m = new Matrix4f();
m.set(mPose.getPoseMatrix());
m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);
owner.getTransform().setModelMatrix(m);
}
} | java | protected void update(float scale) {
GVRSceneObject owner = getOwnerObject();
if (isEnabled() && (owner != null) && owner.isEnabled())
{
float w = getWidth();
float h = getHeight();
mPose.update(mARPlane.getCenterPose(), scale);
Matrix4f m = new Matrix4f();
m.set(mPose.getPoseMatrix());
m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);
owner.getTransform().setModelMatrix(m);
}
} | [
"protected",
"void",
"update",
"(",
"float",
"scale",
")",
"{",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"isEnabled",
"(",
")",
"&&",
"(",
"owner",
"!=",
"null",
")",
"&&",
"owner",
".",
"isEnabled",
"(",
")",
")",
... | Update the plane based on arcore best knowledge of the world
@param scale | [
"Update",
"the",
"plane",
"based",
"on",
"arcore",
"best",
"knowledge",
"of",
"the",
"world"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCorePlane.java#L123-L135 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRPositionKey.java | GVRPositionKey.setValue | public void setValue(Vector3f pos) {
mX = pos.x;
mY = pos.y;
mZ = pos.z;
} | java | public void setValue(Vector3f pos) {
mX = pos.x;
mY = pos.y;
mZ = pos.z;
} | [
"public",
"void",
"setValue",
"(",
"Vector3f",
"pos",
")",
"{",
"mX",
"=",
"pos",
".",
"x",
";",
"mY",
"=",
"pos",
".",
"y",
";",
"mZ",
"=",
"pos",
".",
"z",
";",
"}"
] | Sets the position vector of the keyframe. | [
"Sets",
"the",
"position",
"vector",
"of",
"the",
"keyframe",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRPositionKey.java#L42-L46 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java | GVRFloatAnimation.getKey | public void getKey(int keyIndex, float[] values)
{
int index = keyIndex * mFloatsPerKey;
System.arraycopy(mKeys, index + 1, values, 0, values.length);
} | java | public void getKey(int keyIndex, float[] values)
{
int index = keyIndex * mFloatsPerKey;
System.arraycopy(mKeys, index + 1, values, 0, values.length);
} | [
"public",
"void",
"getKey",
"(",
"int",
"keyIndex",
",",
"float",
"[",
"]",
"values",
")",
"{",
"int",
"index",
"=",
"keyIndex",
"*",
"mFloatsPerKey",
";",
"System",
".",
"arraycopy",
"(",
"mKeys",
",",
"index",
"+",
"1",
",",
"values",
",",
"0",
","... | Returns the key value in the given array.
@param keyIndex the index of the scale key | [
"Returns",
"the",
"key",
"value",
"in",
"the",
"given",
"array",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L321-L325 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java | GVRFloatAnimation.setKey | public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
} | java | public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
} | [
"public",
"void",
"setKey",
"(",
"int",
"keyIndex",
",",
"float",
"time",
",",
"final",
"float",
"[",
"]",
"values",
")",
"{",
"int",
"index",
"=",
"keyIndex",
"*",
"mFloatsPerKey",
";",
"Integer",
"valSize",
"=",
"mFloatsPerKey",
"-",
"1",
";",
"if",
... | Set the time and value of the key at the given index
@param keyIndex 0 based index of key
@param time key time in seconds
@param values key values | [
"Set",
"the",
"time",
"and",
"value",
"of",
"the",
"key",
"at",
"the",
"given",
"index"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L333-L344 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java | GVRFloatAnimation.resizeKeys | public void resizeKeys(int numKeys)
{
int n = numKeys * mFloatsPerKey;
if (mKeys.length == n)
{
return;
}
float[] newKeys = new float[n];
n = Math.min(n, mKeys.length);
System.arraycopy(mKeys, 0, newKeys, 0, n);
mKeys = newKeys;
mFloatInterpolator.setKeyData(mKeys);
} | java | public void resizeKeys(int numKeys)
{
int n = numKeys * mFloatsPerKey;
if (mKeys.length == n)
{
return;
}
float[] newKeys = new float[n];
n = Math.min(n, mKeys.length);
System.arraycopy(mKeys, 0, newKeys, 0, n);
mKeys = newKeys;
mFloatInterpolator.setKeyData(mKeys);
} | [
"public",
"void",
"resizeKeys",
"(",
"int",
"numKeys",
")",
"{",
"int",
"n",
"=",
"numKeys",
"*",
"mFloatsPerKey",
";",
"if",
"(",
"mKeys",
".",
"length",
"==",
"n",
")",
"{",
"return",
";",
"}",
"float",
"[",
"]",
"newKeys",
"=",
"new",
"float",
"... | Resize the key data area.
This function will truncate the keys if the
initial setting was too large.
@oaran numKeys the desired number of keys | [
"Resize",
"the",
"key",
"data",
"area",
".",
"This",
"function",
"will",
"truncate",
"the",
"keys",
"if",
"the",
"initial",
"setting",
"was",
"too",
"large",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L365-L378 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRComponent.java | GVRComponent.setEnable | public void setEnable(boolean flag) {
if (flag == mIsEnabled)
return;
mIsEnabled = flag;
if (getNative() != 0)
{
NativeComponent.setEnable(getNative(), flag);
}
if (flag)
{
onEnable();
}
else
{
onDisable();
}
} | java | public void setEnable(boolean flag) {
if (flag == mIsEnabled)
return;
mIsEnabled = flag;
if (getNative() != 0)
{
NativeComponent.setEnable(getNative(), flag);
}
if (flag)
{
onEnable();
}
else
{
onDisable();
}
} | [
"public",
"void",
"setEnable",
"(",
"boolean",
"flag",
")",
"{",
"if",
"(",
"flag",
"==",
"mIsEnabled",
")",
"return",
";",
"mIsEnabled",
"=",
"flag",
";",
"if",
"(",
"getNative",
"(",
")",
"!=",
"0",
")",
"{",
"NativeComponent",
".",
"setEnable",
"(",... | Enable or disable this component.
@param flag true to enable, false to disable.
@see #enable()
@see #disable()
@see #isEnabled() | [
"Enable",
"or",
"disable",
"this",
"component",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRComponent.java#L127-L145 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncManager.java | AsyncManager.registerDatatype | public void registerDatatype(Class<? extends GVRHybridObject> textureClass,
AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {
mFactories.put(textureClass, asyncLoaderFactory);
} | java | public void registerDatatype(Class<? extends GVRHybridObject> textureClass,
AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {
mFactories.put(textureClass, asyncLoaderFactory);
} | [
"public",
"void",
"registerDatatype",
"(",
"Class",
"<",
"?",
"extends",
"GVRHybridObject",
">",
"textureClass",
",",
"AsyncLoaderFactory",
"<",
"?",
"extends",
"GVRHybridObject",
",",
"?",
">",
"asyncLoaderFactory",
")",
"{",
"mFactories",
".",
"put",
"(",
"tex... | Loaders call this method to register themselves. This method can be called by
loaders provided by the application.
@param textureClass
The class the loader is responsible for loading.
@param asyncLoaderFactory
The factory object. | [
"Loaders",
"call",
"this",
"method",
"to",
"register",
"themselves",
".",
"This",
"method",
"can",
"be",
"called",
"by",
"loaders",
"provided",
"by",
"the",
"application",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/AsyncManager.java#L63-L66 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java | GVRContext.assertGLThread | public void assertGLThread() {
if (Thread.currentThread().getId() != mGLThreadID) {
RuntimeException e = new RuntimeException(
"Should not run GL functions from a non-GL thread!");
e.printStackTrace();
throw e;
}
} | java | public void assertGLThread() {
if (Thread.currentThread().getId() != mGLThreadID) {
RuntimeException e = new RuntimeException(
"Should not run GL functions from a non-GL thread!");
e.printStackTrace();
throw e;
}
} | [
"public",
"void",
"assertGLThread",
"(",
")",
"{",
"if",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
"!=",
"mGLThreadID",
")",
"{",
"RuntimeException",
"e",
"=",
"new",
"RuntimeException",
"(",
"\"Should not run GL functions from a non... | Throws an exception if the current thread is not a GL thread.
@since 1.6.5 | [
"Throws",
"an",
"exception",
"if",
"the",
"current",
"thread",
"is",
"not",
"a",
"GL",
"thread",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L281-L288 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java | GVRContext.logError | public void logError(String message, Object sender) {
getEventManager().sendEvent(this, IErrorEvents.class, "onError", new Object[] { message, sender });
} | java | public void logError(String message, Object sender) {
getEventManager().sendEvent(this, IErrorEvents.class, "onError", new Object[] { message, sender });
} | [
"public",
"void",
"logError",
"(",
"String",
"message",
",",
"Object",
"sender",
")",
"{",
"getEventManager",
"(",
")",
".",
"sendEvent",
"(",
"this",
",",
"IErrorEvents",
".",
"class",
",",
"\"onError\"",
",",
"new",
"Object",
"[",
"]",
"{",
"message",
... | Logs an error by sending an error event to all listeners.
Error events can be generated by any part of GearVRF,
from any thread. They are always sent to the event receiver
of the GVRContext.
@param message error message
@param sender object which had the error
@see IErrorEvents | [
"Logs",
"an",
"error",
"by",
"sending",
"an",
"error",
"event",
"to",
"all",
"listeners",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L353-L355 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java | GVRContext.stopDebugServer | public synchronized void stopDebugServer() {
if (mDebugServer == null) {
Log.e(TAG, "Debug server is not running.");
return;
}
mDebugServer.shutdown();
mDebugServer = null;
} | java | public synchronized void stopDebugServer() {
if (mDebugServer == null) {
Log.e(TAG, "Debug server is not running.");
return;
}
mDebugServer.shutdown();
mDebugServer = null;
} | [
"public",
"synchronized",
"void",
"stopDebugServer",
"(",
")",
"{",
"if",
"(",
"mDebugServer",
"==",
"null",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Debug server is not running.\"",
")",
";",
"return",
";",
"}",
"mDebugServer",
".",
"shutdown",
"(",
... | Stops the current debug server. Active connections are
not affected. | [
"Stops",
"the",
"current",
"debug",
"server",
".",
"Active",
"connections",
"are",
"not",
"affected",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L361-L369 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java | GVRContext.showToast | public void showToast(final String message, float duration) {
final float quadWidth = 1.2f;
final GVRTextViewSceneObject toastSceneObject = new GVRTextViewSceneObject(this, quadWidth, quadWidth / 5,
message);
toastSceneObject.setTextSize(6);
toastSceneObject.setTextColor(Color.WHITE);
toastSceneObject.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
toastSceneObject.setBackgroundColor(Color.DKGRAY);
toastSceneObject.setRefreshFrequency(GVRTextViewSceneObject.IntervalFrequency.REALTIME);
final GVRTransform t = toastSceneObject.getTransform();
t.setPositionZ(-1.5f);
final GVRRenderData rd = toastSceneObject.getRenderData();
final float finalOpacity = 0.7f;
rd.getMaterial().setOpacity(0);
rd.setRenderingOrder(2 * GVRRenderData.GVRRenderingOrder.OVERLAY);
rd.setDepthTest(false);
final GVRCameraRig rig = getMainScene().getMainCameraRig();
rig.addChildObject(toastSceneObject);
final GVRMaterialAnimation fadeOut = new GVRMaterialAnimation(rd.getMaterial(), duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(finalOpacity - ratio * finalOpacity);
}
};
fadeOut.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
rig.removeChildObject(toastSceneObject);
}
});
final GVRMaterialAnimation fadeIn = new GVRMaterialAnimation(rd.getMaterial(), 3.0f * duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(ratio * finalOpacity);
}
};
fadeIn.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
getAnimationEngine().start(fadeOut);
}
});
getAnimationEngine().start(fadeIn);
} | java | public void showToast(final String message, float duration) {
final float quadWidth = 1.2f;
final GVRTextViewSceneObject toastSceneObject = new GVRTextViewSceneObject(this, quadWidth, quadWidth / 5,
message);
toastSceneObject.setTextSize(6);
toastSceneObject.setTextColor(Color.WHITE);
toastSceneObject.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP);
toastSceneObject.setBackgroundColor(Color.DKGRAY);
toastSceneObject.setRefreshFrequency(GVRTextViewSceneObject.IntervalFrequency.REALTIME);
final GVRTransform t = toastSceneObject.getTransform();
t.setPositionZ(-1.5f);
final GVRRenderData rd = toastSceneObject.getRenderData();
final float finalOpacity = 0.7f;
rd.getMaterial().setOpacity(0);
rd.setRenderingOrder(2 * GVRRenderData.GVRRenderingOrder.OVERLAY);
rd.setDepthTest(false);
final GVRCameraRig rig = getMainScene().getMainCameraRig();
rig.addChildObject(toastSceneObject);
final GVRMaterialAnimation fadeOut = new GVRMaterialAnimation(rd.getMaterial(), duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(finalOpacity - ratio * finalOpacity);
}
};
fadeOut.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
rig.removeChildObject(toastSceneObject);
}
});
final GVRMaterialAnimation fadeIn = new GVRMaterialAnimation(rd.getMaterial(), 3.0f * duration / 4.0f) {
@Override
protected void animate(GVRHybridObject target, float ratio) {
final GVRMaterial material = (GVRMaterial) target;
material.setOpacity(ratio * finalOpacity);
}
};
fadeIn.setOnFinish(new GVROnFinish() {
@Override
public void finished(GVRAnimation animation) {
getAnimationEngine().start(fadeOut);
}
});
getAnimationEngine().start(fadeIn);
} | [
"public",
"void",
"showToast",
"(",
"final",
"String",
"message",
",",
"float",
"duration",
")",
"{",
"final",
"float",
"quadWidth",
"=",
"1.2f",
";",
"final",
"GVRTextViewSceneObject",
"toastSceneObject",
"=",
"new",
"GVRTextViewSceneObject",
"(",
"this",
",",
... | Show a toast-like message for the specified duration
@param message
@param duration in seconds | [
"Show",
"a",
"toast",
"-",
"like",
"message",
"for",
"the",
"specified",
"duration"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L702-L754 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java | MFVec2f.append | public void append(float[] newValue) {
if ( (newValue.length % 2) == 0) {
for (int i = 0; i < (newValue.length/2); i++) {
value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );
}
}
else {
Log.e(TAG, "X3D MFVec3f append set with array length not divisible by 2");
}
} | java | public void append(float[] newValue) {
if ( (newValue.length % 2) == 0) {
for (int i = 0; i < (newValue.length/2); i++) {
value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );
}
}
else {
Log.e(TAG, "X3D MFVec3f append set with array length not divisible by 2");
}
} | [
"public",
"void",
"append",
"(",
"float",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"(",
"newValue",
".",
"length",
"%",
"2",
")",
"==",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"newValue",
".",
"length",
"/",
"2"... | Places a new value at the end of the existing value array, increasing the field length accordingly.
@param newValue - the 2 floats making the new SFVec2f appended to the MFVec2f array list | [
"Places",
"a",
"new",
"value",
"at",
"the",
"end",
"of",
"the",
"existing",
"value",
"array",
"increasing",
"the",
"field",
"length",
"accordingly",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L70-L79 | train |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java | MFVec2f.insertValue | public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
} | java | public void insertValue(int index, float[] newValue) {
if ( newValue.length == 2) {
try {
value.add( index, new SFVec2f(newValue[0], newValue[1]) );
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f insertValue set with array length not equal to 2");
}
} | [
"public",
"void",
"insertValue",
"(",
"int",
"index",
",",
"float",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"newValue",
".",
"length",
"==",
"2",
")",
"{",
"try",
"{",
"value",
".",
"add",
"(",
"index",
",",
"new",
"SFVec2f",
"(",
"newValue",
"[... | Insert a new value prior to the index location in the existing value array,
increasing the field length accordingly.
@param index - where the new values in an SFVec2f object will be placed in the array list
@param newValue - the new x, y value for the array list | [
"Insert",
"a",
"new",
"value",
"prior",
"to",
"the",
"index",
"location",
"in",
"the",
"existing",
"value",
"array",
"increasing",
"the",
"field",
"length",
"accordingly",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L134-L149 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java | GVRSpotLight.setOuterConeAngle | public void setOuterConeAngle(float angle)
{
setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
mChanged.set(true);
} | java | public void setOuterConeAngle(float angle)
{
setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
mChanged.set(true);
} | [
"public",
"void",
"setOuterConeAngle",
"(",
"float",
"angle",
")",
"{",
"setFloat",
"(",
"\"outer_cone_angle\"",
",",
"(",
"float",
")",
"Math",
".",
"cos",
"(",
"Math",
".",
"toRadians",
"(",
"angle",
")",
")",
")",
";",
"mChanged",
".",
"set",
"(",
"... | Set the inner angle of the spotlight cone in degrees.
Beyond the outer cone angle there is no illumination.
The underlying uniform "outer_cone_angle" is the cosine
of this input angle. If the inner cone angle is larger than the outer cone angle
there will be unexpected results.
@see #setInnerConeAngle(float)
@see #getOuterConeAngle() | [
"Set",
"the",
"inner",
"angle",
"of",
"the",
"spotlight",
"cone",
"in",
"degrees",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java#L144-L148 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java | GVRSpotLight.setCastShadow | 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
{
float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
owner.attachComponent(shadowMap);
}
mChanged.set(true);
}
else if (shadowMap != null)
{
shadowMap.setEnable(false);
}
}
mCastShadow = enableFlag;
} | java | 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
{
float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
owner.attachComponent(shadowMap);
}
mChanged.set(true);
}
else if (shadowMap != null)
{
shadowMap.setEnable(false);
}
}
mCastShadow = enableFlag;
} | [
"public",
"void",
"setCastShadow",
"(",
"boolean",
"enableFlag",
")",
"{",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"owner",
"!=",
"null",
")",
"{",
"GVRShadowMap",
"shadowMap",
"=",
"(",
"GVRShadowMap",
")",
"getComponent",
... | Enables or disabled shadow casting for a spot light.
Enabling shadows attaches a GVRShadowMap component to the
GVRSceneObject which owns the light and provides the
component with an perspective camera for shadow casting.
@param enableFlag true to enable shadow casting, false to disable | [
"Enables",
"or",
"disabled",
"shadow",
"casting",
"for",
"a",
"spot",
"light",
".",
"Enabling",
"shadows",
"attaches",
"a",
"GVRShadowMap",
"component",
"to",
"the",
"GVRSceneObject",
"which",
"owns",
"the",
"light",
"and",
"provides",
"the",
"component",
"with"... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSpotLight.java#L157-L185 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.findCursorController | public GVRCursorController findCursorController(GVRControllerType type) {
for (int index = 0, size = cache.size(); index < size; index++)
{
int key = cache.keyAt(index);
GVRCursorController controller = cache.get(key);
if (controller.getControllerType().equals(type)) {
return controller;
}
}
return null;
} | java | public GVRCursorController findCursorController(GVRControllerType type) {
for (int index = 0, size = cache.size(); index < size; index++)
{
int key = cache.keyAt(index);
GVRCursorController controller = cache.get(key);
if (controller.getControllerType().equals(type)) {
return controller;
}
}
return null;
} | [
"public",
"GVRCursorController",
"findCursorController",
"(",
"GVRControllerType",
"type",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"size",
"=",
"cache",
".",
"size",
"(",
")",
";",
"index",
"<",
"size",
";",
"index",
"++",
")",
"{",
"int",
... | Get the first controller of a specified type
@param type controller type to search for
@return controller found or null if no controllers of the given type | [
"Get",
"the",
"first",
"controller",
"of",
"a",
"specified",
"type"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L372-L382 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.clear | public int clear()
{
int n = 0;
for (GVRCursorController c : controllers)
{
c.stopDrag();
removeCursorController(c);
++n;
}
return n;
} | java | public int clear()
{
int n = 0;
for (GVRCursorController c : controllers)
{
c.stopDrag();
removeCursorController(c);
++n;
}
return n;
} | [
"public",
"int",
"clear",
"(",
")",
"{",
"int",
"n",
"=",
"0",
";",
"for",
"(",
"GVRCursorController",
"c",
":",
"controllers",
")",
"{",
"c",
".",
"stopDrag",
"(",
")",
";",
"removeCursorController",
"(",
"c",
")",
";",
"++",
"n",
";",
"}",
"retur... | Remove all controllers but leave input manager running.
@return number of controllers removed | [
"Remove",
"all",
"controllers",
"but",
"leave",
"input",
"manager",
"running",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L435-L445 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.close | public void close()
{
inputManager.unregisterInputDeviceListener(inputDeviceListener);
mouseDeviceManager.forceStopThread();
gamepadDeviceManager.forceStopThread();
controllerIds.clear();
cache.clear();
controllers.clear();
} | java | public void close()
{
inputManager.unregisterInputDeviceListener(inputDeviceListener);
mouseDeviceManager.forceStopThread();
gamepadDeviceManager.forceStopThread();
controllerIds.clear();
cache.clear();
controllers.clear();
} | [
"public",
"void",
"close",
"(",
")",
"{",
"inputManager",
".",
"unregisterInputDeviceListener",
"(",
"inputDeviceListener",
")",
";",
"mouseDeviceManager",
".",
"forceStopThread",
"(",
")",
";",
"gamepadDeviceManager",
".",
"forceStopThread",
"(",
")",
";",
"control... | Shut down the input manager.
After this call, GearVRf will not be able to access IO devices. | [
"Shut",
"down",
"the",
"input",
"manager",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L452-L460 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.getUniqueControllerId | private GVRCursorController getUniqueControllerId(int deviceId) {
GVRCursorController controller = controllerIds.get(deviceId);
if (controller != null) {
return controller;
}
return null;
} | java | private GVRCursorController getUniqueControllerId(int deviceId) {
GVRCursorController controller = controllerIds.get(deviceId);
if (controller != null) {
return controller;
}
return null;
} | [
"private",
"GVRCursorController",
"getUniqueControllerId",
"(",
"int",
"deviceId",
")",
"{",
"GVRCursorController",
"controller",
"=",
"controllerIds",
".",
"get",
"(",
"deviceId",
")",
";",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"return",
"controller",
... | returns null if no device is found. | [
"returns",
"null",
"if",
"no",
"device",
"is",
"found",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L463-L469 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.getCacheKey | private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
if (controllerType != GVRControllerType.UNKNOWN &&
controllerType != GVRControllerType.EXTERNAL) {
// Sometimes a device shows up using two device ids
// here we try to show both devices as one using the
// product and vendor id
int key = device.getVendorId();
key = 31 * key + device.getProductId();
key = 31 * key + controllerType.hashCode();
return key;
}
return -1; // invalid key
} | java | private int getCacheKey(InputDevice device, GVRControllerType controllerType) {
if (controllerType != GVRControllerType.UNKNOWN &&
controllerType != GVRControllerType.EXTERNAL) {
// Sometimes a device shows up using two device ids
// here we try to show both devices as one using the
// product and vendor id
int key = device.getVendorId();
key = 31 * key + device.getProductId();
key = 31 * key + controllerType.hashCode();
return key;
}
return -1; // invalid key
} | [
"private",
"int",
"getCacheKey",
"(",
"InputDevice",
"device",
",",
"GVRControllerType",
"controllerType",
")",
"{",
"if",
"(",
"controllerType",
"!=",
"GVRControllerType",
".",
"UNKNOWN",
"&&",
"controllerType",
"!=",
"GVRControllerType",
".",
"EXTERNAL",
")",
"{",... | Return the key if there is one else return -1 | [
"Return",
"the",
"key",
"if",
"there",
"is",
"one",
"else",
"return",
"-",
"1"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L511-L525 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java | GVRInputManager.addDevice | private GVRCursorController addDevice(int deviceId) {
InputDevice device = inputManager.getInputDevice(deviceId);
GVRControllerType controllerType = getGVRInputDeviceType(device);
if (mEnabledControllerTypes == null)
{
return null;
}
if (controllerType == GVRControllerType.GAZE && !mEnabledControllerTypes.contains(GVRControllerType.GAZE))
{
return null;
}
int key;
if (controllerType == GVRControllerType.GAZE) {
// create the controller if there isn't one.
if (gazeCursorController == null) {
gazeCursorController = new GVRGazeCursorController(context, GVRControllerType.GAZE,
GVRDeviceConstants.OCULUS_GEARVR_DEVICE_NAME,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_VENDOR_ID,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID);
}
// use the cached gaze key
key = GAZE_CACHED_KEY;
} else {
key = getCacheKey(device, controllerType);
}
if (key != -1)
{
GVRCursorController controller = cache.get(key);
if (controller == null)
{
if ((mEnabledControllerTypes == null) || !mEnabledControllerTypes.contains(controllerType))
{
return null;
}
if (controllerType == GVRControllerType.MOUSE)
{
controller = mouseDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAMEPAD)
{
controller = gamepadDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAZE)
{
controller = gazeCursorController;
}
cache.put(key, controller);
controllerIds.put(device.getId(), controller);
return controller;
}
else
{
controllerIds.put(device.getId(), controller);
}
}
return null;
} | java | private GVRCursorController addDevice(int deviceId) {
InputDevice device = inputManager.getInputDevice(deviceId);
GVRControllerType controllerType = getGVRInputDeviceType(device);
if (mEnabledControllerTypes == null)
{
return null;
}
if (controllerType == GVRControllerType.GAZE && !mEnabledControllerTypes.contains(GVRControllerType.GAZE))
{
return null;
}
int key;
if (controllerType == GVRControllerType.GAZE) {
// create the controller if there isn't one.
if (gazeCursorController == null) {
gazeCursorController = new GVRGazeCursorController(context, GVRControllerType.GAZE,
GVRDeviceConstants.OCULUS_GEARVR_DEVICE_NAME,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_VENDOR_ID,
GVRDeviceConstants.OCULUS_GEARVR_TOUCHPAD_PRODUCT_ID);
}
// use the cached gaze key
key = GAZE_CACHED_KEY;
} else {
key = getCacheKey(device, controllerType);
}
if (key != -1)
{
GVRCursorController controller = cache.get(key);
if (controller == null)
{
if ((mEnabledControllerTypes == null) || !mEnabledControllerTypes.contains(controllerType))
{
return null;
}
if (controllerType == GVRControllerType.MOUSE)
{
controller = mouseDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAMEPAD)
{
controller = gamepadDeviceManager.getCursorController(context, device.getName(), device.getVendorId(), device.getProductId());
}
else if (controllerType == GVRControllerType.GAZE)
{
controller = gazeCursorController;
}
cache.put(key, controller);
controllerIds.put(device.getId(), controller);
return controller;
}
else
{
controllerIds.put(device.getId(), controller);
}
}
return null;
} | [
"private",
"GVRCursorController",
"addDevice",
"(",
"int",
"deviceId",
")",
"{",
"InputDevice",
"device",
"=",
"inputManager",
".",
"getInputDevice",
"(",
"deviceId",
")",
";",
"GVRControllerType",
"controllerType",
"=",
"getGVRInputDeviceType",
"(",
"device",
")",
... | returns controller if a new device is found | [
"returns",
"controller",
"if",
"a",
"new",
"device",
"is",
"found"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRInputManager.java#L528-L587 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java | GVRTexture.getAtlasInformation | public List<GVRAtlasInformation> getAtlasInformation()
{
if ((mImage != null) && (mImage instanceof GVRImageAtlas))
{
return ((GVRImageAtlas) mImage).getAtlasInformation();
}
return null;
} | java | public List<GVRAtlasInformation> getAtlasInformation()
{
if ((mImage != null) && (mImage instanceof GVRImageAtlas))
{
return ((GVRImageAtlas) mImage).getAtlasInformation();
}
return null;
} | [
"public",
"List",
"<",
"GVRAtlasInformation",
">",
"getAtlasInformation",
"(",
")",
"{",
"if",
"(",
"(",
"mImage",
"!=",
"null",
")",
"&&",
"(",
"mImage",
"instanceof",
"GVRImageAtlas",
")",
")",
"{",
"return",
"(",
"(",
"GVRImageAtlas",
")",
"mImage",
")"... | Returns the list of atlas information necessary to map
the texture atlas to each scene object.
@return List of atlas information. | [
"Returns",
"the",
"list",
"of",
"atlas",
"information",
"necessary",
"to",
"map",
"the",
"texture",
"atlas",
"to",
"each",
"scene",
"object",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java#L206-L213 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java | GVRTexture.setImage | public void setImage(final GVRImage imageData)
{
mImage = imageData;
if (imageData != null)
NativeTexture.setImage(getNative(), imageData, imageData.getNative());
else
NativeTexture.setImage(getNative(), null, 0);
} | java | public void setImage(final GVRImage imageData)
{
mImage = imageData;
if (imageData != null)
NativeTexture.setImage(getNative(), imageData, imageData.getNative());
else
NativeTexture.setImage(getNative(), null, 0);
} | [
"public",
"void",
"setImage",
"(",
"final",
"GVRImage",
"imageData",
")",
"{",
"mImage",
"=",
"imageData",
";",
"if",
"(",
"imageData",
"!=",
"null",
")",
"NativeTexture",
".",
"setImage",
"(",
"getNative",
"(",
")",
",",
"imageData",
",",
"imageData",
"."... | Changes the image data associated with a GVRTexture.
This can be a simple bitmap, a compressed bitmap,
a cubemap or a compressed cubemap.
@param imageData data for the texture as a GVRImate | [
"Changes",
"the",
"image",
"data",
"associated",
"with",
"a",
"GVRTexture",
".",
"This",
"can",
"be",
"a",
"simple",
"bitmap",
"a",
"compressed",
"bitmap",
"a",
"cubemap",
"or",
"a",
"compressed",
"cubemap",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTexture.java#L251-L258 | train |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearinputprovider/src/main/java/com/samsung/mpl/gearinputprovider/backend/InputProviderService.java | InputProviderService.sendEvent | public static void sendEvent(Context context, Parcelable event) {
Intent intent = new Intent(EventManager.ACTION_ACCESSORY_EVENT);
intent.putExtra(EventManager.EXTRA_EVENT, event);
context.sendBroadcast(intent);
} | java | public static void sendEvent(Context context, Parcelable event) {
Intent intent = new Intent(EventManager.ACTION_ACCESSORY_EVENT);
intent.putExtra(EventManager.EXTRA_EVENT, event);
context.sendBroadcast(intent);
} | [
"public",
"static",
"void",
"sendEvent",
"(",
"Context",
"context",
",",
"Parcelable",
"event",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"EventManager",
".",
"ACTION_ACCESSORY_EVENT",
")",
";",
"intent",
".",
"putExtra",
"(",
"EventManager",
".... | Send an event to other applications
@param context context in which to send the broadcast
@param event event to send | [
"Send",
"an",
"event",
"to",
"other",
"applications"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/PhoneSide/gearinputprovider/src/main/java/com/samsung/mpl/gearinputprovider/backend/InputProviderService.java#L286-L290 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java | Jassimp.importFile | public static AiScene importFile(String filename) throws IOException {
return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));
} | java | public static AiScene importFile(String filename) throws IOException {
return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));
} | [
"public",
"static",
"AiScene",
"importFile",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"return",
"importFile",
"(",
"filename",
",",
"EnumSet",
".",
"noneOf",
"(",
"AiPostProcessSteps",
".",
"class",
")",
")",
";",
"}"
] | Imports a file via assimp without post processing.
@param filename the file to import
@return the loaded scene
@throws IOException if an error occurs | [
"Imports",
"a",
"file",
"via",
"assimp",
"without",
"post",
"processing",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/Jassimp.java#L77-L80 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java | GVRSkeletonAnimation.addChannel | public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
} | java | public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
} | [
"public",
"void",
"addChannel",
"(",
"String",
"boneName",
",",
"GVRAnimationChannel",
"channel",
")",
"{",
"int",
"boneId",
"=",
"mSkeleton",
".",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
">=",
"0",
")",
"{",
"mBoneChannels",
"[",
"... | Add a channel to the animation to animate the named bone.
@param boneName name of bone to animate.
@param channel The animation channel. | [
"Add",
"a",
"channel",
"to",
"the",
"animation",
"to",
"animate",
"the",
"named",
"bone",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L105-L114 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java | GVRSkeletonAnimation.findChannel | public GVRAnimationChannel findChannel(String boneName)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
return mBoneChannels[boneId];
}
return null;
} | java | public GVRAnimationChannel findChannel(String boneName)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
return mBoneChannels[boneId];
}
return null;
} | [
"public",
"GVRAnimationChannel",
"findChannel",
"(",
"String",
"boneName",
")",
"{",
"int",
"boneId",
"=",
"mSkeleton",
".",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
">=",
"0",
")",
"{",
"return",
"mBoneChannels",
"[",
"boneId",
"]",
... | Find the channel in the animation that animates the named bone.
@param boneName name of bone to animate. | [
"Find",
"the",
"channel",
"in",
"the",
"animation",
"that",
"animates",
"the",
"named",
"bone",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L120-L128 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java | GVRSkeletonAnimation.animate | public void animate(float timeInSec)
{
GVRSkeleton skel = getSkeleton();
GVRPose pose = skel.getPose();
computePose(timeInSec,pose);
skel.poseToBones();
skel.updateBonePose();
skel.updateSkinPose();
} | java | public void animate(float timeInSec)
{
GVRSkeleton skel = getSkeleton();
GVRPose pose = skel.getPose();
computePose(timeInSec,pose);
skel.poseToBones();
skel.updateBonePose();
skel.updateSkinPose();
} | [
"public",
"void",
"animate",
"(",
"float",
"timeInSec",
")",
"{",
"GVRSkeleton",
"skel",
"=",
"getSkeleton",
"(",
")",
";",
"GVRPose",
"pose",
"=",
"skel",
".",
"getPose",
"(",
")",
";",
"computePose",
"(",
"timeInSec",
",",
"pose",
")",
";",
"skel",
"... | Compute pose of skeleton at the given time from the animation channels.
@param timeInSec animation time in seconds. | [
"Compute",
"pose",
"of",
"skeleton",
"at",
"the",
"given",
"time",
"from",
"the",
"animation",
"channels",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L218-L226 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java | ResourceCache.put | public void put(GVRAndroidResource androidResource, T resource) {
Log.d(TAG, "put resource %s to cache", androidResource);
super.put(androidResource, resource);
} | java | public void put(GVRAndroidResource androidResource, T resource) {
Log.d(TAG, "put resource %s to cache", androidResource);
super.put(androidResource, resource);
} | [
"public",
"void",
"put",
"(",
"GVRAndroidResource",
"androidResource",
",",
"T",
"resource",
")",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"put resource %s to cache\"",
",",
"androidResource",
")",
";",
"super",
".",
"put",
"(",
"androidResource",
",",
"resour... | Save a weak reference to the resource | [
"Save",
"a",
"weak",
"reference",
"to",
"the",
"resource"
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java#L43-L47 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.removeControl | public void removeControl(String name) {
Widget control = findChildByName(name);
if (control != null) {
removeChild(control);
if (mBgResId != -1) {
updateMesh();
}
}
} | java | public void removeControl(String name) {
Widget control = findChildByName(name);
if (control != null) {
removeChild(control);
if (mBgResId != -1) {
updateMesh();
}
}
} | [
"public",
"void",
"removeControl",
"(",
"String",
"name",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"removeChild",
"(",
"control",
")",
";",
"if",
"(",
"mBgResId",
"!=",
... | Remove control from the control bar. Size of control bar is updated based on new number of
controls.
@param name name of the control to remove | [
"Remove",
"control",
"from",
"the",
"control",
"bar",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L135-L143 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {
final JSONObject allowedProperties = new JSONObject();
put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));
put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));
put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));
Widget control = new Widget(getGVRContext(), allowedProperties);
setupControl(name, control, listener, -1);
} | java | public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {
final JSONObject allowedProperties = new JSONObject();
put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));
put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));
put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));
Widget control = new Widget(getGVRContext(), allowedProperties);
setupControl(name, control, listener, -1);
} | [
"public",
"void",
"addControl",
"(",
"String",
"name",
",",
"JSONObject",
"properties",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"final",
"JSONObject",
"allowedProperties",
"=",
"new",
"JSONObject",
"(",
")",
";",
"put",
"(",
"allowedProperti... | Add new control at the end of control bar with specified touch listener.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param properties JSON control specific properties
@param listener touch listener | [
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L153-L161 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
} | java | public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {
return addControl(name, resId, null, listener, -1);
} | [
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"null",
",",
"listener",
",",
"-",
"1",
")",
";",
"}"
] | Add new control at the end of control bar with specified touch listener and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param listener touch listener | [
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L170-L172 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
} | java | public Widget addControl(String name, int resId, String label, Widget.OnTouchListener listener) {
return addControl(name, resId, label, listener, -1);
} | [
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"String",
"label",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"return",
"addControl",
"(",
"name",
",",
"resId",
",",
"label",
",",
"listener",
",",
"-",
... | Add new control at the end of control bar with specified touch listener, control label and resource.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param label the control label
@param listener touch listener | [
"Add",
"new",
"control",
"at",
"the",
"end",
"of",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"control",
"label",
"and",
"resource",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
".... | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L182-L184 | train |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControl | public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {
Widget control = findChildByName(name);
if (control == null) {
control = createControlWidget(resId, name, null);
}
setupControl(name, control, listener, position);
return control;
} | java | public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {
Widget control = findChildByName(name);
if (control == null) {
control = createControlWidget(resId, name, null);
}
setupControl(name, control, listener, position);
return control;
} | [
"public",
"Widget",
"addControl",
"(",
"String",
"name",
",",
"int",
"resId",
",",
"Widget",
".",
"OnTouchListener",
"listener",
",",
"int",
"position",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"==... | Add new control at the control bar with specified touch listener, resource and position.
Size of control bar is updated based on new number of controls.
@param name name of the control to remove
@param resId the control face
@param listener touch listener
@param position control position in the bar | [
"Add",
"new",
"control",
"at",
"the",
"control",
"bar",
"with",
"specified",
"touch",
"listener",
"resource",
"and",
"position",
".",
"Size",
"of",
"control",
"bar",
"is",
"updated",
"based",
"on",
"new",
"number",
"of",
"controls",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L194-L201 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMeshCollider.java | GVRMeshCollider.setMesh | public void setMesh(GVRMesh mesh) {
mMesh = mesh;
NativeMeshCollider.setMesh(getNative(), mesh.getNative());
} | java | public void setMesh(GVRMesh mesh) {
mMesh = mesh;
NativeMeshCollider.setMesh(getNative(), mesh.getNative());
} | [
"public",
"void",
"setMesh",
"(",
"GVRMesh",
"mesh",
")",
"{",
"mMesh",
"=",
"mesh",
";",
"NativeMeshCollider",
".",
"setMesh",
"(",
"getNative",
"(",
")",
",",
"mesh",
".",
"getNative",
"(",
")",
")",
";",
"}"
] | Set the mesh to be tested against.
@param mesh
The {@link GVRMesh} that the picking ray will test against. | [
"Set",
"the",
"mesh",
"to",
"be",
"tested",
"against",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMeshCollider.java#L123-L126 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setLinearLowerLimits | public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setLinearLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearLowerLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setLinearLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the lower limits for the "moving" body translation relative to joint point.
@param limitX the X axis lower translation limit
@param limitY the Y axis lower translation limit
@param limitZ the Z axis lower translation limit | [
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L65-L67 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setLinearUpperLimits | public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setLinearUpperLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearUpperLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the upper limits for the "moving" body translation relative to joint point.
@param limitX the X upper lower translation limit
@param limitY the Y upper lower translation limit
@param limitZ the Z upper lower translation limit | [
"Sets",
"the",
"upper",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L85-L87 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setAngularLowerLimits | public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setAngularLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setAngularLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the lower limits for the "moving" body rotation relative to joint point.
@param limitX the X axis lower rotation limit (in radians)
@param limitY the Y axis lower rotation limit (in radians)
@param limitZ the Z axis lower rotation limit (in radians) | [
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"rotation",
"relative",
"to",
"joint",
"point",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L105-L107 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setAngularUpperLimits | public void setAngularUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularUpperLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setAngularUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularUpperLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setAngularUpperLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setAngularUpperLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the upper limits for the "moving" body rotation relative to joint point.
@param limitX the X axis upper rotation limit (in radians)
@param limitY the Y axis upper rotation limit (in radians)
@param limitZ the Z axis upper rotation limit (in radians) | [
"Sets",
"the",
"upper",
"limits",
"for",
"the",
"moving",
"body",
"rotation",
"relative",
"to",
"joint",
"point",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L125-L127 | train |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/Particles.java | Particles.makeParticleMesh | GVRSceneObject makeParticleMesh(float[] vertices, float[] velocities,
float[] particleTimeStamps )
{
mParticleMesh = new GVRMesh(mGVRContext);
//pass the particle positions as vertices, velocities as normals, and
//spawning times as texture coordinates.
mParticleMesh.setVertices(vertices);
mParticleMesh.setNormals(velocities);
mParticleMesh.setTexCoords(particleTimeStamps);
particleID = new GVRShaderId(ParticleShader.class);
material = new GVRMaterial(mGVRContext, particleID);
material.setVec4("u_color", mColorMultiplier.x, mColorMultiplier.y,
mColorMultiplier.z, mColorMultiplier.w);
material.setFloat("u_particle_age", mAge);
material.setVec3("u_acceleration", mAcceleration.x, mAcceleration.y, mAcceleration.z);
material.setFloat("u_particle_size", mSize);
material.setFloat("u_size_change_rate", mParticleSizeRate);
material.setFloat("u_fade", mFadeWithAge);
material.setFloat("u_noise_factor", mNoiseFactor);
GVRRenderData renderData = new GVRRenderData(mGVRContext);
renderData.setMaterial(material);
renderData.setMesh(mParticleMesh);
material.setMainTexture(mTexture);
GVRSceneObject meshObject = new GVRSceneObject(mGVRContext);
meshObject.attachRenderData(renderData);
meshObject.getRenderData().setMaterial(material);
// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing
// and set the rendering order to transparent.
// Disabling writing to depth buffer ensure that the particles blend correctly
// and keeping the depth test on along with rendering them
// after the geometry queue makes sure they occlude, and are occluded, correctly.
meshObject.getRenderData().setDrawMode(GL_POINTS);
meshObject.getRenderData().setDepthTest(true);
meshObject.getRenderData().setDepthMask(false);
meshObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT);
return meshObject;
} | java | GVRSceneObject makeParticleMesh(float[] vertices, float[] velocities,
float[] particleTimeStamps )
{
mParticleMesh = new GVRMesh(mGVRContext);
//pass the particle positions as vertices, velocities as normals, and
//spawning times as texture coordinates.
mParticleMesh.setVertices(vertices);
mParticleMesh.setNormals(velocities);
mParticleMesh.setTexCoords(particleTimeStamps);
particleID = new GVRShaderId(ParticleShader.class);
material = new GVRMaterial(mGVRContext, particleID);
material.setVec4("u_color", mColorMultiplier.x, mColorMultiplier.y,
mColorMultiplier.z, mColorMultiplier.w);
material.setFloat("u_particle_age", mAge);
material.setVec3("u_acceleration", mAcceleration.x, mAcceleration.y, mAcceleration.z);
material.setFloat("u_particle_size", mSize);
material.setFloat("u_size_change_rate", mParticleSizeRate);
material.setFloat("u_fade", mFadeWithAge);
material.setFloat("u_noise_factor", mNoiseFactor);
GVRRenderData renderData = new GVRRenderData(mGVRContext);
renderData.setMaterial(material);
renderData.setMesh(mParticleMesh);
material.setMainTexture(mTexture);
GVRSceneObject meshObject = new GVRSceneObject(mGVRContext);
meshObject.attachRenderData(renderData);
meshObject.getRenderData().setMaterial(material);
// Set the draw mode to GL_POINTS, disable writing to depth buffer, enable depth testing
// and set the rendering order to transparent.
// Disabling writing to depth buffer ensure that the particles blend correctly
// and keeping the depth test on along with rendering them
// after the geometry queue makes sure they occlude, and are occluded, correctly.
meshObject.getRenderData().setDrawMode(GL_POINTS);
meshObject.getRenderData().setDepthTest(true);
meshObject.getRenderData().setDepthMask(false);
meshObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT);
return meshObject;
} | [
"GVRSceneObject",
"makeParticleMesh",
"(",
"float",
"[",
"]",
"vertices",
",",
"float",
"[",
"]",
"velocities",
",",
"float",
"[",
"]",
"particleTimeStamps",
")",
"{",
"mParticleMesh",
"=",
"new",
"GVRMesh",
"(",
"mGVRContext",
")",
";",
"//pass the particle pos... | Creates and returns a GVRSceneObject with the specified mesh attributes.
@param vertices the vertex positions of that make up the mesh. (x1, y1, z1, x2, y2, z2, ...)
@param velocities the velocity attributes for each vertex. (vx1, vy1, vz1, vx2, vy2, vz2...)
@param particleTimeStamps the spawning times of each vertex. (t1, 0, t2, 0, t3, 0 ..)
@return The GVRSceneObject with this mesh. | [
"Creates",
"and",
"returns",
"a",
"GVRSceneObject",
"with",
"the",
"specified",
"mesh",
"attributes",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/Particles.java#L79-L123 | train |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java | GVRScriptBehavior.setFilePath | public void setFilePath(String filePath) throws IOException, GVRScriptException
{
GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.ANDROID_ASSETS;
String fname = filePath.toLowerCase();
mLanguage = FileNameUtils.getExtension(fname);
if (fname.startsWith("sd:"))
{
volumeType = GVRResourceVolume.VolumeType.ANDROID_SDCARD;
}
else if (fname.startsWith("http:") || fname.startsWith("https:"))
{
volumeType = GVRResourceVolume.VolumeType.NETWORK;
}
GVRResourceVolume volume = new GVRResourceVolume(getGVRContext(), volumeType,
FileNameUtils.getParentDirectory(filePath));
GVRAndroidResource resource = volume.openResource(filePath);
setScriptFile((GVRScriptFile)getGVRContext().getScriptManager().loadScript(resource, mLanguage));
} | java | public void setFilePath(String filePath) throws IOException, GVRScriptException
{
GVRResourceVolume.VolumeType volumeType = GVRResourceVolume.VolumeType.ANDROID_ASSETS;
String fname = filePath.toLowerCase();
mLanguage = FileNameUtils.getExtension(fname);
if (fname.startsWith("sd:"))
{
volumeType = GVRResourceVolume.VolumeType.ANDROID_SDCARD;
}
else if (fname.startsWith("http:") || fname.startsWith("https:"))
{
volumeType = GVRResourceVolume.VolumeType.NETWORK;
}
GVRResourceVolume volume = new GVRResourceVolume(getGVRContext(), volumeType,
FileNameUtils.getParentDirectory(filePath));
GVRAndroidResource resource = volume.openResource(filePath);
setScriptFile((GVRScriptFile)getGVRContext().getScriptManager().loadScript(resource, mLanguage));
} | [
"public",
"void",
"setFilePath",
"(",
"String",
"filePath",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"GVRResourceVolume",
".",
"VolumeType",
"volumeType",
"=",
"GVRResourceVolume",
".",
"VolumeType",
".",
"ANDROID_ASSETS",
";",
"String",
"fname",
... | Sets the path to the script file to load and loads the script.
@param filePath path to script file
@throws IOException if the script cannot be read.
@throws GVRScriptException if a script processing error occurs. | [
"Sets",
"the",
"path",
"to",
"the",
"script",
"file",
"to",
"load",
"and",
"loads",
"the",
"script",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L100-L119 | train |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java | GVRScriptBehavior.setScriptText | public void setScriptText(String scriptText, String language)
{
GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText);
mLanguage = GVRScriptManager.LANG_JAVASCRIPT;
setScriptFile(newScript);
} | java | public void setScriptText(String scriptText, String language)
{
GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText);
mLanguage = GVRScriptManager.LANG_JAVASCRIPT;
setScriptFile(newScript);
} | [
"public",
"void",
"setScriptText",
"(",
"String",
"scriptText",
",",
"String",
"language",
")",
"{",
"GVRScriptFile",
"newScript",
"=",
"new",
"GVRJavascriptScriptFile",
"(",
"getGVRContext",
"(",
")",
",",
"scriptText",
")",
";",
"mLanguage",
"=",
"GVRScriptManag... | Loads the script from a text string.
@param scriptText text string containing script to execute.
@param language language ("js" or "lua") | [
"Loads",
"the",
"script",
"from",
"a",
"text",
"string",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L126-L131 | train |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java | GVRScriptBehavior.invokeFunction | public boolean invokeFunction(String funcName, Object[] args)
{
mLastError = null;
if (mScriptFile != null)
{
if (mScriptFile.invokeFunction(funcName, args))
{
return true;
}
}
mLastError = mScriptFile.getLastError();
if ((mLastError != null) && !mLastError.contains("is not defined"))
{
getGVRContext().logError(mLastError, this);
}
return false;
} | java | public boolean invokeFunction(String funcName, Object[] args)
{
mLastError = null;
if (mScriptFile != null)
{
if (mScriptFile.invokeFunction(funcName, args))
{
return true;
}
}
mLastError = mScriptFile.getLastError();
if ((mLastError != null) && !mLastError.contains("is not defined"))
{
getGVRContext().logError(mLastError, this);
}
return false;
} | [
"public",
"boolean",
"invokeFunction",
"(",
"String",
"funcName",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"mLastError",
"=",
"null",
";",
"if",
"(",
"mScriptFile",
"!=",
"null",
")",
"{",
"if",
"(",
"mScriptFile",
".",
"invokeFunction",
"(",
"funcName",... | Calls a function script associated with this component.
The function is called even if the component
is not enabled and not attached to a scene object.
@param funcName name of script function to call.
@param args function parameters as an array of objects.
@return true if function was called, false if no such function
@see org.gearvrf.script.GVRScriptFile#invokeFunction(String, Object[]) invokeFunction | [
"Calls",
"a",
"function",
"script",
"associated",
"with",
"this",
"component",
".",
"The",
"function",
"is",
"called",
"even",
"if",
"the",
"component",
"is",
"not",
"enabled",
"and",
"not",
"attached",
"to",
"a",
"scene",
"object",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L316-L332 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRViewSceneObject.java | GVRViewSceneObject.setTextureBufferSize | public void setTextureBufferSize(final int size) {
mRootViewGroup.post(new Runnable() {
@Override
public void run() {
mRootViewGroup.setTextureBufferSize(size);
}
});
} | java | public void setTextureBufferSize(final int size) {
mRootViewGroup.post(new Runnable() {
@Override
public void run() {
mRootViewGroup.setTextureBufferSize(size);
}
});
} | [
"public",
"void",
"setTextureBufferSize",
"(",
"final",
"int",
"size",
")",
"{",
"mRootViewGroup",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"mRootViewGroup",
".",
"setTextureBufferSize",
"("... | Set the default size of the texture buffers. You can call this to reduce the buffer size
of views with anti-aliasing issue.
The max value to the buffer size should be the Math.max(width, height) of attached view.
@param size buffer size. Value > 0 and <= Math.max(width, height). | [
"Set",
"the",
"default",
"size",
"of",
"the",
"texture",
"buffers",
".",
"You",
"can",
"call",
"this",
"to",
"reduce",
"the",
"buffer",
"size",
"of",
"views",
"with",
"anti",
"-",
"aliasing",
"issue",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRViewSceneObject.java#L361-L368 | train |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java | GVRCamera.setBackgroundColor | public void setBackgroundColor(int color) {
setBackgroundColorR(Colors.byteToGl(Color.red(color)));
setBackgroundColorG(Colors.byteToGl(Color.green(color)));
setBackgroundColorB(Colors.byteToGl(Color.blue(color)));
setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));
} | java | public void setBackgroundColor(int color) {
setBackgroundColorR(Colors.byteToGl(Color.red(color)));
setBackgroundColorG(Colors.byteToGl(Color.green(color)));
setBackgroundColorB(Colors.byteToGl(Color.blue(color)));
setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));
} | [
"public",
"void",
"setBackgroundColor",
"(",
"int",
"color",
")",
"{",
"setBackgroundColorR",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
".",
"red",
"(",
"color",
")",
")",
")",
";",
"setBackgroundColorG",
"(",
"Colors",
".",
"byteToGl",
"(",
"Color",
"... | Set the background color.
If you don't set the background color, the default is an opaque black:
{@link Color#BLACK}, 0xff000000.
@param color
An Android 32-bit (ARGB) {@link Color}, such as you get from
{@link Resources#getColor(int)} | [
"Set",
"the",
"background",
"color",
"."
] | 05034d465a7b0a494fabb9e9f2971ac19392f32d | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L83-L88 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.