id
int32 0
165k
| 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
|
---|---|---|---|---|---|---|---|---|---|---|---|
161,800 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java
|
GVRPose.inverse
|
public void inverse(GVRPose src)
{
if (getSkeleton() != src.getSkeleton())
throw new IllegalArgumentException("GVRPose.copy: input pose is incompatible with this pose");
src.sync();
int numbones = getNumBones();
Bone srcBone = src.mBones[0];
Bone dstBone = mBones[0];
mNeedSync = true;
srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);
srcBone.LocalMatrix.set(dstBone.WorldMatrix);
if (sDebug)
{
Log.d("BONE", "invert: %s %s", mSkeleton.getBoneName(0), dstBone.toString());
}
for (int i = 1; i < numbones; ++i)
{
srcBone = src.mBones[i];
dstBone = mBones[i];
srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);
dstBone.Changed = WORLD_ROT | WORLD_POS;
if (sDebug)
{
Log.d("BONE", "invert: %s %s", mSkeleton.getBoneName(i), dstBone.toString());
}
}
sync();
}
|
java
|
public void inverse(GVRPose src)
{
if (getSkeleton() != src.getSkeleton())
throw new IllegalArgumentException("GVRPose.copy: input pose is incompatible with this pose");
src.sync();
int numbones = getNumBones();
Bone srcBone = src.mBones[0];
Bone dstBone = mBones[0];
mNeedSync = true;
srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);
srcBone.LocalMatrix.set(dstBone.WorldMatrix);
if (sDebug)
{
Log.d("BONE", "invert: %s %s", mSkeleton.getBoneName(0), dstBone.toString());
}
for (int i = 1; i < numbones; ++i)
{
srcBone = src.mBones[i];
dstBone = mBones[i];
srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);
dstBone.Changed = WORLD_ROT | WORLD_POS;
if (sDebug)
{
Log.d("BONE", "invert: %s %s", mSkeleton.getBoneName(i), dstBone.toString());
}
}
sync();
}
|
[
"public",
"void",
"inverse",
"(",
"GVRPose",
"src",
")",
"{",
"if",
"(",
"getSkeleton",
"(",
")",
"!=",
"src",
".",
"getSkeleton",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"GVRPose.copy: input pose is incompatible with this pose\"",
")",
";",
"src",
".",
"sync",
"(",
")",
";",
"int",
"numbones",
"=",
"getNumBones",
"(",
")",
";",
"Bone",
"srcBone",
"=",
"src",
".",
"mBones",
"[",
"0",
"]",
";",
"Bone",
"dstBone",
"=",
"mBones",
"[",
"0",
"]",
";",
"mNeedSync",
"=",
"true",
";",
"srcBone",
".",
"WorldMatrix",
".",
"invertAffine",
"(",
"dstBone",
".",
"WorldMatrix",
")",
";",
"srcBone",
".",
"LocalMatrix",
".",
"set",
"(",
"dstBone",
".",
"WorldMatrix",
")",
";",
"if",
"(",
"sDebug",
")",
"{",
"Log",
".",
"d",
"(",
"\"BONE\"",
",",
"\"invert: %s %s\"",
",",
"mSkeleton",
".",
"getBoneName",
"(",
"0",
")",
",",
"dstBone",
".",
"toString",
"(",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"numbones",
";",
"++",
"i",
")",
"{",
"srcBone",
"=",
"src",
".",
"mBones",
"[",
"i",
"]",
";",
"dstBone",
"=",
"mBones",
"[",
"i",
"]",
";",
"srcBone",
".",
"WorldMatrix",
".",
"invertAffine",
"(",
"dstBone",
".",
"WorldMatrix",
")",
";",
"dstBone",
".",
"Changed",
"=",
"WORLD_ROT",
"|",
"WORLD_POS",
";",
"if",
"(",
"sDebug",
")",
"{",
"Log",
".",
"d",
"(",
"\"BONE\"",
",",
"\"invert: %s %s\"",
",",
"mSkeleton",
".",
"getBoneName",
"(",
"i",
")",
",",
"dstBone",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"sync",
"(",
")",
";",
"}"
] |
Makes this pose the inverse of the input pose.
@param src pose to invert.
|
[
"Makes",
"this",
"pose",
"the",
"inverse",
"of",
"the",
"input",
"pose",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L799-L828
|
161,801 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java
|
GVRPose.calcWorld
|
protected void calcWorld(Bone bone, int parentId)
{
getWorldMatrix(parentId, mTempMtxB); // WorldMatrix (parent) TempMtxB
mTempMtxB.mul(bone.LocalMatrix); // WorldMatrix = WorldMatrix(parent) * LocalMatrix
bone.WorldMatrix.set(mTempMtxB);
}
|
java
|
protected void calcWorld(Bone bone, int parentId)
{
getWorldMatrix(parentId, mTempMtxB); // WorldMatrix (parent) TempMtxB
mTempMtxB.mul(bone.LocalMatrix); // WorldMatrix = WorldMatrix(parent) * LocalMatrix
bone.WorldMatrix.set(mTempMtxB);
}
|
[
"protected",
"void",
"calcWorld",
"(",
"Bone",
"bone",
",",
"int",
"parentId",
")",
"{",
"getWorldMatrix",
"(",
"parentId",
",",
"mTempMtxB",
")",
";",
"// WorldMatrix (parent) TempMtxB",
"mTempMtxB",
".",
"mul",
"(",
"bone",
".",
"LocalMatrix",
")",
";",
"// WorldMatrix = WorldMatrix(parent) * LocalMatrix",
"bone",
".",
"WorldMatrix",
".",
"set",
"(",
"mTempMtxB",
")",
";",
"}"
] |
Calculates the world matrix based on the local matrix.
|
[
"Calculates",
"the",
"world",
"matrix",
"based",
"on",
"the",
"local",
"matrix",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L946-L951
|
161,802 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java
|
GVRPose.calcLocal
|
protected void calcLocal(Bone bone, int parentId)
{
if (parentId < 0)
{
bone.LocalMatrix.set(bone.WorldMatrix);
return;
}
/*
* WorldMatrix = WorldMatrix(parent) * LocalMatrix
* LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix
*/
getWorldMatrix(parentId, mTempMtxA); // WorldMatrix(par)
mTempMtxA.invert(); // INVERSE[ WorldMatrix(parent) ]
mTempMtxA.mul(bone.WorldMatrix, bone.LocalMatrix); // LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix
}
|
java
|
protected void calcLocal(Bone bone, int parentId)
{
if (parentId < 0)
{
bone.LocalMatrix.set(bone.WorldMatrix);
return;
}
/*
* WorldMatrix = WorldMatrix(parent) * LocalMatrix
* LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix
*/
getWorldMatrix(parentId, mTempMtxA); // WorldMatrix(par)
mTempMtxA.invert(); // INVERSE[ WorldMatrix(parent) ]
mTempMtxA.mul(bone.WorldMatrix, bone.LocalMatrix); // LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix
}
|
[
"protected",
"void",
"calcLocal",
"(",
"Bone",
"bone",
",",
"int",
"parentId",
")",
"{",
"if",
"(",
"parentId",
"<",
"0",
")",
"{",
"bone",
".",
"LocalMatrix",
".",
"set",
"(",
"bone",
".",
"WorldMatrix",
")",
";",
"return",
";",
"}",
"/*\n\t * WorldMatrix = WorldMatrix(parent) * LocalMatrix\n\t * LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix\n\t */",
"getWorldMatrix",
"(",
"parentId",
",",
"mTempMtxA",
")",
";",
"// WorldMatrix(par)",
"mTempMtxA",
".",
"invert",
"(",
")",
";",
"// INVERSE[ WorldMatrix(parent) ]",
"mTempMtxA",
".",
"mul",
"(",
"bone",
".",
"WorldMatrix",
",",
"bone",
".",
"LocalMatrix",
")",
";",
"// LocalMatrix = INVERSE[ WorldMatrix(parent) ] * WorldMatrix",
"}"
] |
Calculates the local translation and rotation for a bone.
Assumes WorldRot and WorldPos have been calculated for the bone.
|
[
"Calculates",
"the",
"local",
"translation",
"and",
"rotation",
"for",
"a",
"bone",
".",
"Assumes",
"WorldRot",
"and",
"WorldPos",
"have",
"been",
"calculated",
"for",
"the",
"bone",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L957-L971
|
161,803 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
|
GVRLight.setVec3
|
public void setVec3(String key, float x, float y, float z)
{
checkKeyIsUniform(key);
NativeLight.setVec3(getNative(), key, x, y, z);
}
|
java
|
public void setVec3(String key, float x, float y, float z)
{
checkKeyIsUniform(key);
NativeLight.setVec3(getNative(), key, x, y, z);
}
|
[
"public",
"void",
"setVec3",
"(",
"String",
"key",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"checkKeyIsUniform",
"(",
"key",
")",
";",
"NativeLight",
".",
"setVec3",
"(",
"getNative",
"(",
")",
",",
"key",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] |
Set the value for a floating point vector of length 3.
@param key name of uniform to set.
@param x new X value
@param y new Y value
@param z new Z value
@see #getVec3
@see #getFloatVec(String)
|
[
"Set",
"the",
"value",
"for",
"a",
"floating",
"point",
"vector",
"of",
"length",
"3",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L426-L430
|
161,804 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
|
GVRLight.setVec4
|
public void setVec4(String key, float x, float y, float z, float w)
{
checkKeyIsUniform(key);
NativeLight.setVec4(getNative(), key, x, y, z, w);
}
|
java
|
public void setVec4(String key, float x, float y, float z, float w)
{
checkKeyIsUniform(key);
NativeLight.setVec4(getNative(), key, x, y, z, w);
}
|
[
"public",
"void",
"setVec4",
"(",
"String",
"key",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"w",
")",
"{",
"checkKeyIsUniform",
"(",
"key",
")",
";",
"NativeLight",
".",
"setVec4",
"(",
"getNative",
"(",
")",
",",
"key",
",",
"x",
",",
"y",
",",
"z",
",",
"w",
")",
";",
"}"
] |
Set the value for a floating point vector of length 4.
@param key name of uniform to set.
@param x new X value
@param y new Y value
@param z new Z value
@param w new W value
@see #getVec4
@see #getFloatVec(String)
|
[
"Set",
"the",
"value",
"for",
"a",
"floating",
"point",
"vector",
"of",
"length",
"4",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L453-L457
|
161,805 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
|
GVRLight.setMat4
|
public void setMat4(String key, float x1, float y1, float z1, float w1,
float x2, float y2, float z2, float w2, float x3, float y3,
float z3, float w3, float x4, float y4, float z4, float w4)
{
checkKeyIsUniform(key);
NativeLight.setMat4(getNative(), key, x1, y1, z1, w1, x2, y2,
z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);
}
|
java
|
public void setMat4(String key, float x1, float y1, float z1, float w1,
float x2, float y2, float z2, float w2, float x3, float y3,
float z3, float w3, float x4, float y4, float z4, float w4)
{
checkKeyIsUniform(key);
NativeLight.setMat4(getNative(), key, x1, y1, z1, w1, x2, y2,
z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);
}
|
[
"public",
"void",
"setMat4",
"(",
"String",
"key",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"z1",
",",
"float",
"w1",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"z2",
",",
"float",
"w2",
",",
"float",
"x3",
",",
"float",
"y3",
",",
"float",
"z3",
",",
"float",
"w3",
",",
"float",
"x4",
",",
"float",
"y4",
",",
"float",
"z4",
",",
"float",
"w4",
")",
"{",
"checkKeyIsUniform",
"(",
"key",
")",
";",
"NativeLight",
".",
"setMat4",
"(",
"getNative",
"(",
")",
",",
"key",
",",
"x1",
",",
"y1",
",",
"z1",
",",
"w1",
",",
"x2",
",",
"y2",
",",
"z2",
",",
"w2",
",",
"x3",
",",
"y3",
",",
"z3",
",",
"w3",
",",
"x4",
",",
"y4",
",",
"z4",
",",
"w4",
")",
";",
"}"
] |
Set the value for a floating point 4x4 matrix.
@param key name of uniform to set.
@see #getFloatVec(String)
|
[
"Set",
"the",
"value",
"for",
"a",
"floating",
"point",
"4x4",
"matrix",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L466-L473
|
161,806 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
|
GVRLight.onDrawFrame
|
public void onDrawFrame(float frameTime)
{
if (!isEnabled() || (owner == null) || (getFloat("enabled") <= 0.0f))
{
return;
}
float[] odir = getVec3("world_direction");
float[] opos = getVec3("world_position");
GVRSceneObject parent = owner;
Matrix4f worldmtx = parent.getTransform().getModelMatrix4f();
mOldDir.x = odir[0];
mOldDir.y = odir[1];
mOldDir.z = odir[2];
mOldPos.x = opos[0];
mOldPos.y = opos[1];
mOldPos.z = opos[2];
mNewDir.x = 0.0f;
mNewDir.y = 0.0f;
mNewDir.z = -1.0f;
worldmtx.getTranslation(mNewPos);
worldmtx.mul(mLightRot);
worldmtx.transformDirection(mNewDir);
if ((mOldDir.x != mNewDir.x) || (mOldDir.y != mNewDir.y) || (mOldDir.z != mNewDir.z))
{
setVec4("world_direction", mNewDir.x, mNewDir.y, mNewDir.z, 0);
}
if ((mOldPos.x != mNewPos.x) || (mOldPos.y != mNewPos.y) || (mOldPos.z != mNewPos.z))
{
setPosition(mNewPos.x, mNewPos.y, mNewPos.z);
}
}
|
java
|
public void onDrawFrame(float frameTime)
{
if (!isEnabled() || (owner == null) || (getFloat("enabled") <= 0.0f))
{
return;
}
float[] odir = getVec3("world_direction");
float[] opos = getVec3("world_position");
GVRSceneObject parent = owner;
Matrix4f worldmtx = parent.getTransform().getModelMatrix4f();
mOldDir.x = odir[0];
mOldDir.y = odir[1];
mOldDir.z = odir[2];
mOldPos.x = opos[0];
mOldPos.y = opos[1];
mOldPos.z = opos[2];
mNewDir.x = 0.0f;
mNewDir.y = 0.0f;
mNewDir.z = -1.0f;
worldmtx.getTranslation(mNewPos);
worldmtx.mul(mLightRot);
worldmtx.transformDirection(mNewDir);
if ((mOldDir.x != mNewDir.x) || (mOldDir.y != mNewDir.y) || (mOldDir.z != mNewDir.z))
{
setVec4("world_direction", mNewDir.x, mNewDir.y, mNewDir.z, 0);
}
if ((mOldPos.x != mNewPos.x) || (mOldPos.y != mNewPos.y) || (mOldPos.z != mNewPos.z))
{
setPosition(mNewPos.x, mNewPos.y, mNewPos.z);
}
}
|
[
"public",
"void",
"onDrawFrame",
"(",
"float",
"frameTime",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
"||",
"(",
"owner",
"==",
"null",
")",
"||",
"(",
"getFloat",
"(",
"\"enabled\"",
")",
"<=",
"0.0f",
")",
")",
"{",
"return",
";",
"}",
"float",
"[",
"]",
"odir",
"=",
"getVec3",
"(",
"\"world_direction\"",
")",
";",
"float",
"[",
"]",
"opos",
"=",
"getVec3",
"(",
"\"world_position\"",
")",
";",
"GVRSceneObject",
"parent",
"=",
"owner",
";",
"Matrix4f",
"worldmtx",
"=",
"parent",
".",
"getTransform",
"(",
")",
".",
"getModelMatrix4f",
"(",
")",
";",
"mOldDir",
".",
"x",
"=",
"odir",
"[",
"0",
"]",
";",
"mOldDir",
".",
"y",
"=",
"odir",
"[",
"1",
"]",
";",
"mOldDir",
".",
"z",
"=",
"odir",
"[",
"2",
"]",
";",
"mOldPos",
".",
"x",
"=",
"opos",
"[",
"0",
"]",
";",
"mOldPos",
".",
"y",
"=",
"opos",
"[",
"1",
"]",
";",
"mOldPos",
".",
"z",
"=",
"opos",
"[",
"2",
"]",
";",
"mNewDir",
".",
"x",
"=",
"0.0f",
";",
"mNewDir",
".",
"y",
"=",
"0.0f",
";",
"mNewDir",
".",
"z",
"=",
"-",
"1.0f",
";",
"worldmtx",
".",
"getTranslation",
"(",
"mNewPos",
")",
";",
"worldmtx",
".",
"mul",
"(",
"mLightRot",
")",
";",
"worldmtx",
".",
"transformDirection",
"(",
"mNewDir",
")",
";",
"if",
"(",
"(",
"mOldDir",
".",
"x",
"!=",
"mNewDir",
".",
"x",
")",
"||",
"(",
"mOldDir",
".",
"y",
"!=",
"mNewDir",
".",
"y",
")",
"||",
"(",
"mOldDir",
".",
"z",
"!=",
"mNewDir",
".",
"z",
")",
")",
"{",
"setVec4",
"(",
"\"world_direction\"",
",",
"mNewDir",
".",
"x",
",",
"mNewDir",
".",
"y",
",",
"mNewDir",
".",
"z",
",",
"0",
")",
";",
"}",
"if",
"(",
"(",
"mOldPos",
".",
"x",
"!=",
"mNewPos",
".",
"x",
")",
"||",
"(",
"mOldPos",
".",
"y",
"!=",
"mNewPos",
".",
"y",
")",
"||",
"(",
"mOldPos",
".",
"z",
"!=",
"mNewPos",
".",
"z",
")",
")",
"{",
"setPosition",
"(",
"mNewPos",
".",
"x",
",",
"mNewPos",
".",
"y",
",",
"mNewPos",
".",
"z",
")",
";",
"}",
"}"
] |
Updates the position and direction of this light from the transform of
scene object that owns it.
|
[
"Updates",
"the",
"position",
"and",
"direction",
"of",
"this",
"light",
"from",
"the",
"transform",
"of",
"scene",
"object",
"that",
"owns",
"it",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L573-L604
|
161,807 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCustomCamera.java
|
GVRCustomCamera.setProjectionMatrix
|
public void setProjectionMatrix(float x1, float y1, float z1, float w1,
float x2, float y2, float z2, float w2, float x3, float y3,
float z3, float w3, float x4, float y4, float z4, float w4) {
NativeCustomCamera.setProjectionMatrix(getNative(), x1, y1, z1, w1, x2,
y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);
}
|
java
|
public void setProjectionMatrix(float x1, float y1, float z1, float w1,
float x2, float y2, float z2, float w2, float x3, float y3,
float z3, float w3, float x4, float y4, float z4, float w4) {
NativeCustomCamera.setProjectionMatrix(getNative(), x1, y1, z1, w1, x2,
y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);
}
|
[
"public",
"void",
"setProjectionMatrix",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"z1",
",",
"float",
"w1",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"z2",
",",
"float",
"w2",
",",
"float",
"x3",
",",
"float",
"y3",
",",
"float",
"z3",
",",
"float",
"w3",
",",
"float",
"x4",
",",
"float",
"y4",
",",
"float",
"z4",
",",
"float",
"w4",
")",
"{",
"NativeCustomCamera",
".",
"setProjectionMatrix",
"(",
"getNative",
"(",
")",
",",
"x1",
",",
"y1",
",",
"z1",
",",
"w1",
",",
"x2",
",",
"y2",
",",
"z2",
",",
"w2",
",",
"x3",
",",
"y3",
",",
"z3",
",",
"w3",
",",
"x4",
",",
"y4",
",",
"z4",
",",
"w4",
")",
";",
"}"
] |
Set the custom projection matrix with individual matrix elements.
|
[
"Set",
"the",
"custom",
"projection",
"matrix",
"with",
"individual",
"matrix",
"elements",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCustomCamera.java#L27-L32
|
161,808 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java
|
AccessibilityFeature.loadCadidateString
|
private void loadCadidateString() {
volumeUp = mGvrContext.getActivity().getResources().getString(R.string.volume_up);
volumeDown = mGvrContext.getActivity().getResources().getString(R.string.volume_down);
zoomIn = mGvrContext.getActivity().getResources().getString(R.string.zoom_in);
zoomOut = mGvrContext.getActivity().getResources().getString(R.string.zoom_out);
invertedColors = mGvrContext.getActivity().getResources().getString(R.string.inverted_colors);
talkBack = mGvrContext.getActivity().getResources().getString(R.string.talk_back);
disableTalkBack = mGvrContext.getActivity().getResources().getString(R.string.disable_talk_back);
}
|
java
|
private void loadCadidateString() {
volumeUp = mGvrContext.getActivity().getResources().getString(R.string.volume_up);
volumeDown = mGvrContext.getActivity().getResources().getString(R.string.volume_down);
zoomIn = mGvrContext.getActivity().getResources().getString(R.string.zoom_in);
zoomOut = mGvrContext.getActivity().getResources().getString(R.string.zoom_out);
invertedColors = mGvrContext.getActivity().getResources().getString(R.string.inverted_colors);
talkBack = mGvrContext.getActivity().getResources().getString(R.string.talk_back);
disableTalkBack = mGvrContext.getActivity().getResources().getString(R.string.disable_talk_back);
}
|
[
"private",
"void",
"loadCadidateString",
"(",
")",
"{",
"volumeUp",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"volume_up",
")",
";",
"volumeDown",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"volume_down",
")",
";",
"zoomIn",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"zoom_in",
")",
";",
"zoomOut",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"zoom_out",
")",
";",
"invertedColors",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"inverted_colors",
")",
";",
"talkBack",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"talk_back",
")",
";",
"disableTalkBack",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getString",
"(",
"R",
".",
"string",
".",
"disable_talk_back",
")",
";",
"}"
] |
Load all string recognize.
|
[
"Load",
"all",
"string",
"recognize",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java#L55-L63
|
161,809 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java
|
AccessibilityFeature.findMatch
|
public void findMatch(ArrayList<String> speechResult) {
loadCadidateString();
for (String matchCandidate : speechResult) {
Locale localeDefault = mGvrContext.getActivity().getResources().getConfiguration().locale;
if (volumeUp.equals(matchCandidate)) {
startVolumeUp();
break;
} else if (volumeDown.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startVolumeDown();
break;
} else if (zoomIn.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startZoomIn();
break;
} else if (zoomOut.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startZoomOut();
break;
} else if (invertedColors.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startInvertedColors();
break;
} else if (talkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
enableTalkBack();
} else if (disableTalkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
disableTalkBack();
}
}
}
|
java
|
public void findMatch(ArrayList<String> speechResult) {
loadCadidateString();
for (String matchCandidate : speechResult) {
Locale localeDefault = mGvrContext.getActivity().getResources().getConfiguration().locale;
if (volumeUp.equals(matchCandidate)) {
startVolumeUp();
break;
} else if (volumeDown.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startVolumeDown();
break;
} else if (zoomIn.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startZoomIn();
break;
} else if (zoomOut.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startZoomOut();
break;
} else if (invertedColors.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
startInvertedColors();
break;
} else if (talkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
enableTalkBack();
} else if (disableTalkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {
disableTalkBack();
}
}
}
|
[
"public",
"void",
"findMatch",
"(",
"ArrayList",
"<",
"String",
">",
"speechResult",
")",
"{",
"loadCadidateString",
"(",
")",
";",
"for",
"(",
"String",
"matchCandidate",
":",
"speechResult",
")",
"{",
"Locale",
"localeDefault",
"=",
"mGvrContext",
".",
"getActivity",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"locale",
";",
"if",
"(",
"volumeUp",
".",
"equals",
"(",
"matchCandidate",
")",
")",
"{",
"startVolumeUp",
"(",
")",
";",
"break",
";",
"}",
"else",
"if",
"(",
"volumeDown",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"startVolumeDown",
"(",
")",
";",
"break",
";",
"}",
"else",
"if",
"(",
"zoomIn",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"startZoomIn",
"(",
")",
";",
"break",
";",
"}",
"else",
"if",
"(",
"zoomOut",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"startZoomOut",
"(",
")",
";",
"break",
";",
"}",
"else",
"if",
"(",
"invertedColors",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"startInvertedColors",
"(",
")",
";",
"break",
";",
"}",
"else",
"if",
"(",
"talkBack",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"enableTalkBack",
"(",
")",
";",
"}",
"else",
"if",
"(",
"disableTalkBack",
".",
"toLowerCase",
"(",
"localeDefault",
")",
".",
"equals",
"(",
"matchCandidate",
".",
"toLowerCase",
"(",
"localeDefault",
")",
")",
")",
"{",
"disableTalkBack",
"(",
")",
";",
"}",
"}",
"}"
] |
get the result speech recognize and find match in strings file.
@param speechResult
|
[
"get",
"the",
"result",
"speech",
"recognize",
"and",
"find",
"match",
"in",
"strings",
"file",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java#L70-L98
|
161,810 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java
|
AccessibilityFeature.enableTalkBack
|
private void enableTalkBack() {
GVRSceneObject[] sceneObjects = mGvrContext.getMainScene().getWholeSceneObjects();
for (GVRSceneObject sceneObject : sceneObjects) {
if (sceneObject instanceof GVRAccessiblityObject)
if (((GVRAccessiblityObject) sceneObject).getTalkBack() != null)
((GVRAccessiblityObject) sceneObject).getTalkBack().setActive(true);
}
}
|
java
|
private void enableTalkBack() {
GVRSceneObject[] sceneObjects = mGvrContext.getMainScene().getWholeSceneObjects();
for (GVRSceneObject sceneObject : sceneObjects) {
if (sceneObject instanceof GVRAccessiblityObject)
if (((GVRAccessiblityObject) sceneObject).getTalkBack() != null)
((GVRAccessiblityObject) sceneObject).getTalkBack().setActive(true);
}
}
|
[
"private",
"void",
"enableTalkBack",
"(",
")",
"{",
"GVRSceneObject",
"[",
"]",
"sceneObjects",
"=",
"mGvrContext",
".",
"getMainScene",
"(",
")",
".",
"getWholeSceneObjects",
"(",
")",
";",
"for",
"(",
"GVRSceneObject",
"sceneObject",
":",
"sceneObjects",
")",
"{",
"if",
"(",
"sceneObject",
"instanceof",
"GVRAccessiblityObject",
")",
"if",
"(",
"(",
"(",
"GVRAccessiblityObject",
")",
"sceneObject",
")",
".",
"getTalkBack",
"(",
")",
"!=",
"null",
")",
"(",
"(",
"GVRAccessiblityObject",
")",
"sceneObject",
")",
".",
"getTalkBack",
"(",
")",
".",
"setActive",
"(",
"true",
")",
";",
"}",
"}"
] |
find all accessibility object and set active true for enable talk back.
|
[
"find",
"all",
"accessibility",
"object",
"and",
"set",
"active",
"true",
"for",
"enable",
"talk",
"back",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java#L103-L110
|
161,811 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java
|
AccessibilityFeature.disableTalkBack
|
private void disableTalkBack() {
GVRSceneObject[] sceneObjects = mGvrContext.getMainScene().getWholeSceneObjects();
for (GVRSceneObject sceneObject : sceneObjects) {
if (sceneObject instanceof GVRAccessiblityObject)
if (((GVRAccessiblityObject) sceneObject).getTalkBack() != null)
((GVRAccessiblityObject) sceneObject).getTalkBack().setActive(false);
}
}
|
java
|
private void disableTalkBack() {
GVRSceneObject[] sceneObjects = mGvrContext.getMainScene().getWholeSceneObjects();
for (GVRSceneObject sceneObject : sceneObjects) {
if (sceneObject instanceof GVRAccessiblityObject)
if (((GVRAccessiblityObject) sceneObject).getTalkBack() != null)
((GVRAccessiblityObject) sceneObject).getTalkBack().setActive(false);
}
}
|
[
"private",
"void",
"disableTalkBack",
"(",
")",
"{",
"GVRSceneObject",
"[",
"]",
"sceneObjects",
"=",
"mGvrContext",
".",
"getMainScene",
"(",
")",
".",
"getWholeSceneObjects",
"(",
")",
";",
"for",
"(",
"GVRSceneObject",
"sceneObject",
":",
"sceneObjects",
")",
"{",
"if",
"(",
"sceneObject",
"instanceof",
"GVRAccessiblityObject",
")",
"if",
"(",
"(",
"(",
"GVRAccessiblityObject",
")",
"sceneObject",
")",
".",
"getTalkBack",
"(",
")",
"!=",
"null",
")",
"(",
"(",
"GVRAccessiblityObject",
")",
"sceneObject",
")",
".",
"getTalkBack",
"(",
")",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"}"
] |
find all accessibility object and set active false for enable talk back.
|
[
"find",
"all",
"accessibility",
"object",
"and",
"set",
"active",
"false",
"for",
"enable",
"talk",
"back",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java#L115-L123
|
161,812 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java
|
AccessibilityFeature.startInvertedColors
|
private void startInvertedColors() {
if (managerFeatures.getInvertedColors().isInverted()) {
managerFeatures.getInvertedColors().turnOff(mGvrContext.getMainScene());
} else {
managerFeatures.getInvertedColors().turnOn(mGvrContext.getMainScene());
}
}
|
java
|
private void startInvertedColors() {
if (managerFeatures.getInvertedColors().isInverted()) {
managerFeatures.getInvertedColors().turnOff(mGvrContext.getMainScene());
} else {
managerFeatures.getInvertedColors().turnOn(mGvrContext.getMainScene());
}
}
|
[
"private",
"void",
"startInvertedColors",
"(",
")",
"{",
"if",
"(",
"managerFeatures",
".",
"getInvertedColors",
"(",
")",
".",
"isInverted",
"(",
")",
")",
"{",
"managerFeatures",
".",
"getInvertedColors",
"(",
")",
".",
"turnOff",
"(",
"mGvrContext",
".",
"getMainScene",
"(",
")",
")",
";",
"}",
"else",
"{",
"managerFeatures",
".",
"getInvertedColors",
"(",
")",
".",
"turnOn",
"(",
"mGvrContext",
".",
"getMainScene",
"(",
")",
")",
";",
"}",
"}"
] |
Active inverter colors
|
[
"Active",
"inverter",
"colors"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/accessibility/AccessibilityFeature.java#L158-L164
|
161,813 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java
|
JaiDebug.dumpTexCoords
|
public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords);
return;
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords));
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords));
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords));
}
System.out.println("]");
}
}
|
java
|
public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords);
return;
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords));
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords));
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords));
}
System.out.println("]");
}
}
|
[
"public",
"static",
"void",
"dumpTexCoords",
"(",
"AiMesh",
"mesh",
",",
"int",
"coords",
")",
"{",
"if",
"(",
"!",
"mesh",
".",
"hasTexCoords",
"(",
"coords",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"mesh has no texture coordinate set \"",
"+",
"coords",
")",
";",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mesh",
".",
"getNumVertices",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"numComponents",
"=",
"mesh",
".",
"getNumUVComponents",
"(",
"coords",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"[\"",
"+",
"mesh",
".",
"getTexCoordU",
"(",
"i",
",",
"coords",
")",
")",
";",
"if",
"(",
"numComponents",
">",
"1",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\", \"",
"+",
"mesh",
".",
"getTexCoordV",
"(",
"i",
",",
"coords",
")",
")",
";",
"}",
"if",
"(",
"numComponents",
">",
"2",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\", \"",
"+",
"mesh",
".",
"getTexCoordW",
"(",
"i",
",",
"coords",
")",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"]\"",
")",
";",
"}",
"}"
] |
Dumps a texture coordinate set of a mesh to stdout.
@param mesh the mesh
@param coords the coordinates
|
[
"Dumps",
"a",
"texture",
"coordinate",
"set",
"of",
"a",
"mesh",
"to",
"stdout",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L139-L159
|
161,814 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java
|
JaiDebug.dumpMaterialProperty
|
public static void dumpMaterialProperty(AiMaterial.Property property) {
System.out.print(property.getKey() + " " + property.getSemantic() +
" " + property.getIndex() + ": ");
Object data = property.getData();
if (data instanceof ByteBuffer) {
ByteBuffer buf = (ByteBuffer) data;
for (int i = 0; i < buf.capacity(); i++) {
System.out.print(Integer.toHexString(buf.get(i) & 0xFF) + " ");
}
System.out.println();
}
else {
System.out.println(data.toString());
}
}
|
java
|
public static void dumpMaterialProperty(AiMaterial.Property property) {
System.out.print(property.getKey() + " " + property.getSemantic() +
" " + property.getIndex() + ": ");
Object data = property.getData();
if (data instanceof ByteBuffer) {
ByteBuffer buf = (ByteBuffer) data;
for (int i = 0; i < buf.capacity(); i++) {
System.out.print(Integer.toHexString(buf.get(i) & 0xFF) + " ");
}
System.out.println();
}
else {
System.out.println(data.toString());
}
}
|
[
"public",
"static",
"void",
"dumpMaterialProperty",
"(",
"AiMaterial",
".",
"Property",
"property",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"property",
".",
"getKey",
"(",
")",
"+",
"\" \"",
"+",
"property",
".",
"getSemantic",
"(",
")",
"+",
"\" \"",
"+",
"property",
".",
"getIndex",
"(",
")",
"+",
"\": \"",
")",
";",
"Object",
"data",
"=",
"property",
".",
"getData",
"(",
")",
";",
"if",
"(",
"data",
"instanceof",
"ByteBuffer",
")",
"{",
"ByteBuffer",
"buf",
"=",
"(",
"ByteBuffer",
")",
"data",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buf",
".",
"capacity",
"(",
")",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"Integer",
".",
"toHexString",
"(",
"buf",
".",
"get",
"(",
"i",
")",
"&",
"0xFF",
")",
"+",
"\" \"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"data",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Dumps a single material property to stdout.
@param property the property
|
[
"Dumps",
"a",
"single",
"material",
"property",
"to",
"stdout",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L167-L183
|
161,815 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java
|
JaiDebug.dumpMaterial
|
public static void dumpMaterial(AiMaterial material) {
for (AiMaterial.Property prop : material.getProperties()) {
dumpMaterialProperty(prop);
}
}
|
java
|
public static void dumpMaterial(AiMaterial material) {
for (AiMaterial.Property prop : material.getProperties()) {
dumpMaterialProperty(prop);
}
}
|
[
"public",
"static",
"void",
"dumpMaterial",
"(",
"AiMaterial",
"material",
")",
"{",
"for",
"(",
"AiMaterial",
".",
"Property",
"prop",
":",
"material",
".",
"getProperties",
"(",
")",
")",
"{",
"dumpMaterialProperty",
"(",
"prop",
")",
";",
"}",
"}"
] |
Dumps all properties of a material to stdout.
@param material the material
|
[
"Dumps",
"all",
"properties",
"of",
"a",
"material",
"to",
"stdout",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L191-L195
|
161,816 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java
|
JaiDebug.dumpNodeAnim
|
public static void dumpNodeAnim(AiNodeAnim nodeAnim) {
for (int i = 0; i < nodeAnim.getNumPosKeys(); i++) {
System.out.println(i + ": " + nodeAnim.getPosKeyTime(i) +
" ticks, " + nodeAnim.getPosKeyVector(i, Jassimp.BUILTIN));
}
}
|
java
|
public static void dumpNodeAnim(AiNodeAnim nodeAnim) {
for (int i = 0; i < nodeAnim.getNumPosKeys(); i++) {
System.out.println(i + ": " + nodeAnim.getPosKeyTime(i) +
" ticks, " + nodeAnim.getPosKeyVector(i, Jassimp.BUILTIN));
}
}
|
[
"public",
"static",
"void",
"dumpNodeAnim",
"(",
"AiNodeAnim",
"nodeAnim",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodeAnim",
".",
"getNumPosKeys",
"(",
")",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"i",
"+",
"\": \"",
"+",
"nodeAnim",
".",
"getPosKeyTime",
"(",
"i",
")",
"+",
"\" ticks, \"",
"+",
"nodeAnim",
".",
"getPosKeyVector",
"(",
"i",
",",
"Jassimp",
".",
"BUILTIN",
")",
")",
";",
"}",
"}"
] |
Dumps an animation channel to stdout.
@param nodeAnim the channel
|
[
"Dumps",
"an",
"animation",
"channel",
"to",
"stdout",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L203-L208
|
161,817 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java
|
Strings.joinStrings
|
public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
}
|
java
|
public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
}
|
[
"public",
"static",
"String",
"joinStrings",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"boolean",
"fixCase",
",",
"char",
"withChar",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
"||",
"strings",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"result",
"=",
"null",
";",
"for",
"(",
"String",
"s",
":",
"strings",
")",
"{",
"if",
"(",
"fixCase",
")",
"{",
"s",
"=",
"fixCase",
"(",
"s",
")",
";",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"StringBuilder",
"(",
"s",
")",
";",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"withChar",
")",
";",
"result",
".",
"append",
"(",
"s",
")",
";",
"}",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Generic string joining function.
@param strings Strings to be joined
@param fixCase does it need to fix word case
@param withChar char to join strings with.
@return joined-string
|
[
"Generic",
"string",
"joining",
"function",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java#L40-L57
|
161,818 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBoundsPicker.java
|
GVRBoundsPicker.addCollidable
|
public int addCollidable(GVRSceneObject sceneObj)
{
synchronized (mCollidables)
{
int index = mCollidables.indexOf(sceneObj);
if (index >= 0)
{
return index;
}
mCollidables.add(sceneObj);
return mCollidables.size() - 1;
}
}
|
java
|
public int addCollidable(GVRSceneObject sceneObj)
{
synchronized (mCollidables)
{
int index = mCollidables.indexOf(sceneObj);
if (index >= 0)
{
return index;
}
mCollidables.add(sceneObj);
return mCollidables.size() - 1;
}
}
|
[
"public",
"int",
"addCollidable",
"(",
"GVRSceneObject",
"sceneObj",
")",
"{",
"synchronized",
"(",
"mCollidables",
")",
"{",
"int",
"index",
"=",
"mCollidables",
".",
"indexOf",
"(",
"sceneObj",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"return",
"index",
";",
"}",
"mCollidables",
".",
"add",
"(",
"sceneObj",
")",
";",
"return",
"mCollidables",
".",
"size",
"(",
")",
"-",
"1",
";",
"}",
"}"
] |
Adds another scene object to pick against.
Each frame all the colliders in the scene will be compared
against the bounding volumes of all the collidables associated
with this picker.
@param sceneObj new collidable
@return index of collidable added, this is the CursorID in the GVRPickedObject
|
[
"Adds",
"another",
"scene",
"object",
"to",
"pick",
"against",
".",
"Each",
"frame",
"all",
"the",
"colliders",
"in",
"the",
"scene",
"will",
"be",
"compared",
"against",
"the",
"bounding",
"volumes",
"of",
"all",
"the",
"collidables",
"associated",
"with",
"this",
"picker",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBoundsPicker.java#L113-L125
|
161,819 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
|
GVRCameraRig.makeInstance
|
public static GVRCameraRig makeInstance(GVRContext gvrContext) {
final GVRCameraRig result = gvrContext.getApplication().getDelegate().makeCameraRig(gvrContext);
result.init(gvrContext);
return result;
}
|
java
|
public static GVRCameraRig makeInstance(GVRContext gvrContext) {
final GVRCameraRig result = gvrContext.getApplication().getDelegate().makeCameraRig(gvrContext);
result.init(gvrContext);
return result;
}
|
[
"public",
"static",
"GVRCameraRig",
"makeInstance",
"(",
"GVRContext",
"gvrContext",
")",
"{",
"final",
"GVRCameraRig",
"result",
"=",
"gvrContext",
".",
"getApplication",
"(",
")",
".",
"getDelegate",
"(",
")",
".",
"makeCameraRig",
"(",
"gvrContext",
")",
";",
"result",
".",
"init",
"(",
"gvrContext",
")",
";",
"return",
"result",
";",
"}"
] |
Constructs a camera rig with cameras attached. An owner scene object is automatically
created for the camera rig.
Do not try to change the owner object of the camera rig - not supported currently and will
lead to native crashes.
|
[
"Constructs",
"a",
"camera",
"rig",
"with",
"cameras",
"attached",
".",
"An",
"owner",
"scene",
"object",
"is",
"automatically",
"created",
"for",
"the",
"camera",
"rig",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L76-L80
|
161,820 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
|
GVRCameraRig.removeAllChildren
|
public void removeAllChildren() {
for (final GVRSceneObject so : headTransformObject.getChildren()) {
final boolean notCamera = (so != leftCameraObject && so != rightCameraObject && so != centerCameraObject);
if (notCamera) {
headTransformObject.removeChildObject(so);
}
}
}
|
java
|
public void removeAllChildren() {
for (final GVRSceneObject so : headTransformObject.getChildren()) {
final boolean notCamera = (so != leftCameraObject && so != rightCameraObject && so != centerCameraObject);
if (notCamera) {
headTransformObject.removeChildObject(so);
}
}
}
|
[
"public",
"void",
"removeAllChildren",
"(",
")",
"{",
"for",
"(",
"final",
"GVRSceneObject",
"so",
":",
"headTransformObject",
".",
"getChildren",
"(",
")",
")",
"{",
"final",
"boolean",
"notCamera",
"=",
"(",
"so",
"!=",
"leftCameraObject",
"&&",
"so",
"!=",
"rightCameraObject",
"&&",
"so",
"!=",
"centerCameraObject",
")",
";",
"if",
"(",
"notCamera",
")",
"{",
"headTransformObject",
".",
"removeChildObject",
"(",
"so",
")",
";",
"}",
"}",
"}"
] |
Remove all children that have been added to the owner object of this camera rig; except the
camera objects.
|
[
"Remove",
"all",
"children",
"that",
"have",
"been",
"added",
"to",
"the",
"owner",
"object",
"of",
"this",
"camera",
"rig",
";",
"except",
"the",
"camera",
"objects",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L516-L523
|
161,821 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
|
GVRCameraRig.setNearClippingDistance
|
public void setNearClippingDistance(float near) {
if(leftCamera instanceof GVRCameraClippingDistanceInterface &&
centerCamera instanceof GVRCameraClippingDistanceInterface &&
rightCamera instanceof GVRCameraClippingDistanceInterface) {
((GVRCameraClippingDistanceInterface)leftCamera).setNearClippingDistance(near);
centerCamera.setNearClippingDistance(near);
((GVRCameraClippingDistanceInterface)rightCamera).setNearClippingDistance(near);
}
}
|
java
|
public void setNearClippingDistance(float near) {
if(leftCamera instanceof GVRCameraClippingDistanceInterface &&
centerCamera instanceof GVRCameraClippingDistanceInterface &&
rightCamera instanceof GVRCameraClippingDistanceInterface) {
((GVRCameraClippingDistanceInterface)leftCamera).setNearClippingDistance(near);
centerCamera.setNearClippingDistance(near);
((GVRCameraClippingDistanceInterface)rightCamera).setNearClippingDistance(near);
}
}
|
[
"public",
"void",
"setNearClippingDistance",
"(",
"float",
"near",
")",
"{",
"if",
"(",
"leftCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
"&&",
"centerCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
"&&",
"rightCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
")",
"{",
"(",
"(",
"GVRCameraClippingDistanceInterface",
")",
"leftCamera",
")",
".",
"setNearClippingDistance",
"(",
"near",
")",
";",
"centerCamera",
".",
"setNearClippingDistance",
"(",
"near",
")",
";",
"(",
"(",
"GVRCameraClippingDistanceInterface",
")",
"rightCamera",
")",
".",
"setNearClippingDistance",
"(",
"near",
")",
";",
"}",
"}"
] |
Sets the distance from the origin to the near clipping plane for the
whole camera rig.
@param near
Distance to the near clipping plane.
|
[
"Sets",
"the",
"distance",
"from",
"the",
"origin",
"to",
"the",
"near",
"clipping",
"plane",
"for",
"the",
"whole",
"camera",
"rig",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L561-L569
|
161,822 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
|
GVRCameraRig.setFarClippingDistance
|
public void setFarClippingDistance(float far) {
if(leftCamera instanceof GVRCameraClippingDistanceInterface &&
centerCamera instanceof GVRCameraClippingDistanceInterface &&
rightCamera instanceof GVRCameraClippingDistanceInterface) {
((GVRCameraClippingDistanceInterface)leftCamera).setFarClippingDistance(far);
centerCamera.setFarClippingDistance(far);
((GVRCameraClippingDistanceInterface)rightCamera).setFarClippingDistance(far);
}
}
|
java
|
public void setFarClippingDistance(float far) {
if(leftCamera instanceof GVRCameraClippingDistanceInterface &&
centerCamera instanceof GVRCameraClippingDistanceInterface &&
rightCamera instanceof GVRCameraClippingDistanceInterface) {
((GVRCameraClippingDistanceInterface)leftCamera).setFarClippingDistance(far);
centerCamera.setFarClippingDistance(far);
((GVRCameraClippingDistanceInterface)rightCamera).setFarClippingDistance(far);
}
}
|
[
"public",
"void",
"setFarClippingDistance",
"(",
"float",
"far",
")",
"{",
"if",
"(",
"leftCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
"&&",
"centerCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
"&&",
"rightCamera",
"instanceof",
"GVRCameraClippingDistanceInterface",
")",
"{",
"(",
"(",
"GVRCameraClippingDistanceInterface",
")",
"leftCamera",
")",
".",
"setFarClippingDistance",
"(",
"far",
")",
";",
"centerCamera",
".",
"setFarClippingDistance",
"(",
"far",
")",
";",
"(",
"(",
"GVRCameraClippingDistanceInterface",
")",
"rightCamera",
")",
".",
"setFarClippingDistance",
"(",
"far",
")",
";",
"}",
"}"
] |
Sets the distance from the origin to the far clipping plane for the
whole camera rig.
@param far
Distance to the far clipping plane.
|
[
"Sets",
"the",
"distance",
"from",
"the",
"origin",
"to",
"the",
"far",
"clipping",
"plane",
"for",
"the",
"whole",
"camera",
"rig",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L589-L597
|
161,823 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java
|
TextFile.readTextFile
|
public static String readTextFile(File file) {
try {
return readTextFile(new FileReader(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
|
java
|
public static String readTextFile(File file) {
try {
return readTextFile(new FileReader(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
|
[
"public",
"static",
"String",
"readTextFile",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"return",
"readTextFile",
"(",
"new",
"FileReader",
"(",
"file",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Read a text file into a single string
@param file
The file to read
@return The contents, or null on error.
|
[
"Read",
"a",
"text",
"file",
"into",
"a",
"single",
"string"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java#L61-L68
|
161,824 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java
|
TextFile.readTextFile
|
public static String readTextFile(Context context, int resourceId) {
InputStream inputStream = context.getResources().openRawResource(
resourceId);
return readTextFile(inputStream);
}
|
java
|
public static String readTextFile(Context context, int resourceId) {
InputStream inputStream = context.getResources().openRawResource(
resourceId);
return readTextFile(inputStream);
}
|
[
"public",
"static",
"String",
"readTextFile",
"(",
"Context",
"context",
",",
"int",
"resourceId",
")",
"{",
"InputStream",
"inputStream",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"openRawResource",
"(",
"resourceId",
")",
";",
"return",
"readTextFile",
"(",
"inputStream",
")",
";",
"}"
] |
Read a text file resource into a single string
@param context
A non-null Android Context
@param resourceId
An Android resource id
@return The contents, or null on error.
|
[
"Read",
"a",
"text",
"file",
"resource",
"into",
"a",
"single",
"string"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java#L79-L83
|
161,825 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java
|
TextFile.readTextFile
|
public static String readTextFile(InputStream inputStream) {
InputStreamReader streamReader = new InputStreamReader(inputStream);
return readTextFile(streamReader);
}
|
java
|
public static String readTextFile(InputStream inputStream) {
InputStreamReader streamReader = new InputStreamReader(inputStream);
return readTextFile(streamReader);
}
|
[
"public",
"static",
"String",
"readTextFile",
"(",
"InputStream",
"inputStream",
")",
"{",
"InputStreamReader",
"streamReader",
"=",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
";",
"return",
"readTextFile",
"(",
"streamReader",
")",
";",
"}"
] |
Read a text stream into a single string.
@param inputStream
Stream containing text. Will be closed on exit.
@return The contents, or null on error.
|
[
"Read",
"a",
"text",
"stream",
"into",
"a",
"single",
"string",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/TextFile.java#L92-L95
|
161,826 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java
|
Threads.spawn
|
private static Future<?> spawn(final int priority, final Runnable threadProc) {
return threadPool.submit(new Runnable() {
@Override
public void run() {
Thread current = Thread.currentThread();
int defaultPriority = current.getPriority();
try {
current.setPriority(priority);
/*
* We yield to give the foreground process a chance to run.
* This also means that the new priority takes effect RIGHT
* AWAY, not after the next blocking call or quantum
* timeout.
*/
Thread.yield();
try {
threadProc.run();
} catch (Exception e) {
logException(TAG, e);
}
} finally {
current.setPriority(defaultPriority);
}
}
});
}
|
java
|
private static Future<?> spawn(final int priority, final Runnable threadProc) {
return threadPool.submit(new Runnable() {
@Override
public void run() {
Thread current = Thread.currentThread();
int defaultPriority = current.getPriority();
try {
current.setPriority(priority);
/*
* We yield to give the foreground process a chance to run.
* This also means that the new priority takes effect RIGHT
* AWAY, not after the next blocking call or quantum
* timeout.
*/
Thread.yield();
try {
threadProc.run();
} catch (Exception e) {
logException(TAG, e);
}
} finally {
current.setPriority(defaultPriority);
}
}
});
}
|
[
"private",
"static",
"Future",
"<",
"?",
">",
"spawn",
"(",
"final",
"int",
"priority",
",",
"final",
"Runnable",
"threadProc",
")",
"{",
"return",
"threadPool",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"Thread",
"current",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"int",
"defaultPriority",
"=",
"current",
".",
"getPriority",
"(",
")",
";",
"try",
"{",
"current",
".",
"setPriority",
"(",
"priority",
")",
";",
"/*\n * We yield to give the foreground process a chance to run.\n * This also means that the new priority takes effect RIGHT\n * AWAY, not after the next blocking call or quantum\n * timeout.\n */",
"Thread",
".",
"yield",
"(",
")",
";",
"try",
"{",
"threadProc",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logException",
"(",
"TAG",
",",
"e",
")",
";",
"}",
"}",
"finally",
"{",
"current",
".",
"setPriority",
"(",
"defaultPriority",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Execute a Runnable on a thread pool thread
@param priority
The thread priority. Be careful with this! <blockquote>
<b>Note:</b> Use Thread.MIN_PRIORITY..Thread.MAX_PRIORITY
(1..10), <b>not</b> the Process/Linux -20..19 range!
</blockquote>
@param threadProc
The code to run. It doesn't matter if this code never returns
- by using spawn (and, hence the thread pool) there is at
least a chance that you will be reusing a thread, thus saving
teardown/startup costs.
@return A Future<?> that lets you wait for thread completion, if
necessary
|
[
"Execute",
"a",
"Runnable",
"on",
"a",
"thread",
"pool",
"thread"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java#L88-L119
|
161,827 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java
|
Threads.assertUnlocked
|
public static void assertUnlocked(Object object, String name) {
if (RUNTIME_ASSERTIONS) {
if (Thread.holdsLock(object)) {
throw new RuntimeAssertion("Recursive lock of %s", name);
}
}
}
|
java
|
public static void assertUnlocked(Object object, String name) {
if (RUNTIME_ASSERTIONS) {
if (Thread.holdsLock(object)) {
throw new RuntimeAssertion("Recursive lock of %s", name);
}
}
}
|
[
"public",
"static",
"void",
"assertUnlocked",
"(",
"Object",
"object",
",",
"String",
"name",
")",
"{",
"if",
"(",
"RUNTIME_ASSERTIONS",
")",
"{",
"if",
"(",
"Thread",
".",
"holdsLock",
"(",
"object",
")",
")",
"{",
"throw",
"new",
"RuntimeAssertion",
"(",
"\"Recursive lock of %s\"",
",",
"name",
")",
";",
"}",
"}",
"}"
] |
This is an assertion method that can be used by a thread to confirm that
the thread isn't already holding lock for an object, before acquiring a
lock
@param object
object to test for lock
@param name
tag associated with the lock
|
[
"This",
"is",
"an",
"assertion",
"method",
"that",
"can",
"be",
"used",
"by",
"a",
"thread",
"to",
"confirm",
"that",
"the",
"thread",
"isn",
"t",
"already",
"holding",
"lock",
"for",
"an",
"object",
"before",
"acquiring",
"a",
"lock"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java#L703-L709
|
161,828 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.enableUniformSize
|
public void enableUniformSize(final boolean enable) {
if (mUniformSize != enable) {
mUniformSize = enable;
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
}
|
java
|
public void enableUniformSize(final boolean enable) {
if (mUniformSize != enable) {
mUniformSize = enable;
if (mContainer != null) {
mContainer.onLayoutChanged(this);
}
}
}
|
[
"public",
"void",
"enableUniformSize",
"(",
"final",
"boolean",
"enable",
")",
"{",
"if",
"(",
"mUniformSize",
"!=",
"enable",
")",
"{",
"mUniformSize",
"=",
"enable",
";",
"if",
"(",
"mContainer",
"!=",
"null",
")",
"{",
"mContainer",
".",
"onLayoutChanged",
"(",
"this",
")",
";",
"}",
"}",
"}"
] |
When set to true, all items in layout will be considered having the size of the largest child. If false, all items are
measured normally. Disabled by default.
@param enable true to measure children using the size of the largest child, false - otherwise.
|
[
"When",
"set",
"to",
"true",
"all",
"items",
"in",
"layout",
"will",
"be",
"considered",
"having",
"the",
"size",
"of",
"the",
"largest",
"child",
".",
"If",
"false",
"all",
"items",
"are",
"measured",
"normally",
".",
"Disabled",
"by",
"default",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L91-L98
|
161,829 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.setDividerPadding
|
public void setDividerPadding(float padding, final Axis axis) {
if (axis == getOrientationAxis()) {
super.setDividerPadding(padding, axis);
} else {
Log.w(TAG, "Cannot apply divider padding for wrong axis [%s], orientation = %s",
axis, getOrientation());
}
}
|
java
|
public void setDividerPadding(float padding, final Axis axis) {
if (axis == getOrientationAxis()) {
super.setDividerPadding(padding, axis);
} else {
Log.w(TAG, "Cannot apply divider padding for wrong axis [%s], orientation = %s",
axis, getOrientation());
}
}
|
[
"public",
"void",
"setDividerPadding",
"(",
"float",
"padding",
",",
"final",
"Axis",
"axis",
")",
"{",
"if",
"(",
"axis",
"==",
"getOrientationAxis",
"(",
")",
")",
"{",
"super",
".",
"setDividerPadding",
"(",
"padding",
",",
"axis",
")",
";",
"}",
"else",
"{",
"Log",
".",
"w",
"(",
"TAG",
",",
"\"Cannot apply divider padding for wrong axis [%s], orientation = %s\"",
",",
"axis",
",",
"getOrientation",
"(",
")",
")",
";",
"}",
"}"
] |
Sets divider padding for axis. If axis does not match the orientation, it has no effect.
@param padding
@param axis {@link Axis}
|
[
"Sets",
"divider",
"padding",
"for",
"axis",
".",
"If",
"axis",
"does",
"not",
"match",
"the",
"orientation",
"it",
"has",
"no",
"effect",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L137-L144
|
161,830 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.isValidLayout
|
protected boolean isValidLayout(Gravity gravity, Orientation orientation) {
boolean isValid = true;
switch (gravity) {
case TOP:
case BOTTOM:
isValid = (!isUnlimitedSize() && orientation == Orientation.VERTICAL);
break;
case LEFT:
case RIGHT:
isValid = (!isUnlimitedSize() && orientation == Orientation.HORIZONTAL);
break;
case FRONT:
case BACK:
isValid = (!isUnlimitedSize() && orientation == Orientation.STACK);
break;
case FILL:
isValid = !isUnlimitedSize();
break;
case CENTER:
break;
default:
isValid = false;
break;
}
if (!isValid) {
Log.w(TAG, "Cannot set the gravity %s and orientation %s - " +
"due to unlimited bounds or incompatibility", gravity, orientation);
}
return isValid;
}
|
java
|
protected boolean isValidLayout(Gravity gravity, Orientation orientation) {
boolean isValid = true;
switch (gravity) {
case TOP:
case BOTTOM:
isValid = (!isUnlimitedSize() && orientation == Orientation.VERTICAL);
break;
case LEFT:
case RIGHT:
isValid = (!isUnlimitedSize() && orientation == Orientation.HORIZONTAL);
break;
case FRONT:
case BACK:
isValid = (!isUnlimitedSize() && orientation == Orientation.STACK);
break;
case FILL:
isValid = !isUnlimitedSize();
break;
case CENTER:
break;
default:
isValid = false;
break;
}
if (!isValid) {
Log.w(TAG, "Cannot set the gravity %s and orientation %s - " +
"due to unlimited bounds or incompatibility", gravity, orientation);
}
return isValid;
}
|
[
"protected",
"boolean",
"isValidLayout",
"(",
"Gravity",
"gravity",
",",
"Orientation",
"orientation",
")",
"{",
"boolean",
"isValid",
"=",
"true",
";",
"switch",
"(",
"gravity",
")",
"{",
"case",
"TOP",
":",
"case",
"BOTTOM",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"VERTICAL",
")",
";",
"break",
";",
"case",
"LEFT",
":",
"case",
"RIGHT",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"HORIZONTAL",
")",
";",
"break",
";",
"case",
"FRONT",
":",
"case",
"BACK",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"STACK",
")",
";",
"break",
";",
"case",
"FILL",
":",
"isValid",
"=",
"!",
"isUnlimitedSize",
"(",
")",
";",
"break",
";",
"case",
"CENTER",
":",
"break",
";",
"default",
":",
"isValid",
"=",
"false",
";",
"break",
";",
"}",
"if",
"(",
"!",
"isValid",
")",
"{",
"Log",
".",
"w",
"(",
"TAG",
",",
"\"Cannot set the gravity %s and orientation %s - \"",
"+",
"\"due to unlimited bounds or incompatibility\"",
",",
"gravity",
",",
"orientation",
")",
";",
"}",
"return",
"isValid",
";",
"}"
] |
Check if the gravity and orientation are not in conflict one with other.
@param gravity
@param orientation
@return true if orientation and gravity can be applied together, false - otherwise
|
[
"Check",
"if",
"the",
"gravity",
"and",
"orientation",
"are",
"not",
"in",
"conflict",
"one",
"with",
"other",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L278-L308
|
161,831 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.getLayoutOffset
|
protected float getLayoutOffset() {
//final int offsetSign = getOffsetSign();
final float axisSize = getViewPortSize(getOrientationAxis());
float layoutOffset = - axisSize / 2;
Log.d(LAYOUT, TAG, "getLayoutOffset(): dimension: %5.2f, layoutOffset: %5.2f",
axisSize, layoutOffset);
return layoutOffset;
}
|
java
|
protected float getLayoutOffset() {
//final int offsetSign = getOffsetSign();
final float axisSize = getViewPortSize(getOrientationAxis());
float layoutOffset = - axisSize / 2;
Log.d(LAYOUT, TAG, "getLayoutOffset(): dimension: %5.2f, layoutOffset: %5.2f",
axisSize, layoutOffset);
return layoutOffset;
}
|
[
"protected",
"float",
"getLayoutOffset",
"(",
")",
"{",
"//final int offsetSign = getOffsetSign();",
"final",
"float",
"axisSize",
"=",
"getViewPortSize",
"(",
"getOrientationAxis",
"(",
")",
")",
";",
"float",
"layoutOffset",
"=",
"-",
"axisSize",
"/",
"2",
";",
"Log",
".",
"d",
"(",
"LAYOUT",
",",
"TAG",
",",
"\"getLayoutOffset(): dimension: %5.2f, layoutOffset: %5.2f\"",
",",
"axisSize",
",",
"layoutOffset",
")",
";",
"return",
"layoutOffset",
";",
"}"
] |
Calculate the layout offset
|
[
"Calculate",
"the",
"layout",
"offset"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L313-L321
|
161,832 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.getStartingOffset
|
protected float getStartingOffset(final float totalSize) {
final float axisSize = getViewPortSize(getOrientationAxis());
float startingOffset = 0;
switch (getGravityInternal()) {
case LEFT:
case FILL:
case TOP:
case FRONT:
startingOffset = -axisSize / 2;
break;
case RIGHT:
case BOTTOM:
case BACK:
startingOffset = (axisSize / 2 - totalSize);
break;
case CENTER:
startingOffset = -totalSize / 2;
break;
default:
Log.w(TAG, "Cannot calculate starting offset: " +
"gravity %s is not supported!", mGravity);
break;
}
Log.d(LAYOUT, TAG, "getStartingOffset(): totalSize: %5.4f, dimension: %5.4f, startingOffset: %5.4f",
totalSize, axisSize, startingOffset);
return startingOffset;
}
|
java
|
protected float getStartingOffset(final float totalSize) {
final float axisSize = getViewPortSize(getOrientationAxis());
float startingOffset = 0;
switch (getGravityInternal()) {
case LEFT:
case FILL:
case TOP:
case FRONT:
startingOffset = -axisSize / 2;
break;
case RIGHT:
case BOTTOM:
case BACK:
startingOffset = (axisSize / 2 - totalSize);
break;
case CENTER:
startingOffset = -totalSize / 2;
break;
default:
Log.w(TAG, "Cannot calculate starting offset: " +
"gravity %s is not supported!", mGravity);
break;
}
Log.d(LAYOUT, TAG, "getStartingOffset(): totalSize: %5.4f, dimension: %5.4f, startingOffset: %5.4f",
totalSize, axisSize, startingOffset);
return startingOffset;
}
|
[
"protected",
"float",
"getStartingOffset",
"(",
"final",
"float",
"totalSize",
")",
"{",
"final",
"float",
"axisSize",
"=",
"getViewPortSize",
"(",
"getOrientationAxis",
"(",
")",
")",
";",
"float",
"startingOffset",
"=",
"0",
";",
"switch",
"(",
"getGravityInternal",
"(",
")",
")",
"{",
"case",
"LEFT",
":",
"case",
"FILL",
":",
"case",
"TOP",
":",
"case",
"FRONT",
":",
"startingOffset",
"=",
"-",
"axisSize",
"/",
"2",
";",
"break",
";",
"case",
"RIGHT",
":",
"case",
"BOTTOM",
":",
"case",
"BACK",
":",
"startingOffset",
"=",
"(",
"axisSize",
"/",
"2",
"-",
"totalSize",
")",
";",
"break",
";",
"case",
"CENTER",
":",
"startingOffset",
"=",
"-",
"totalSize",
"/",
"2",
";",
"break",
";",
"default",
":",
"Log",
".",
"w",
"(",
"TAG",
",",
"\"Cannot calculate starting offset: \"",
"+",
"\"gravity %s is not supported!\"",
",",
"mGravity",
")",
";",
"break",
";",
"}",
"Log",
".",
"d",
"(",
"LAYOUT",
",",
"TAG",
",",
"\"getStartingOffset(): totalSize: %5.4f, dimension: %5.4f, startingOffset: %5.4f\"",
",",
"totalSize",
",",
"axisSize",
",",
"startingOffset",
")",
";",
"return",
"startingOffset",
";",
"}"
] |
Calculate the starting content offset based on the layout orientation and Gravity
@param totalSize total size occupied by the content
|
[
"Calculate",
"the",
"starting",
"content",
"offset",
"based",
"on",
"the",
"layout",
"orientation",
"and",
"Gravity"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L327-L357
|
161,833 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.changeDirection
|
@Override
protected boolean changeDirection(int currentIndex, int centerIndex, boolean inBounds) {
boolean changed = false;
if (getGravityInternal() == Gravity.CENTER &&
currentIndex <= centerIndex &&
currentIndex == 0 || !inBounds) {
changed = true;
}
return changed;
}
|
java
|
@Override
protected boolean changeDirection(int currentIndex, int centerIndex, boolean inBounds) {
boolean changed = false;
if (getGravityInternal() == Gravity.CENTER &&
currentIndex <= centerIndex &&
currentIndex == 0 || !inBounds) {
changed = true;
}
return changed;
}
|
[
"@",
"Override",
"protected",
"boolean",
"changeDirection",
"(",
"int",
"currentIndex",
",",
"int",
"centerIndex",
",",
"boolean",
"inBounds",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"if",
"(",
"getGravityInternal",
"(",
")",
"==",
"Gravity",
".",
"CENTER",
"&&",
"currentIndex",
"<=",
"centerIndex",
"&&",
"currentIndex",
"==",
"0",
"||",
"!",
"inBounds",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"return",
"changed",
";",
"}"
] |
<<<<<< measureUntilFull helper methods
|
[
"<<<<<<",
"measureUntilFull",
"helper",
"methods"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L475-L485
|
161,834 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.getCenterChild
|
protected int getCenterChild(CacheDataSet cache) {
if (cache.count() == 0)
return -1;
int id = cache.getId(0);
switch (getGravityInternal()) {
case TOP:
case LEFT:
case FRONT:
case FILL:
break;
case BOTTOM:
case RIGHT:
case BACK:
id = cache.getId(cache.count() - 1);
break;
case CENTER:
int i = cache.count() / 2;
while (i < cache.count() && i >= 0) {
id = cache.getId(i);
if (cache.getStartDataOffset(id) <= 0) {
if (cache.getEndDataOffset(id) >= 0) {
break;
} else {
i++;
}
} else {
i--;
}
}
break;
default:
break;
}
Log.d(LAYOUT, TAG, "getCenterChild = %d ", id);
return id;
}
|
java
|
protected int getCenterChild(CacheDataSet cache) {
if (cache.count() == 0)
return -1;
int id = cache.getId(0);
switch (getGravityInternal()) {
case TOP:
case LEFT:
case FRONT:
case FILL:
break;
case BOTTOM:
case RIGHT:
case BACK:
id = cache.getId(cache.count() - 1);
break;
case CENTER:
int i = cache.count() / 2;
while (i < cache.count() && i >= 0) {
id = cache.getId(i);
if (cache.getStartDataOffset(id) <= 0) {
if (cache.getEndDataOffset(id) >= 0) {
break;
} else {
i++;
}
} else {
i--;
}
}
break;
default:
break;
}
Log.d(LAYOUT, TAG, "getCenterChild = %d ", id);
return id;
}
|
[
"protected",
"int",
"getCenterChild",
"(",
"CacheDataSet",
"cache",
")",
"{",
"if",
"(",
"cache",
".",
"count",
"(",
")",
"==",
"0",
")",
"return",
"-",
"1",
";",
"int",
"id",
"=",
"cache",
".",
"getId",
"(",
"0",
")",
";",
"switch",
"(",
"getGravityInternal",
"(",
")",
")",
"{",
"case",
"TOP",
":",
"case",
"LEFT",
":",
"case",
"FRONT",
":",
"case",
"FILL",
":",
"break",
";",
"case",
"BOTTOM",
":",
"case",
"RIGHT",
":",
"case",
"BACK",
":",
"id",
"=",
"cache",
".",
"getId",
"(",
"cache",
".",
"count",
"(",
")",
"-",
"1",
")",
";",
"break",
";",
"case",
"CENTER",
":",
"int",
"i",
"=",
"cache",
".",
"count",
"(",
")",
"/",
"2",
";",
"while",
"(",
"i",
"<",
"cache",
".",
"count",
"(",
")",
"&&",
"i",
">=",
"0",
")",
"{",
"id",
"=",
"cache",
".",
"getId",
"(",
"i",
")",
";",
"if",
"(",
"cache",
".",
"getStartDataOffset",
"(",
"id",
")",
"<=",
"0",
")",
"{",
"if",
"(",
"cache",
".",
"getEndDataOffset",
"(",
"id",
")",
">=",
"0",
")",
"{",
"break",
";",
"}",
"else",
"{",
"i",
"++",
";",
"}",
"}",
"else",
"{",
"i",
"--",
";",
"}",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"Log",
".",
"d",
"(",
"LAYOUT",
",",
"TAG",
",",
"\"getCenterChild = %d \"",
",",
"id",
")",
";",
"return",
"id",
";",
"}"
] |
>>>>>> measureUntilFull helper methods
|
[
">>>>>>",
"measureUntilFull",
"helper",
"methods"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L520-L557
|
161,835 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.computeOffset
|
protected boolean computeOffset(final int dataIndex, CacheDataSet cache) {
float layoutOffset = getLayoutOffset();
int pos = cache.getPos(dataIndex);
float startDataOffset = Float.NaN;
float endDataOffset = Float.NaN;
if (pos > 0) {
int id = cache.getId(pos - 1);
if (id != -1) {
startDataOffset = cache.getEndDataOffset(id);
if (!Float.isNaN(startDataOffset)) {
endDataOffset = cache.setDataAfter(dataIndex, startDataOffset);
}
}
} else if (pos == 0) {
int id = cache.getId(pos + 1);
if (id != -1) {
endDataOffset = cache.getStartDataOffset(id);
if (!Float.isNaN(endDataOffset)) {
startDataOffset = cache.setDataBefore(dataIndex, endDataOffset);
}
} else {
startDataOffset = getStartingOffset((cache.getTotalSizeWithPadding()));
endDataOffset = cache.setDataAfter(dataIndex, startDataOffset);
}
}
Log.d(LAYOUT, TAG, "computeOffset [%d, %d]: startDataOffset = %f endDataOffset = %f",
dataIndex, pos, startDataOffset, endDataOffset);
boolean inBounds = !Float.isNaN(cache.getDataOffset(dataIndex)) &&
endDataOffset > layoutOffset &&
startDataOffset < -layoutOffset;
return inBounds;
}
|
java
|
protected boolean computeOffset(final int dataIndex, CacheDataSet cache) {
float layoutOffset = getLayoutOffset();
int pos = cache.getPos(dataIndex);
float startDataOffset = Float.NaN;
float endDataOffset = Float.NaN;
if (pos > 0) {
int id = cache.getId(pos - 1);
if (id != -1) {
startDataOffset = cache.getEndDataOffset(id);
if (!Float.isNaN(startDataOffset)) {
endDataOffset = cache.setDataAfter(dataIndex, startDataOffset);
}
}
} else if (pos == 0) {
int id = cache.getId(pos + 1);
if (id != -1) {
endDataOffset = cache.getStartDataOffset(id);
if (!Float.isNaN(endDataOffset)) {
startDataOffset = cache.setDataBefore(dataIndex, endDataOffset);
}
} else {
startDataOffset = getStartingOffset((cache.getTotalSizeWithPadding()));
endDataOffset = cache.setDataAfter(dataIndex, startDataOffset);
}
}
Log.d(LAYOUT, TAG, "computeOffset [%d, %d]: startDataOffset = %f endDataOffset = %f",
dataIndex, pos, startDataOffset, endDataOffset);
boolean inBounds = !Float.isNaN(cache.getDataOffset(dataIndex)) &&
endDataOffset > layoutOffset &&
startDataOffset < -layoutOffset;
return inBounds;
}
|
[
"protected",
"boolean",
"computeOffset",
"(",
"final",
"int",
"dataIndex",
",",
"CacheDataSet",
"cache",
")",
"{",
"float",
"layoutOffset",
"=",
"getLayoutOffset",
"(",
")",
";",
"int",
"pos",
"=",
"cache",
".",
"getPos",
"(",
"dataIndex",
")",
";",
"float",
"startDataOffset",
"=",
"Float",
".",
"NaN",
";",
"float",
"endDataOffset",
"=",
"Float",
".",
"NaN",
";",
"if",
"(",
"pos",
">",
"0",
")",
"{",
"int",
"id",
"=",
"cache",
".",
"getId",
"(",
"pos",
"-",
"1",
")",
";",
"if",
"(",
"id",
"!=",
"-",
"1",
")",
"{",
"startDataOffset",
"=",
"cache",
".",
"getEndDataOffset",
"(",
"id",
")",
";",
"if",
"(",
"!",
"Float",
".",
"isNaN",
"(",
"startDataOffset",
")",
")",
"{",
"endDataOffset",
"=",
"cache",
".",
"setDataAfter",
"(",
"dataIndex",
",",
"startDataOffset",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"pos",
"==",
"0",
")",
"{",
"int",
"id",
"=",
"cache",
".",
"getId",
"(",
"pos",
"+",
"1",
")",
";",
"if",
"(",
"id",
"!=",
"-",
"1",
")",
"{",
"endDataOffset",
"=",
"cache",
".",
"getStartDataOffset",
"(",
"id",
")",
";",
"if",
"(",
"!",
"Float",
".",
"isNaN",
"(",
"endDataOffset",
")",
")",
"{",
"startDataOffset",
"=",
"cache",
".",
"setDataBefore",
"(",
"dataIndex",
",",
"endDataOffset",
")",
";",
"}",
"}",
"else",
"{",
"startDataOffset",
"=",
"getStartingOffset",
"(",
"(",
"cache",
".",
"getTotalSizeWithPadding",
"(",
")",
")",
")",
";",
"endDataOffset",
"=",
"cache",
".",
"setDataAfter",
"(",
"dataIndex",
",",
"startDataOffset",
")",
";",
"}",
"}",
"Log",
".",
"d",
"(",
"LAYOUT",
",",
"TAG",
",",
"\"computeOffset [%d, %d]: startDataOffset = %f endDataOffset = %f\"",
",",
"dataIndex",
",",
"pos",
",",
"startDataOffset",
",",
"endDataOffset",
")",
";",
"boolean",
"inBounds",
"=",
"!",
"Float",
".",
"isNaN",
"(",
"cache",
".",
"getDataOffset",
"(",
"dataIndex",
")",
")",
"&&",
"endDataOffset",
">",
"layoutOffset",
"&&",
"startDataOffset",
"<",
"-",
"layoutOffset",
";",
"return",
"inBounds",
";",
"}"
] |
Compute the offset for the item in the layout cache
@return true if the item fits the container, false otherwise
|
[
"Compute",
"the",
"offset",
"for",
"the",
"item",
"in",
"the",
"layout",
"cache"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L611-L645
|
161,836 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.computeOffset
|
protected boolean computeOffset(CacheDataSet cache) {
// offset computation: update offset for all items in the cache
float startDataOffset = getStartingOffset((cache.getTotalSizeWithPadding()));
float layoutOffset = getLayoutOffset();
boolean inBounds = startDataOffset < -layoutOffset;
for (int pos = 0; pos < cache.count(); ++pos) {
int id = cache.getId(pos);
if (id != -1) {
float endDataOffset = cache.setDataAfter(id, startDataOffset);
inBounds = inBounds &&
endDataOffset > layoutOffset &&
startDataOffset < -layoutOffset;
startDataOffset = endDataOffset;
Log.d(LAYOUT, TAG, "computeOffset [%d] = %f" , id, cache.getDataOffset(id));
}
}
return inBounds;
}
|
java
|
protected boolean computeOffset(CacheDataSet cache) {
// offset computation: update offset for all items in the cache
float startDataOffset = getStartingOffset((cache.getTotalSizeWithPadding()));
float layoutOffset = getLayoutOffset();
boolean inBounds = startDataOffset < -layoutOffset;
for (int pos = 0; pos < cache.count(); ++pos) {
int id = cache.getId(pos);
if (id != -1) {
float endDataOffset = cache.setDataAfter(id, startDataOffset);
inBounds = inBounds &&
endDataOffset > layoutOffset &&
startDataOffset < -layoutOffset;
startDataOffset = endDataOffset;
Log.d(LAYOUT, TAG, "computeOffset [%d] = %f" , id, cache.getDataOffset(id));
}
}
return inBounds;
}
|
[
"protected",
"boolean",
"computeOffset",
"(",
"CacheDataSet",
"cache",
")",
"{",
"// offset computation: update offset for all items in the cache",
"float",
"startDataOffset",
"=",
"getStartingOffset",
"(",
"(",
"cache",
".",
"getTotalSizeWithPadding",
"(",
")",
")",
")",
";",
"float",
"layoutOffset",
"=",
"getLayoutOffset",
"(",
")",
";",
"boolean",
"inBounds",
"=",
"startDataOffset",
"<",
"-",
"layoutOffset",
";",
"for",
"(",
"int",
"pos",
"=",
"0",
";",
"pos",
"<",
"cache",
".",
"count",
"(",
")",
";",
"++",
"pos",
")",
"{",
"int",
"id",
"=",
"cache",
".",
"getId",
"(",
"pos",
")",
";",
"if",
"(",
"id",
"!=",
"-",
"1",
")",
"{",
"float",
"endDataOffset",
"=",
"cache",
".",
"setDataAfter",
"(",
"id",
",",
"startDataOffset",
")",
";",
"inBounds",
"=",
"inBounds",
"&&",
"endDataOffset",
">",
"layoutOffset",
"&&",
"startDataOffset",
"<",
"-",
"layoutOffset",
";",
"startDataOffset",
"=",
"endDataOffset",
";",
"Log",
".",
"d",
"(",
"LAYOUT",
",",
"TAG",
",",
"\"computeOffset [%d] = %f\"",
",",
"id",
",",
"cache",
".",
"getDataOffset",
"(",
"id",
")",
")",
";",
"}",
"}",
"return",
"inBounds",
";",
"}"
] |
Compute the offset for the item in the layout based on the offsets of neighbors
in the layout. The other offsets are not patched. If neighbors offsets have not
been computed the offset of the item will not be set.
@return true if the item fits the container, false otherwise
|
[
"Compute",
"the",
"offset",
"for",
"the",
"item",
"in",
"the",
"layout",
"based",
"on",
"the",
"offsets",
"of",
"neighbors",
"in",
"the",
"layout",
".",
"The",
"other",
"offsets",
"are",
"not",
"patched",
".",
"If",
"neighbors",
"offsets",
"have",
"not",
"been",
"computed",
"the",
"offset",
"of",
"the",
"item",
"will",
"not",
"be",
"set",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L653-L673
|
161,837 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java
|
LinearLayout.computeUniformPadding
|
protected float computeUniformPadding(final CacheDataSet cache) {
float axisSize = getViewPortSize(getOrientationAxis());
float totalPadding = axisSize - cache.getTotalSize();
float uniformPadding = totalPadding > 0 && cache.count() > 1 ?
totalPadding / (cache.count() - 1) : 0;
return uniformPadding;
}
|
java
|
protected float computeUniformPadding(final CacheDataSet cache) {
float axisSize = getViewPortSize(getOrientationAxis());
float totalPadding = axisSize - cache.getTotalSize();
float uniformPadding = totalPadding > 0 && cache.count() > 1 ?
totalPadding / (cache.count() - 1) : 0;
return uniformPadding;
}
|
[
"protected",
"float",
"computeUniformPadding",
"(",
"final",
"CacheDataSet",
"cache",
")",
"{",
"float",
"axisSize",
"=",
"getViewPortSize",
"(",
"getOrientationAxis",
"(",
")",
")",
";",
"float",
"totalPadding",
"=",
"axisSize",
"-",
"cache",
".",
"getTotalSize",
"(",
")",
";",
"float",
"uniformPadding",
"=",
"totalPadding",
">",
"0",
"&&",
"cache",
".",
"count",
"(",
")",
">",
"1",
"?",
"totalPadding",
"/",
"(",
"cache",
".",
"count",
"(",
")",
"-",
"1",
")",
":",
"0",
";",
"return",
"uniformPadding",
";",
"}"
] |
Compute the proportional padding for all items in the cache
@param cache Cache data set
@return the uniform padding amount
|
[
"Compute",
"the",
"proportional",
"padding",
"for",
"all",
"items",
"in",
"the",
"cache"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L695-L701
|
161,838 |
Samsung/GearVRf
|
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/Text.java
|
Text.getString
|
public String[] getString() {
String[] valueDestination = new String[ string.size() ];
this.string.getValue(valueDestination);
return valueDestination;
}
|
java
|
public String[] getString() {
String[] valueDestination = new String[ string.size() ];
this.string.getValue(valueDestination);
return valueDestination;
}
|
[
"public",
"String",
"[",
"]",
"getString",
"(",
")",
"{",
"String",
"[",
"]",
"valueDestination",
"=",
"new",
"String",
"[",
"string",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"string",
".",
"getValue",
"(",
"valueDestination",
")",
";",
"return",
"valueDestination",
";",
"}"
] |
Provide array of String results from inputOutput MFString field named string.
@return value of string field
|
[
"Provide",
"array",
"of",
"String",
"results",
"from",
"inputOutput",
"MFString",
"field",
"named",
"string",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/Text.java#L109-L113
|
161,839 |
Samsung/GearVRf
|
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/Text.java
|
Text.setString
|
public void setString(String[] newValue) {
if ( newValue != null ) {
this.string.setValue(newValue.length, newValue);
}
}
|
java
|
public void setString(String[] newValue) {
if ( newValue != null ) {
this.string.setValue(newValue.length, newValue);
}
}
|
[
"public",
"void",
"setString",
"(",
"String",
"[",
"]",
"newValue",
")",
"{",
"if",
"(",
"newValue",
"!=",
"null",
")",
"{",
"this",
".",
"string",
".",
"setValue",
"(",
"newValue",
".",
"length",
",",
"newValue",
")",
";",
"}",
"}"
] |
Assign float value within allowed range of [0,infinity) to initializeOnly SFFloat field named spacing.
@param newValue
|
[
"Assign",
"float",
"value",
"within",
"allowed",
"range",
"of",
"[",
"0",
"infinity",
")",
"to",
"initializeOnly",
"SFFloat",
"field",
"named",
"spacing",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/node/Text.java#L146-L150
|
161,840 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java
|
GVRAnimator.findAnimation
|
public int findAnimation(GVRAnimation findme)
{
int index = 0;
for (GVRAnimation anim : mAnimations)
{
if (anim == findme)
{
return index;
}
++index;
}
return -1;
}
|
java
|
public int findAnimation(GVRAnimation findme)
{
int index = 0;
for (GVRAnimation anim : mAnimations)
{
if (anim == findme)
{
return index;
}
++index;
}
return -1;
}
|
[
"public",
"int",
"findAnimation",
"(",
"GVRAnimation",
"findme",
")",
"{",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"GVRAnimation",
"anim",
":",
"mAnimations",
")",
"{",
"if",
"(",
"anim",
"==",
"findme",
")",
"{",
"return",
"index",
";",
"}",
"++",
"index",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Find the index of this animation if it is in this animator.
@param findme {@link GVRAnimation} to find.
@returns 0 based index of animation or -1 if not found
@see GVRAnimator#addAnimation(GVRAnimation)
|
[
"Find",
"the",
"index",
"of",
"this",
"animation",
"if",
"it",
"is",
"in",
"this",
"animator",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java#L175-L187
|
161,841 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java
|
GVRAnimator.setDuration
|
public void setDuration(float start, float end)
{
for (GVRAnimation anim : mAnimations)
{
anim.setDuration(start,end);
}
}
|
java
|
public void setDuration(float start, float end)
{
for (GVRAnimation anim : mAnimations)
{
anim.setDuration(start,end);
}
}
|
[
"public",
"void",
"setDuration",
"(",
"float",
"start",
",",
"float",
"end",
")",
"{",
"for",
"(",
"GVRAnimation",
"anim",
":",
"mAnimations",
")",
"{",
"anim",
".",
"setDuration",
"(",
"start",
",",
"end",
")",
";",
"}",
"}"
] |
Sets the duration for the animations in this animator.
@param start the animation will start playing from the specified time
@param end the animation will stop playing at the specified time
@see GVRAnimation#setDuration(float, float)
|
[
"Sets",
"the",
"duration",
"for",
"the",
"animations",
"in",
"this",
"animator",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java#L258-L264
|
161,842 |
Samsung/GearVRf
|
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/JSAdapter.java
|
JSAdapter.init
|
public static void init(Context cx, Scriptable scope, boolean sealed)
throws RhinoException {
JSAdapter obj = new JSAdapter(cx.newObject(scope));
obj.setParentScope(scope);
obj.setPrototype(getFunctionPrototype(scope));
obj.isPrototype = true;
ScriptableObject.defineProperty(scope, "JSAdapter", obj,
ScriptableObject.DONTENUM);
}
|
java
|
public static void init(Context cx, Scriptable scope, boolean sealed)
throws RhinoException {
JSAdapter obj = new JSAdapter(cx.newObject(scope));
obj.setParentScope(scope);
obj.setPrototype(getFunctionPrototype(scope));
obj.isPrototype = true;
ScriptableObject.defineProperty(scope, "JSAdapter", obj,
ScriptableObject.DONTENUM);
}
|
[
"public",
"static",
"void",
"init",
"(",
"Context",
"cx",
",",
"Scriptable",
"scope",
",",
"boolean",
"sealed",
")",
"throws",
"RhinoException",
"{",
"JSAdapter",
"obj",
"=",
"new",
"JSAdapter",
"(",
"cx",
".",
"newObject",
"(",
"scope",
")",
")",
";",
"obj",
".",
"setParentScope",
"(",
"scope",
")",
";",
"obj",
".",
"setPrototype",
"(",
"getFunctionPrototype",
"(",
"scope",
")",
")",
";",
"obj",
".",
"isPrototype",
"=",
"true",
";",
"ScriptableObject",
".",
"defineProperty",
"(",
"scope",
",",
"\"JSAdapter\"",
",",
"obj",
",",
"ScriptableObject",
".",
"DONTENUM",
")",
";",
"}"
] |
initializer to setup JSAdapter prototype in the given scope
|
[
"initializer",
"to",
"setup",
"JSAdapter",
"prototype",
"in",
"the",
"given",
"scope"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/JSAdapter.java#L78-L86
|
161,843 |
Samsung/GearVRf
|
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/JSAdapter.java
|
JSAdapter.mapToId
|
private Object mapToId(Object tmp) {
if (tmp instanceof Double) {
return new Integer(((Double)tmp).intValue());
} else {
return Context.toString(tmp);
}
}
|
java
|
private Object mapToId(Object tmp) {
if (tmp instanceof Double) {
return new Integer(((Double)tmp).intValue());
} else {
return Context.toString(tmp);
}
}
|
[
"private",
"Object",
"mapToId",
"(",
"Object",
"tmp",
")",
"{",
"if",
"(",
"tmp",
"instanceof",
"Double",
")",
"{",
"return",
"new",
"Integer",
"(",
"(",
"(",
"Double",
")",
"tmp",
")",
".",
"intValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"Context",
".",
"toString",
"(",
"tmp",
")",
";",
"}",
"}"
] |
map a property id. Property id can only be an Integer or String
|
[
"map",
"a",
"property",
"id",
".",
"Property",
"id",
"can",
"only",
"be",
"an",
"Integer",
"or",
"String"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/JSAdapter.java#L299-L305
|
161,844 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/adapter/ListDataSet.java
|
ListDataSet.setList
|
public void setList(List<T> list) {
if (list != mList) {
mList = list;
if (mList == null) {
notifyInvalidated();
} else {
notifyChanged();
}
}
}
|
java
|
public void setList(List<T> list) {
if (list != mList) {
mList = list;
if (mList == null) {
notifyInvalidated();
} else {
notifyChanged();
}
}
}
|
[
"public",
"void",
"setList",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"if",
"(",
"list",
"!=",
"mList",
")",
"{",
"mList",
"=",
"list",
";",
"if",
"(",
"mList",
"==",
"null",
")",
"{",
"notifyInvalidated",
"(",
")",
";",
"}",
"else",
"{",
"notifyChanged",
"(",
")",
";",
"}",
"}",
"}"
] |
Set new list data set
@param list new data set
|
[
"Set",
"new",
"list",
"data",
"set"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/adapter/ListDataSet.java#L46-L55
|
161,845 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRCompressedTextureLoader.java
|
GVRCompressedTextureLoader.register
|
public void register() {
synchronized (loaders) {
loaders.add(this);
maximumHeaderLength = 0;
for (GVRCompressedTextureLoader loader : loaders) {
int headerLength = loader.headerLength();
if (headerLength > maximumHeaderLength) {
maximumHeaderLength = headerLength;
}
}
}
}
|
java
|
public void register() {
synchronized (loaders) {
loaders.add(this);
maximumHeaderLength = 0;
for (GVRCompressedTextureLoader loader : loaders) {
int headerLength = loader.headerLength();
if (headerLength > maximumHeaderLength) {
maximumHeaderLength = headerLength;
}
}
}
}
|
[
"public",
"void",
"register",
"(",
")",
"{",
"synchronized",
"(",
"loaders",
")",
"{",
"loaders",
".",
"add",
"(",
"this",
")",
";",
"maximumHeaderLength",
"=",
"0",
";",
"for",
"(",
"GVRCompressedTextureLoader",
"loader",
":",
"loaders",
")",
"{",
"int",
"headerLength",
"=",
"loader",
".",
"headerLength",
"(",
")",
";",
"if",
"(",
"headerLength",
">",
"maximumHeaderLength",
")",
"{",
"maximumHeaderLength",
"=",
"headerLength",
";",
"}",
"}",
"}",
"}"
] |
Register a loader with the 'sniffer'.
'Factory loaders' are pre-registered. To load a format we don't support,
create a {@link GVRCompressedTextureLoader} descendant. Then, before
trying to load any files in that format, create an instance and call
{@link #register()}:
<pre>
new MyCompressedFormat().register();
</pre>
|
[
"Register",
"a",
"loader",
"with",
"the",
"sniffer",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRCompressedTextureLoader.java#L182-L194
|
161,846 |
Samsung/GearVRf
|
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java
|
WidgetFactory.loadModel
|
public static GVRSceneObject loadModel(final GVRContext gvrContext,
final String modelFile) throws IOException {
return loadModel(gvrContext, modelFile, new HashMap<String, Integer>());
}
|
java
|
public static GVRSceneObject loadModel(final GVRContext gvrContext,
final String modelFile) throws IOException {
return loadModel(gvrContext, modelFile, new HashMap<String, Integer>());
}
|
[
"public",
"static",
"GVRSceneObject",
"loadModel",
"(",
"final",
"GVRContext",
"gvrContext",
",",
"final",
"String",
"modelFile",
")",
"throws",
"IOException",
"{",
"return",
"loadModel",
"(",
"gvrContext",
",",
"modelFile",
",",
"new",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
")",
";",
"}"
] |
Load model from file
@param gvrContext Valid {@link GVRContext} instance
@param modelFile Path to the model's file, relative to the {@code assets} directory
@return root object The root {@link GVRSceneObject} of the model
@throws IOException If reading the model file fails
|
[
"Load",
"model",
"from",
"file"
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L254-L257
|
161,847 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
|
AiMesh.getFaceNumIndices
|
public int getFaceNumIndices(int face) {
if (null == m_faceOffsets) {
if (face >= m_numFaces || face < 0) {
throw new IndexOutOfBoundsException("Index: " + face +
", Size: " + m_numFaces);
}
return 3;
}
else {
/*
* no need to perform bound checks here as the array access will
* throw IndexOutOfBoundsExceptions if the index is invalid
*/
if (face == m_numFaces - 1) {
return m_faces.capacity() / 4 - m_faceOffsets.getInt(face * 4);
}
return m_faceOffsets.getInt((face + 1) * 4) -
m_faceOffsets.getInt(face * 4);
}
}
|
java
|
public int getFaceNumIndices(int face) {
if (null == m_faceOffsets) {
if (face >= m_numFaces || face < 0) {
throw new IndexOutOfBoundsException("Index: " + face +
", Size: " + m_numFaces);
}
return 3;
}
else {
/*
* no need to perform bound checks here as the array access will
* throw IndexOutOfBoundsExceptions if the index is invalid
*/
if (face == m_numFaces - 1) {
return m_faces.capacity() / 4 - m_faceOffsets.getInt(face * 4);
}
return m_faceOffsets.getInt((face + 1) * 4) -
m_faceOffsets.getInt(face * 4);
}
}
|
[
"public",
"int",
"getFaceNumIndices",
"(",
"int",
"face",
")",
"{",
"if",
"(",
"null",
"==",
"m_faceOffsets",
")",
"{",
"if",
"(",
"face",
">=",
"m_numFaces",
"||",
"face",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"face",
"+",
"\", Size: \"",
"+",
"m_numFaces",
")",
";",
"}",
"return",
"3",
";",
"}",
"else",
"{",
"/* \n * no need to perform bound checks here as the array access will\n * throw IndexOutOfBoundsExceptions if the index is invalid\n */",
"if",
"(",
"face",
"==",
"m_numFaces",
"-",
"1",
")",
"{",
"return",
"m_faces",
".",
"capacity",
"(",
")",
"/",
"4",
"-",
"m_faceOffsets",
".",
"getInt",
"(",
"face",
"*",
"4",
")",
";",
"}",
"return",
"m_faceOffsets",
".",
"getInt",
"(",
"(",
"face",
"+",
"1",
")",
"*",
"4",
")",
"-",
"m_faceOffsets",
".",
"getInt",
"(",
"face",
"*",
"4",
")",
";",
"}",
"}"
] |
Returns the number of vertex indices for a single face.
@param face the face
@return the number of indices
|
[
"Returns",
"the",
"number",
"of",
"vertex",
"indices",
"for",
"a",
"single",
"face",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L346-L367
|
161,848 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
|
AiMesh.getPositionX
|
public float getPositionX(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat(vertex * 3 * SIZEOF_FLOAT);
}
|
java
|
public float getPositionX(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat(vertex * 3 * SIZEOF_FLOAT);
}
|
[
"public",
"float",
"getPositionX",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasPositions",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no positions\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"return",
"m_vertices",
".",
"getFloat",
"(",
"vertex",
"*",
"3",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
Returns the x-coordinate of a vertex position.
@param vertex the vertex index
@return the x coordinate
|
[
"Returns",
"the",
"x",
"-",
"coordinate",
"of",
"a",
"vertex",
"position",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L628-L636
|
161,849 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
|
AiMesh.getPositionY
|
public float getPositionY(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
}
|
java
|
public float getPositionY(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat((vertex * 3 + 1) * SIZEOF_FLOAT);
}
|
[
"public",
"float",
"getPositionY",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasPositions",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no positions\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"return",
"m_vertices",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"1",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
Returns the y-coordinate of a vertex position.
@param vertex the vertex index
@return the y coordinate
|
[
"Returns",
"the",
"y",
"-",
"coordinate",
"of",
"a",
"vertex",
"position",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L645-L653
|
161,850 |
Samsung/GearVRf
|
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
|
AiMesh.getPositionZ
|
public float getPositionZ(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
}
|
java
|
public float getPositionZ(int vertex) {
if (!hasPositions()) {
throw new IllegalStateException("mesh has no positions");
}
checkVertexIndexBounds(vertex);
return m_vertices.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);
}
|
[
"public",
"float",
"getPositionZ",
"(",
"int",
"vertex",
")",
"{",
"if",
"(",
"!",
"hasPositions",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no positions\"",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"return",
"m_vertices",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"2",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
Returns the z-coordinate of a vertex position.
@param vertex the vertex index
@return the z coordinate
|
[
"Returns",
"the",
"z",
"-",
"coordinate",
"of",
"a",
"vertex",
"position",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L661-L669
|
161,851 |
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",
")",
";",
"return",
"m_normals",
".",
"getFloat",
"(",
"vertex",
"*",
"3",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,852 |
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",
")",
";",
"return",
"m_normals",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"1",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,853 |
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",
")",
";",
"return",
"m_normals",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"2",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,854 |
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",
")",
";",
"return",
"m_tangents",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"1",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,855 |
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",
")",
";",
"return",
"m_bitangents",
".",
"getFloat",
"(",
"(",
"vertex",
"*",
"3",
"+",
"1",
")",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,856 |
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",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"/* bound checks for colorset are done by java for us */",
"return",
"m_colorsets",
"[",
"colorset",
"]",
".",
"getFloat",
"(",
"vertex",
"*",
"4",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,857 |
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",
")",
";",
"}",
"checkVertexIndexBounds",
"(",
"vertex",
")",
";",
"/* bound checks for coords are done by java for us */",
"return",
"m_texcoords",
"[",
"coords",
"]",
".",
"getFloat",
"(",
"vertex",
"*",
"m_numUVComponents",
"[",
"coords",
"]",
"*",
"SIZEOF_FLOAT",
")",
";",
"}"
] |
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
|
161,858 |
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",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"}",
"else",
"{",
"keyName",
"=",
"key",
".",
"name",
"(",
")",
";",
"}",
"return",
"getProperty",
"(",
"keyName",
")",
";",
"}"
] |
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
|
161,859 |
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",
".",
"printStackTrace",
"(",
")",
";",
"Log",
".",
"e",
"(",
"TAG",
",",
"e",
",",
"\"toJSON()\"",
")",
";",
"throw",
"new",
"RuntimeAssertion",
"(",
"\"NodeEntry.toJSON() failed for '%s'\"",
",",
"this",
")",
";",
"}",
"}"
] |
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
|
161,860 |
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",
")",
"{",
"GVRCameraRig",
"cameraRig",
"=",
"null",
";",
"if",
"(",
"mMainScene",
"!=",
"null",
")",
"{",
"cameraRig",
"=",
"mMainScene",
".",
"getMainCameraRig",
"(",
")",
";",
"}",
"if",
"(",
"cameraRig",
"!=",
"null",
")",
"{",
"cameraRig",
".",
"setRotationSensorData",
"(",
"timeStamp",
",",
"rotationW",
",",
"rotationX",
",",
"rotationY",
",",
"rotationZ",
",",
"gyroX",
",",
"gyroY",
",",
"gyroZ",
")",
";",
"updateSensoredScene",
"(",
")",
";",
"}",
"}"
] |
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
|
161,861 |
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",
"=",
"s",
";",
"streamState",
"=",
"StreamStates",
".",
"OPEN",
";",
"}"
] |
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",
"resource",
"already",
"has",
"an",
"open",
"stream",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAndroidResource.java#L324-L332
|
161,862 |
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",
"(",
")",
";",
"stream",
"=",
"null",
";",
"}",
"streamState",
"=",
"StreamStates",
".",
"CLOSED",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
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
|
161,863 |
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",
"filePath",
";",
"case",
"NETWORK",
":",
"return",
"url",
".",
"getPath",
"(",
")",
";",
"case",
"INPUT_STREAM",
":",
"return",
"inputStreamName",
";",
"default",
":",
"return",
"null",
";",
"}",
"}"
] |
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
|
161,864 |
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",
")",
";",
"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",
";",
"}",
"}"
] |
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
|
161,865 |
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_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",
")",
";",
"}"
] |
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
|
161,866 |
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",
"(",
"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",
")",
";",
"}"
] |
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
|
161,867 |
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",
"(",
")",
";",
"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",
")",
";",
"}",
"}"
] |
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
|
161,868 |
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",
")",
";",
"return",
";",
"}",
"}"
] |
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
|
161,869 |
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",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
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
|
161,870 |
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",
"(",
"\"Animation index out of bounds\"",
")",
";",
"}",
"GVRAnimator",
"anim",
"=",
"mAnimations",
".",
"get",
"(",
"animIndex",
")",
";",
"start",
"(",
"anim",
")",
";",
"return",
"anim",
";",
"}"
] |
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
|
161,871 |
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",
"IndexOutOfBoundsException",
"(",
"\"Animation index out of bounds\"",
")",
";",
"}",
"GVRAnimator",
"anim",
"=",
"mAnimations",
".",
"get",
"(",
"animIndex",
")",
";",
"anim",
".",
"animate",
"(",
"timeInSec",
")",
";",
"return",
"anim",
";",
"}"
] |
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
|
161,872 |
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",
"=",
"mAnimQueue",
".",
"get",
"(",
"0",
")",
";",
"mAnimQueue",
".",
"clear",
"(",
")",
";",
"animator",
".",
"stop",
"(",
")",
";",
"}",
"}",
"}"
] |
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
|
161,873 |
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",
".",
"drawable",
".",
"__default_splash_screen__",
")",
";",
"GVRTexture",
"tex",
"=",
"new",
"GVRTexture",
"(",
"gvrContext",
")",
";",
"tex",
".",
"setImage",
"(",
"new",
"GVRBitmapImage",
"(",
"gvrContext",
",",
"bitmap",
")",
")",
";",
"return",
"tex",
";",
"}"
] |
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
|
161,874 |
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
|
161,875 |
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
|
161,876 |
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",
"(",
")",
".",
"removeChildObject",
"(",
"owner",
")",
";",
"}",
"}"
] |
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
|
161,877 |
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",
"(",
")",
"{",
"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",
"(",
")",
";",
"}"
] |
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
|
161,878 |
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 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",
";",
"}"
] |
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
|
161,879 |
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
|
161,880 |
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",
")",
"{",
"return",
"(",
"V3",
")",
"m_up",
";",
"}"
] |
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
|
161,881 |
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_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",
")",
";",
"}"
] |
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
|
161,882 |
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",
"(",
"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",
")",
";",
"}",
"}",
"}"
] |
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
|
161,883 |
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",
")",
";",
"mContext",
".",
"getApplication",
"(",
")",
".",
"getEventReceiver",
"(",
")",
".",
"addListener",
"(",
"this",
")",
";",
"mAudioEngine",
".",
"resume",
"(",
")",
";",
"}",
"else",
"{",
"mContext",
".",
"unregisterDrawFrameListener",
"(",
"this",
")",
";",
"mContext",
".",
"getApplication",
"(",
")",
".",
"getEventReceiver",
"(",
")",
".",
"removeListener",
"(",
"this",
")",
";",
"mAudioEngine",
".",
"pause",
"(",
")",
";",
"}",
"}"
] |
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
|
161,884 |
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",
")",
";",
"mAudioSources",
".",
"add",
"(",
"audioSource",
")",
";",
"}",
"}",
"}"
] |
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
|
161,885 |
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
|
161,886 |
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
|
161,887 |
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",
"=",
"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",
";",
"}"
] |
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",
"pair",
"passed",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L86-L104
|
161,888 |
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",
")",
";",
"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",
";",
"}"
] |
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",
"speed",
"range",
"."
] |
05034d465a7b0a494fabb9e9f2971ac19392f32d
|
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L113-L142
|
161,889 |
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",
".",
"setData",
"(",
"Uri",
".",
"fromParts",
"(",
"\"package\"",
",",
"activity",
".",
"getPackageName",
"(",
")",
",",
"null",
")",
")",
";",
"activity",
".",
"startActivity",
"(",
"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
|
161,890 |
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",
"&&",
"!",
"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",
")",
";",
"}",
"}",
"}"
] |
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
|
161,891 |
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",
"!=",
"null",
")",
"{",
"mContainer",
".",
"onLayoutChanged",
"(",
"this",
")",
";",
"}",
"}"
] |
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
|
161,892 |
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",
"(",
")",
")",
";",
"mMeasuredChildren",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
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
|
161,893 |
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",
")",
";",
"mMeasuredChildren",
".",
"remove",
"(",
"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
|
161,894 |
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",
")",
"{",
"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",
";",
"}"
] |
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
|
161,895 |
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",
"(",
"axis",
")",
";",
"}",
"else",
"if",
"(",
"mContainer",
"!=",
"null",
")",
"{",
"size",
"=",
"getSizeImpl",
"(",
"axis",
")",
";",
"}",
"return",
"size",
";",
"}"
] |
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
|
161,896 |
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",
"(",
"padding",
",",
"axis",
")",
";",
"if",
"(",
"mContainer",
"!=",
"null",
")",
"{",
"mContainer",
".",
"onLayoutChanged",
"(",
"this",
")",
";",
"}",
"}",
"}"
] |
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
|
161,897 |
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",
")",
";",
"if",
"(",
"mContainer",
"!=",
"null",
")",
"{",
"mContainer",
".",
"onLayoutChanged",
"(",
"this",
")",
";",
"}",
"}",
"}"
] |
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
|
161,898 |
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",
")",
";",
"Widget",
"widget",
"=",
"mContainer",
".",
"get",
"(",
"dataIndex",
")",
";",
"if",
"(",
"widget",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"mMeasuredChildren",
")",
"{",
"mMeasuredChildren",
".",
"add",
"(",
"dataIndex",
")",
";",
"}",
"}",
"return",
"widget",
";",
"}"
] |
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
|
161,899 |
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",
")",
"{",
"if",
"(",
"!",
"isChildMeasured",
"(",
"i",
")",
")",
"{",
"Widget",
"child",
"=",
"measureChild",
"(",
"i",
",",
"false",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"if",
"(",
"measuredChildren",
"!=",
"null",
")",
"{",
"measuredChildren",
".",
"add",
"(",
"child",
")",
";",
"}",
"changed",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"changed",
")",
"{",
"postMeasurement",
"(",
")",
";",
"}",
"return",
"changed",
";",
"}"
] |
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.