本文整理匯總了Java中javax.vecmath.Matrix4f.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix4f.set方法的具體用法?Java Matrix4f.set怎麽用?Java Matrix4f.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.vecmath.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.set方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: outputCylinder1
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
* Local implementation of outputCylinder.
*
* @param ptCenter
* @param pt1
* @param pt2
* @param colix
* @param endcaps
* @param radius
* @param ptX
* @param ptY
*/
private void outputCylinder1(Point3f ptCenter, Point3f pt1, Point3f pt2,
short colix, byte endcaps, float radius,
Point3f ptX, Point3f ptY) {
MeshSurface data = MeshData.getCylinderData(false);
Matrix4f matrix = new Matrix4f();
addTexture(colix, null);
String name = "Cylinder" + cylinderNum++;
int n = (ptX != null && endcaps == Graphics3D.ENDCAPS_NONE ? 2 : 1);
for (int i = 0; i < n; i++) {
if (ptX == null)
matrix.set(getRotationMatrix(pt1, pt2, radius));
else
matrix.set(getRotationMatrix(ptCenter, pt2, radius, ptX, ptY));
matrix.m03 = pt1.x;
matrix.m13 = pt1.y;
matrix.m23 = pt1.z;
matrix.m33 = 1;
}
addMesh(name, data, matrix, matrix, colix, null, null);
}
示例2: outputEllipse
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private boolean outputEllipse(Point3f ptCenter, Point3f ptZ, Point3f ptX, Point3f ptY,
short colix) {
if (!haveCircle) {
models.append(getCircleResource());
haveCircle = true;
cylinderMatrix = new Matrix4f();
}
addColix(colix, false);
String key = "Ellipse_" + colix;
List<String> v = htNodes.get(key);
if (v == null) {
v = new ArrayList<String>();
htNodes.put(key, v);
addShader(key, colix);
}
checkPoint(ptCenter);
cylinderMatrix.set(getRotationMatrix(ptCenter, ptZ, 1, ptX, ptY));
cylinderMatrix.m03 = ptZ.x;
cylinderMatrix.m13 = ptZ.y;
cylinderMatrix.m23 = ptZ.z;
cylinderMatrix.m33 = 1;
v.add(getParentItem("Jmol", cylinderMatrix));
return true;
}
示例3: outputCircle
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private void outputCircle(Point3f ptCenter, Point3f ptPerp, short colix, float radius) {
if (!haveCircle) {
models.append(getCircleResource());
haveCircle = true;
cylinderMatrix = new Matrix4f();
}
addColix(colix, false);
String key = "Circle_" + colix;
List<String> v = htNodes.get(key);
if (v == null) {
v = new ArrayList<String>();
htNodes.put(key, v);
addShader(key, colix);
}
checkPoint(ptCenter);
cylinderMatrix.set(getRotationMatrix(ptCenter, ptPerp, radius));
cylinderMatrix.m03 = ptCenter.x;
cylinderMatrix.m13 = ptCenter.y;
cylinderMatrix.m23 = ptCenter.z;
cylinderMatrix.m33 = 1;
v.add(getParentItem("Jmol", cylinderMatrix));
}
示例4: setSphereMatrix
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
protected void setSphereMatrix(Point3f center, float rx, float ry, float rz,
AxisAngle4f a, Matrix4f sphereMatrix) {
if (a != null) {
Matrix3f mq = new Matrix3f();
Matrix3f m = new Matrix3f();
m.m00 = rx;
m.m11 = ry;
m.m22 = rz;
mq.set(a);
mq.mul(m);
sphereMatrix.set(mq);
} else {
sphereMatrix.setIdentity();
sphereMatrix.m00 = rx;
sphereMatrix.m11 = ry;
sphereMatrix.m22 = rz;
}
sphereMatrix.m03 = center.x;
sphereMatrix.m13 = center.y;
sphereMatrix.m23 = center.z;
sphereMatrix.m33 = 1;
}
示例5: generateAllOperators
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
private void generateAllOperators(HallInfo h) {
if (h == null) {
h = hallInfo;
if (operationCount > 0)
return;
operations = new SymmetryOperation[4];
operationCount = 0;
if (hallInfo == null || hallInfo.nRotations == 0)
h = hallInfo = new HallInfo(hallSymbol);
setLattice(hallInfo.latticeCode, hallInfo.isCentrosymmetric);
addOperation(null, 0);
addSymmetry("x,y,z", 0);
}
Matrix4f mat1 = new Matrix4f();
Matrix4f operation = new Matrix4f();
Matrix4f[] newOps = new Matrix4f[7];
for (int i = 0; i < 7; i++)
newOps[i] = new Matrix4f();
// prior to Jmol 11.7.36/11.6.23 this was setting nOps within the loop
// and setIdentity() outside the loop. That caused a multiplication of
// operations, not a resetting of them each time.
for (int i = 0; i < h.nRotations; i++) {
mat1.set(h.rotationTerms[i].seitzMatrix12ths);
int nRot = h.rotationTerms[i].order;
// this would iterate int nOps = operationCount;
newOps[0].setIdentity();
int nOps = operationCount;
for (int j = 1; j <= nRot; j++) {
newOps[j].mul(mat1, newOps[0]);
newOps[0].set(newOps[j]);
for (int k = 0; k < nOps; k++) {
operation.mul(newOps[j], operations[k]);
SymmetryOperation.normalizeTranslation(operation);
String xyz = SymmetryOperation.getXYZFromMatrix(operation, true, true, true);
addSymmetry(xyz, operation);
}
}
}
}
示例6: setOrientation
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
void setOrientation(Matrix3f mat) {
if (mat == null)
return;
Matrix4f m = new Matrix4f();
m.set(mat);
matrixFractionalToCartesian.mul(m, matrixFractionalToCartesian);
matrixCartesianToFractional.invert(matrixFractionalToCartesian);
calcUnitcellVertices();
}
示例7: getTransformMatrix4
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public static float getTransformMatrix4(List<Point3f> ptsA, List<Point3f> ptsB, Matrix4f m, Point3f centerA) {
Point3f[] cptsA = getCenterAndPoints(ptsA);
Point3f[] cptsB = getCenterAndPoints(ptsB);
float[] retStddev = new float[2];
Quaternion q = calculateQuaternionRotation(new Point3f[][] { cptsA,
cptsB }, retStddev, false);
Vector3f v = new Vector3f(cptsB[0]);
v.sub(cptsA[0]);
m.set(q.getMatrix(), v, 1);
if (centerA != null)
centerA.set(cptsA[0]);
return retStddev[1];
}
示例8: outputCircle1
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
* Local implementation of outputCircle.
*
* @param ptCenter
* @param ptPerp
* @param colix
* @param radius
*/
private void outputCircle1(Point3f ptCenter, Point3f ptPerp, short colix,
float radius) {
MeshSurface data = MeshData.getCircleData();
Matrix4f matrix = new Matrix4f();
addTexture(colix, null);
String name = "Circle" + circleNum++;
matrix.set(getRotationMatrix(ptCenter, ptPerp, radius));
matrix.m03 = ptCenter.x;
matrix.m13 = ptCenter.y;
matrix.m23 = ptCenter.z;
matrix.m33 = 1;
addMesh(name, data, matrix, matrix, colix, null, null);
}
示例9: outputCone1
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
* Local implementation of outputCone.
*
* @param ptBase
* @param ptTip
* @param radius
* @param colix
*/
private void outputCone1(Point3f ptBase, Point3f ptTip, float radius,
short colix) {
MeshSurface data = MeshData.getConeData();
Matrix4f matrix = new Matrix4f();
addTexture(colix, null);
String name = "Cone" + coneNum++;
matrix.set(getRotationMatrix(ptBase, ptTip, radius));
matrix.m03 = ptBase.x;
matrix.m13 = ptBase.y;
matrix.m23 = ptBase.z;
matrix.m33 = 1;
addMesh(name, data, matrix, matrix, colix, null, null);
}
示例10: outputEllipse1
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
* Local implementation of outputEllipse.
*
* @param ptCenter
* @param ptZ
* @param ptX
* @param ptY
* @param colix
* @return Always returns true.
*/
private boolean outputEllipse1(Point3f ptCenter, Point3f ptZ, Point3f ptX,
Point3f ptY, short colix) {
MeshSurface data = MeshData.getCircleData();
Matrix4f matrix = new Matrix4f();
addTexture(colix, null);
String name = "Ellipse" + ellipseNum++;
matrix.set(getRotationMatrix(ptCenter, ptZ, 1, ptX, ptY));
matrix.m03 = ptZ.x;
matrix.m13 = ptZ.y;
matrix.m23 = ptZ.z;
matrix.m33 = 1;
addMesh(name, data, matrix, matrix, colix, null, null);
return true;
}
示例11: setInitialRotationMatrix
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
/**
* Set rotation matrix setting also an initial default value (model with no
* animations).
*/
public void setInitialRotationMatrix(float x, float y, float z) {
Matrix4f mat = new Matrix4f();
mat.set(MathHelper.quatFromEuler(x, y, z));
mat.transpose();
this.setInitialRotationMatrix(mat);
}
示例12: getMatrix
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public Matrix4f getMatrix(Matrix4f out) {
out.set(basis);
out.m03 = origin.x;
out.m13 = origin.y;
out.m23 = origin.z;
return out;
}
示例13: renderSignPicture
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public void renderSignPicture(final float opacity, final float scale, @Nonnull final RenderOption opt) {
// Load Image
final Content content = this.entry.getContent();
final AttrReaders attr = this.entry.getMeta();
// Size
final SizeData size01 = content!=null ? content.image.getSize() : SizeData.DefaultSize;
final SizeData size = attr.sizes.getMovie().get().aspectSize(size01);
OpenGL.glPushMatrix();
final OffsetData offset = attr.offsets.getMovie().get();
final OffsetData centeroffset = attr.centeroffsets.getMovie().get();
final Quat4f rotate = attr.rotations.getMovie().get().getRotate();
final boolean see = CurrentMode.instance.isState(CurrentMode.State.SEE);
if (see) {
OpenGL.glColor4f(.5f, .5f, .5f, opacity*.5f);
OpenGL.glLineWidth(1f);
WRenderer.startShape();
final WVertex v1 = WRenderer.begin(GL_LINE_STRIP);
final Matrix4f m = new Matrix4f();
final Vector3f ov = new Vector3f(offset.x.offset, offset.y.offset, offset.z.offset);
final Vector3f cv = new Vector3f(centeroffset.x.offset, centeroffset.y.offset, centeroffset.z.offset);
final Point3f p = new Point3f();
v1.pos(p.x, p.y, p.z);
m.set(ov);
m.transform(p);
m.set(cv);
m.transform(p);
v1.pos(p.x, p.y, p.z);
p.set(0f, 0f, 0f);
cv.negate();
m.set(cv);
m.transform(p);
m.set(rotate);
m.transform(p);
cv.negate();
m.set(cv);
m.transform(p);
m.set(ov);
m.transform(p);
v1.pos(p.x, p.y, p.z);
v1.draw();
}
OpenGL.glTranslatef(offset.x.offset, offset.y.offset, offset.z.offset);
OpenGL.glTranslatef(centeroffset.x.offset, centeroffset.y.offset, centeroffset.z.offset);
RotationGL.glRotate(rotate);
OpenGL.glTranslatef(-centeroffset.x.offset, -centeroffset.y.offset, -centeroffset.z.offset);
OpenGL.glTranslatef(-size.getWidth()/2, size.getHeight()+(size.getHeight()>=0 ? 0 : -size.getHeight())-.5f, 0f);
OpenGL.glScalef(size.getWidth()<0 ? -1f : 1f, size.getHeight()<0 ? 1f : -1f, 1f);
OpenGL.glScalef(scale, scale, 1f);
drawScreen(0, 0, 0, opacity, size.getWidth()/scale, size.getHeight()/scale, opt);
OpenGL.glPopMatrix();
}
示例14: applyLight
import javax.vecmath.Matrix4f; //導入方法依賴的package包/類
public void applyLight(final float x, final float y, final float z, final @Nonnull Quat4f signrotate) {
final AttrReaders attr = this.entry.getMeta();
int lightx = (int) attr.f.getMovie().get().data;
int lighty = (int) attr.g.getMovie().get().data;
if (lightx!=-1||lighty!=-1) {
if (lightx<0||lighty<0) {
int lsign = 0;
int lcenter = 0;
int lpicture = 0;
if (lightx!=-2&&lightx!=-3||lighty!=-2&&lighty!=-3)
lsign = Client.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_float(x), MathHelper.floor_float(y), MathHelper.floor_float(z), 0);
if (lightx==-2||lighty==-2||lightx==-3||lighty==-3) {
final OffsetData offset = attr.offsets.getMovie().get();
final OffsetData centeroffset = attr.centeroffsets.getMovie().get();
final Matrix4f m = new Matrix4f();
final Point3f p = new Point3f();
final Quat4f rotate = attr.rotations.getMovie().get().getRotate();
final Vector3f tv = new Vector3f(x, y, z);
final Vector3f ov = new Vector3f(offset.x.offset, offset.y.offset, offset.z.offset);
final Vector3f cv = new Vector3f(centeroffset.x.offset, centeroffset.y.offset, centeroffset.z.offset);
m.set(ov);
m.transform(p);
m.set(cv);
m.transform(p);
m.set(signrotate);
m.transform(p);
m.set(tv);
m.transform(p);
if (lightx==-2||lighty==-2)
lcenter = Client.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_float(p.x), MathHelper.floor_float(p.y), MathHelper.floor_float(p.z), 0);
if (lightx==-3||lighty==-3) {
final Point3f p2 = new Point3f();
m.set(cv);
m.transform(p2);
m.set(signrotate);
m.transform(p2);
m.set(rotate);
m.transform(p2);
p.sub(p2);
lpicture = Client.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_float(p.x), MathHelper.floor_float(p.y), MathHelper.floor_float(p.z), 0);
}
}
if (lightx<0)
if (lightx==-2)
lightx = lcenter%65536>>4;
else if (lightx==-3)
lightx = lpicture%65536>>4;
else
lightx = lsign%65536>>4;
if (lighty<0)
if (lighty==-2)
lighty = lcenter/65536>>4;
else if (lighty==-3)
lighty = lpicture/65536>>4;
else
lighty = lsign/65536>>4;
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightx<<4, lighty<<4);
}
}