/** Rotates this vector by the given angle in radians around the given axis. * * @param axis the axis * @param radians the angle in radians * @return This vector for chaining */ public Vector3 rotateRad (final Vector3 axis, float radians) { tmpMat.setToRotationRad(axis, radians); return this.mul(tmpMat); }
/** Rotates this vector by the given angle in radians around the given axis. * * @param axis the axis * @param radians the angle in radians * @return This vector for chaining */ public Vector3 rotateRad (final Vector3 axis, float radians) { tmpMat.setToRotationRad(axis, radians); return this.mul(tmpMat); }
@Override public void activateParticles (int startIndex, int count) { for (int i = startIndex * positionChannel.strideSize, c = i + count * positionChannel.strideSize; i < c; i += positionChannel.strideSize) { spawnShapeValue.spawn(TMP_V1, controller.emitter.percent); TMP_V1.mul(controller.transform); positionChannel.data[i + ParticleChannels.XOffset] = TMP_V1.x; positionChannel.data[i + ParticleChannels.YOffset] = TMP_V1.y; positionChannel.data[i + ParticleChannels.ZOffset] = TMP_V1.z; } }
/** Rotates this vector by the given angle in radians around the given axis. * * @param radians the angle in radians * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis * @return This vector for chaining */ public Vector3 rotateRad (float radians, float axisX, float axisY, float axisZ) { return this.mul(tmpMat.setToRotationRad(axisX, axisY, axisZ, radians)); }
private Vector3 translateScreenToIso (Vector2 vec) { screenPos.set(vec.x, vec.y, 0); screenPos.mul(invIsotransform); return screenPos; }
/** Transform the position, direction and up vector by the given matrix * * @param transform The transform matrix */ public void transform (final Matrix4 transform) { position.mul(transform); rotate(transform); }
/** Rotates this vector by the given angle in degrees around the given axis. * * @param degrees the angle in degrees * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis * @return This vector for chaining */ public Vector3 rotate (float degrees, float axisX, float axisY, float axisZ) { return this.mul(tmpMat.setToRotation(axisX, axisY, axisZ, degrees)); }
/** Rotates this vector by the given angle in degrees around the given axis. * * @param axis the axis * @param degrees the angle in degrees * @return This vector for chaining */ public Vector3 rotate (final Vector3 axis, float degrees) { tmpMat.setToRotation(axis, degrees); return this.mul(tmpMat); }
/** Transform the position, direction and up vector by the given matrix * * @param transform The transform matrix */ public void transform (final Matrix4 transform) { position.mul(transform); rotate(transform); }
/** Rotates this vector by the given angle in degrees around the given axis. * * @param degrees the angle in degrees * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis * @return This vector for chaining */ public Vector3 rotate (float degrees, float axisX, float axisY, float axisZ) { return this.mul(tmpMat.setToRotation(axisX, axisY, axisZ, degrees)); }
/** Rotates this vector by the given angle in radians around the given axis. * * @param radians the angle in radians * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis * @return This vector for chaining */ public Vector3 rotateRad (float radians, float axisX, float axisY, float axisZ) { return this.mul(tmpMat.setToRotationRad(axisX, axisY, axisZ, radians)); }
/** Rotates this vector by the given angle in degrees around the given axis. * * @param axis the axis * @param degrees the angle in degrees * @return This vector for chaining */ public Vector3 rotate (final Vector3 axis, float degrees) { tmpMat.setToRotation(axis, degrees); return this.mul(tmpMat); }
/** Multiplies the ray by the given matrix. Use this to transform a ray into another coordinate system. * * @param matrix The matrix * @return This ray for chaining. */ public Ray mul (Matrix4 matrix) { tmp.set(origin).add(direction); tmp.mul(matrix); origin.mul(matrix); direction.set(tmp.sub(origin)); return this; }
/** Add a box given the matrix. Requires GL_POINTS, GL_LINES or GL_TRIANGLES primitive type. */ public static void build (MeshPartBuilder builder, Matrix4 transform) { build(builder, obtainV3().set(-0.5f, -0.5f, -0.5f).mul(transform), obtainV3().set(-0.5f, 0.5f, -0.5f).mul(transform), obtainV3().set(0.5f, -0.5f, -0.5f).mul(transform), obtainV3().set(0.5f, 0.5f, -0.5f).mul(transform), obtainV3().set(-0.5f, -0.5f, 0.5f).mul(transform), obtainV3().set(-0.5f, 0.5f, 0.5f).mul(transform), obtainV3().set(0.5f, -0.5f, 0.5f).mul(transform), obtainV3().set(0.5f, 0.5f, 0.5f).mul(transform)); freeAll(); }
/** Add a box given the matrix. Requires GL_POINTS, GL_LINES or GL_TRIANGLES primitive type. */ public static void build (MeshPartBuilder builder, Matrix4 transform) { build(builder, obtainV3().set(-0.5f, -0.5f, -0.5f).mul(transform), obtainV3().set(-0.5f, 0.5f, -0.5f).mul(transform), obtainV3().set(0.5f, -0.5f, -0.5f).mul(transform), obtainV3().set(0.5f, 0.5f, -0.5f).mul(transform), obtainV3().set(-0.5f, -0.5f, 0.5f).mul(transform), obtainV3().set(-0.5f, 0.5f, 0.5f).mul(transform), obtainV3().set(0.5f, -0.5f, 0.5f).mul(transform), obtainV3().set(0.5f, 0.5f, 0.5f).mul(transform)); freeAll(); }
/** Transforms a point to real screen coordinates (as opposed to OpenGL ES window coordinates), where the origin is in the top * left and the the y-axis is pointing downwards. */ public Vector2 toScreenCoordinates (Vector2 worldCoords, Matrix4 transformMatrix) { tmp.set(worldCoords.x, worldCoords.y, 0); tmp.mul(transformMatrix); camera.project(tmp); tmp.y = Gdx.graphics.getHeight() - tmp.y; worldCoords.x = tmp.x; worldCoords.y = tmp.y; return worldCoords; }
/** Transforms a point to real screen coordinates (as opposed to OpenGL ES window coordinates), where the origin is in the top * left and the the y-axis is pointing downwards. */ public Vector2 toScreenCoordinates (Vector2 worldCoords, Matrix4 transformMatrix) { tmp.set(worldCoords.x, worldCoords.y, 0); tmp.mul(transformMatrix); camera.project(tmp); tmp.y = Gdx.graphics.getHeight() - tmp.y; worldCoords.x = tmp.x; worldCoords.y = tmp.y; return worldCoords; }
private Vector3 getTranslation (Matrix4 worldTransform, Vector3 center, Vector3 output) { if (center.isZero()) worldTransform.getTranslation(output); else if (!worldTransform.hasRotationOrScaling()) worldTransform.getTranslation(output).add(center); else output.set(center).mul(worldTransform); return output; }
private Vector3 getTranslation (Matrix4 worldTransform, Vector3 center, Vector3 output) { if (center.isZero()) worldTransform.getTranslation(output); else if (!worldTransform.hasRotationOrScaling()) worldTransform.getTranslation(output).add(center); else output.set(center).mul(worldTransform); return output; }
@Override protected void onLoaded () { super.onLoaded(); BoundingBox bounds = instances.get(0).calculateBoundingBox(new BoundingBox()); bounds.getCenter(center); radius = bounds.getDimensions(tmpV).len() * .5f; pointLight.position.set(0, radius, 0).add(transformedCenter.set(center).mul(transform)); pointLight.intensity = radius * radius; ((ColorAttribute)pLight.material.get(ColorAttribute.Diffuse)).color.set(pointLight.color); final float s = 0.2f * radius; pLight.worldTransform.setToScaling(s, s, s); }