本文整理汇总了Java中com.ra4king.opengl.util.math.Vector4.z方法的典型用法代码示例。如果您正苦于以下问题:Java Vector4.z方法的具体用法?Java Vector4.z怎么用?Java Vector4.z使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ra4king.opengl.util.math.Vector4
的用法示例。
在下文中一共展示了Vector4.z方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadCube
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
public static float[] loadCube(Vector3 sideLength, Vector3 center, boolean interleaved, boolean vec4, Matrix4 modelMatrix) {
float[] buffer = vec4 ? (interleaved ? cubeVec4interleaved : cubeVec4) : (interleaved ? cubeVec3interleaved : cubeVec3);
for(int a = 0; a < cubeData.length / 2; a += 3) {
int position = (a / 3) * ((interleaved ? 3 : 0) + (vec4 ? 4 : 3));
Vector4 pos = new Vector4();
if(modelMatrix == null) {
pos.set(center.x() + cubeData[a] * sideLength.x(), center.y() + cubeData[a + 1] * sideLength.y(), center.z() + cubeData[a + 2] * sideLength.z(), 1);
} else {
modelMatrix.mult4(new Vector4(center.x() + cubeData[a] * sideLength.x(), center.y() + cubeData[a + 1] * sideLength.y(), center.z() + cubeData[a + 2] * sideLength.z(), 1), pos);
}
buffer[position + 0] = pos.x();
buffer[position + 1] = pos.y();
buffer[position + 2] = pos.z();
}
return buffer;
}
示例2: loadPlane
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
public static float[] loadPlane(Vector2 sideLength, Vector3 center, boolean interleaved, boolean vec4, Matrix4 modelMatrix) {
float[] buffer = vec4 ? (interleaved ? planeVec4interleaved : planeVec4) : (interleaved ? planeVec3interleaved : planeVec3);
for(int a = 0; a < planeData.length / 2; a += 3) {
int position = (a / 3) * ((interleaved ? 3 : 0) + (vec4 ? 4 : 3));
Vector4 pos = new Vector4();
if(modelMatrix == null) {
pos.set(center.x() + cubeData[a] * sideLength.x(), center.y() + cubeData[a + 1] * sideLength.y(), center.z() + cubeData[a + 2], 1);
} else {
modelMatrix.mult4(new Vector4(center.x() + cubeData[a] * sideLength.x(), center.y() + cubeData[a + 1] * sideLength.y(), center.z() + cubeData[a + 2], 1), pos);
}
buffer[position + 0] = pos.x();
buffer[position + 1] = pos.y();
buffer[position + 2] = pos.z();
}
return buffer;
}
示例3: parseVector4
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
@CopyStruct
public static Vector4 parseVector4(String s) {
String[] comp = StringUtil.split(s, ' ');
if(comp.length != 4)
throw new IllegalArgumentException("invalid Vector4");
Vector4 vec = new Vector4();
vec.x(Float.parseFloat(comp[0]));
vec.y(Float.parseFloat(comp[1]));
vec.z(Float.parseFloat(comp[2]));
vec.w(Float.parseFloat(comp[3]));
return vec;
}
示例4: calcLightPosition
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
private Vector4 calcLightPosition() {
float currTime = lightTimer.getAlpha();
Vector4 ret = new Vector4(0, lightHeight, 0, 1);
ret.x((float)Math.cos(currTime * 2 * Math.PI) * lightRadius);
ret.z((float)Math.sin(currTime * 2 * Math.PI) * lightRadius);
return ret;
}
示例5: calcLightPosition
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
private Vector4 calcLightPosition() {
float currTime = sphereTimer.getAlpha();
Vector4 ret = new Vector4(0, 20, 0, 1);
ret.x((float)Math.cos(currTime * 2 * Math.PI) * 20);
ret.z((float)Math.sin(currTime * 2 * Math.PI) * 20);
return ret;
}
示例6: calcLightPosition
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
private Vector4 calcLightPosition() {
float currTime = lightTimer.getAlpha();
Vector4 ret = new Vector4(0, 1, 0, 1);
ret.x((float)Math.cos(currTime * 2 * Math.PI) * 3);
ret.z((float)Math.sin(currTime * 2 * Math.PI) * 3);
return ret;
}
示例7: calcLightPosition
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
public Vector4 calcLightPosition(Timer timer, float alphaOffset) {
float currTime = timer.getAlpha() + alphaOffset;
Vector4 ret = new Vector4(0, lightHeight, 0, 1);
ret.x((float)Math.cos(currTime * 2 * Math.PI) * lightRadius);
ret.z((float)Math.sin(currTime * 2 * Math.PI) * lightRadius);
return ret;
}
示例8: gammaCorrect
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
private Vector4 gammaCorrect(Vector4 input, float gamma) {
Vector4 res = new Vector4();
res.x((float)Math.pow(input.x(), 1f / gamma));
res.y((float)Math.pow(input.y(), 1f / gamma));
res.z((float)Math.pow(input.z(), 1f / gamma));
res.w(input.w());
return res;
}
示例9: parseVector4
import com.ra4king.opengl.util.math.Vector4; //导入方法依赖的package包/类
public static Vector4 parseVector4(String s) {
String[] comp = StringUtil.split(s, ' ');
if(comp.length != 4)
throw new IllegalArgumentException("invalid Vector4");
Vector4 vec = new Vector4();
vec.x(Float.parseFloat(comp[0]));
vec.y(Float.parseFloat(comp[1]));
vec.z(Float.parseFloat(comp[2]));
vec.w(Float.parseFloat(comp[3]));
return vec;
}