use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class TessellatorHelper method addGUIQuadMesh.
public static void addGUIQuadMesh(Tessellator tessellator, Vector4f color, float sizeX, float sizeY) {
tessellator.resetParams();
tessellator.setColor(new Vector4f(color.x, color.y, color.z, color.w));
tessellator.setUseLighting(false);
tessellator.setUseNormals(false);
tessellator.addPoly(new Vector3f[] { new Vector3f(0, 0, 0), new Vector3f(sizeX, 0, 0), new Vector3f(sizeX, sizeY, 0), new Vector3f(0, sizeY, 0) }, new Vector2f[] { new Vector2f(0, 0), new Vector2f(1, 0), new Vector2f(1, 1), new Vector2f(0, 1) });
tessellator.setUseLighting(true);
tessellator.setUseNormals(true);
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class RenderableWorldImpl method squaredDistanceToCamera.
private static float squaredDistanceToCamera(RenderableChunk chunk, Vector3f cameraPosition) {
// For performance reasons, to avoid instantiating too many vectors in a frequently called method,
// comments are in use instead of appropriately named vectors.
// chunk position in chunk coordinates
Vector3f result = chunk.getPosition().toVector3f();
// chunk center in chunk coordinates
result.add(CHUNK_CENTER_OFFSET);
// chunk center in world coordinates
result.x *= ChunkConstants.SIZE_X;
result.y *= ChunkConstants.SIZE_Y;
result.z *= ChunkConstants.SIZE_Z;
// camera to chunk vector
result.sub(cameraPosition);
return result.lengthSquared();
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class BlockSelectionRenderer method renderMark.
public void renderMark(Vector3i blockPos) {
Vector3f cameraPos = getCameraPosition();
glPushMatrix();
glTranslated(blockPos.x - cameraPos.x, blockPos.y - cameraPos.y, blockPos.z - cameraPos.z);
glMatrixMode(GL_MODELVIEW);
overlayMesh.render();
glPopMatrix();
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class BlockSelectionRenderer method renderMark2.
public void renderMark2(Vector3i blockPos) {
Vector3f cameraPos = getCameraPosition();
glPushMatrix();
glTranslated(blockPos.x - cameraPos.x, blockPos.y - cameraPos.y, blockPos.z - cameraPos.z);
glMatrixMode(GL_MODELVIEW);
overlayMesh2.render();
glPopMatrix();
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class TelemetrySystem method recordDistanceTraveled.
private void recordDistanceTraveled() {
Vector3f position = localPlayer.getPosition();
float distanceMoved = position.distance(previousPos);
gamePlayStatsComponent.distanceTraveled += distanceMoved;
previousPos = position;
localPlayer.getCharacterEntity().addOrSaveComponent(gamePlayStatsComponent);
}
Aggregations