Java Code Examples for javax.vecmath.Matrix4f#setRow()
The following examples show how to use
javax.vecmath.Matrix4f#setRow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Skylight_BulletPhysics_Breakable.java From PixelFlow with MIT License | 5 votes |
public Transform asBulletTransform(PMatrix3D mat_p5){ Matrix4f mat = new Matrix4f(); mat.setRow(0, mat_p5.m00, mat_p5.m01, mat_p5.m02, mat_p5.m03); mat.setRow(1, mat_p5.m10, mat_p5.m11, mat_p5.m12, mat_p5.m13); mat.setRow(2, mat_p5.m20, mat_p5.m21, mat_p5.m22, mat_p5.m23); mat.setRow(3, mat_p5.m30, mat_p5.m31, mat_p5.m32, mat_p5.m33); return new Transform(mat); }
Example 2
Source File: Skylight_BulletPhysics_Breakable_VideoExport.java From PixelFlow with MIT License | 5 votes |
public Transform asBulletTransform(PMatrix3D mat_p5){ Matrix4f mat = new Matrix4f(); mat.setRow(0, mat_p5.m00, mat_p5.m01, mat_p5.m02, mat_p5.m03); mat.setRow(1, mat_p5.m10, mat_p5.m11, mat_p5.m12, mat_p5.m13); mat.setRow(2, mat_p5.m20, mat_p5.m21, mat_p5.m22, mat_p5.m23); mat.setRow(3, mat_p5.m30, mat_p5.m31, mat_p5.m32, mat_p5.m33); return new Transform(mat); }
Example 3
Source File: Skylight_BulletPhysics_Breakable3.java From PixelFlow with MIT License | 5 votes |
public Transform asBulletTransform(PMatrix3D mat_p5){ Matrix4f mat = new Matrix4f(); mat.setRow(0, mat_p5.m00, mat_p5.m01, mat_p5.m02, mat_p5.m03); mat.setRow(1, mat_p5.m10, mat_p5.m11, mat_p5.m12, mat_p5.m13); mat.setRow(2, mat_p5.m20, mat_p5.m21, mat_p5.m22, mat_p5.m23); mat.setRow(3, mat_p5.m30, mat_p5.m31, mat_p5.m32, mat_p5.m33); return new Transform(mat); }
Example 4
Source File: Skylight_BulletPhysics_Cubes.java From PixelFlow with MIT License | 4 votes |
public void createFractureShape(){ reset(); float pos_z = 20f; int numx = 15; int numy = 5; int numz = 10; float dim = 20; float boundsx = numx * dim; float boundsy = numy * dim; // float boundsz = numz * dim; float mass = dim*dim*dim; float tx = -boundsx * 0.5f; float ty = -boundsy * 0.5f; float tz = pos_z + 0; colorMode(HSB, 360, 100,100); for(int z = 0; z < numz; z++){ for(int y = 0; y < numy; y++){ for(int x = 0; x < numx; x++){ float cx = dim *0.5f + x * dim; float cy = dim *0.5f + y * dim; float cz = dim *0.5f + z * dim; BObject body = new BBox(this, mass, dim, dim, dim); // setup initial body transform-matrix PMatrix3D mat_p5 = new PMatrix3D(); mat_p5.translate(tx, ty, tz); mat_p5.translate(cx, cy, cz); Matrix4f mat = new Matrix4f(); mat.setRow(0, mat_p5.m00, mat_p5.m01, mat_p5.m02, mat_p5.m03); mat.setRow(1, mat_p5.m10, mat_p5.m11, mat_p5.m12, mat_p5.m13); mat.setRow(2, mat_p5.m20, mat_p5.m21, mat_p5.m22, mat_p5.m23); mat.setRow(3, mat_p5.m30, mat_p5.m31, mat_p5.m32, mat_p5.m33); Transform transform = new Transform(mat); // rigid-body properties body.rigidBody.setWorldTransform(transform); body.rigidBody.setRestitution(.1f); body.rigidBody.setFriction(0.85f); body.rigidBody.setDamping(0.2f, 0.2f); body.displayShape = createShape(BOX, dim, dim, dim); body.displayShape.setStroke(false); body.displayShape.setFill(true); // float r = random(80, 130); float r = random(220, 270); float g = random(20,70); float b = 100; body.displayShape.setFill(color(r,g,b)); physics.addBody(body); group_bulletbodies.addChild(body.displayShape); } } } colorMode(RGB, 255, 255,255); }
Example 5
Source File: Skylight_BulletPhysics_MengerSponge.java From PixelFlow with MIT License | 4 votes |
public void addCube(float cx, float cy, float cz, float dim, int depth, int max_depth){ float mass = dim*dim*dim; BObject body = new BBox(this, mass, dim, dim, dim); // setup initial body transform-matrix PMatrix3D mat_p5 = new PMatrix3D(); mat_p5.translate(cx, cy, cz); Matrix4f mat = new Matrix4f(); mat.setRow(0, mat_p5.m00, mat_p5.m01, mat_p5.m02, mat_p5.m03); mat.setRow(1, mat_p5.m10, mat_p5.m11, mat_p5.m12, mat_p5.m13); mat.setRow(2, mat_p5.m20, mat_p5.m21, mat_p5.m22, mat_p5.m23); mat.setRow(3, mat_p5.m30, mat_p5.m31, mat_p5.m32, mat_p5.m33); Transform transform = new Transform(mat); // rigid-body properties body.rigidBody.setWorldTransform(transform); body.rigidBody.setRestitution(.1f); body.rigidBody.setFriction(0.85f); body.rigidBody.setDamping(0.2f, 0.2f); int[] rgb = menger_color[depth]; float r = rgb[0]; float g = rgb[1]; float b = rgb[2]; body.displayShape = createShape(BOX, dim, dim, dim); body.displayShape.setStroke(false); body.displayShape.setFill(true); body.displayShape.setStroke(color(0)); body.displayShape.setFill(color(r,g,b)); if(depth != max_depth){ body.displayShape.setName("cube [wire1]"); } else { body.displayShape.setName("cube [wire2]" ); } physics.addBody(body); group_bulletbodies.addChild(body.displayShape); }