use of org.terasology.math.geom.Vector4f in project Terasology by MovingBlocks.
the class Block method calcColorOffsetFor.
/**
* Calculates the color offset for a given block type and a specific
* side of the block.
*
* @param part The block side
* @param biome The block's biome
* @return The color offset
*/
public Vector4f calcColorOffsetFor(BlockPart part, Biome biome) {
BlockColorSource source = getColorSource(part);
Vector4f color = source.calcColor(biome);
Vector4f colorOffset = colorOffsets.get(part);
color.x *= colorOffset.x;
color.y *= colorOffset.y;
color.z *= colorOffset.z;
color.w *= colorOffset.w;
return color;
}
use of org.terasology.math.geom.Vector4f in project Terasology by MovingBlocks.
the class BackdropNode method getAllWeatherZenith.
static Vector3f getAllWeatherZenith(float thetaSunAngle, float turbidity) {
float thetaSun = (float) Math.acos(thetaSunAngle);
Vector4f cx1 = new Vector4f(0.0f, 0.00209f, -0.00375f, 0.00165f);
Vector4f cx2 = new Vector4f(0.00394f, -0.03202f, 0.06377f, -0.02903f);
Vector4f cx3 = new Vector4f(0.25886f, 0.06052f, -0.21196f, 0.11693f);
Vector4f cy1 = new Vector4f(0.0f, 0.00317f, -0.00610f, 0.00275f);
Vector4f cy2 = new Vector4f(0.00516f, -0.04153f, 0.08970f, -0.04214f);
Vector4f cy3 = new Vector4f(0.26688f, 0.06670f, -0.26756f, 0.15346f);
float t2 = turbidity * turbidity;
float chi = (4.0f / 9.0f - turbidity / 120.0f) * ((float) Math.PI - 2.0f * thetaSun);
Vector4f theta = new Vector4f(1, thetaSun, thetaSun * thetaSun, thetaSun * thetaSun * thetaSun);
float why = (4.0453f * turbidity - 4.9710f) * (float) Math.tan(chi) - 0.2155f * turbidity + 2.4192f;
float x = t2 * cx1.dot(theta) + turbidity * cx2.dot(theta) + cx3.dot(theta);
float y = t2 * cy1.dot(theta) + turbidity * cy2.dot(theta) + cy3.dot(theta);
return new Vector3f(why, x, y);
}
use of org.terasology.math.geom.Vector4f in project Terasology by MovingBlocks.
the class InitialiseGraphics method step.
@Override
public boolean step() {
// Refresh widget library after modules got laoded:
NUIManager nuiManager = context.get(NUIManager.class);
((NUIManagerInternal) nuiManager).refreshWidgetsLibrary();
// TODO: This should be elsewhere
// Create gelatinousCubeMesh
Tessellator tessellator = new Tessellator();
TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1.0f, 1.0f, 1.0f, 1.0f), 0.8f, 0.8f, 0.6f, 0f, 0f, 0f);
TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1.0f, 1.0f, 1.0f, 0.6f), 1.0f, 1.0f, 0.8f, 0f, 0f, 0f);
tessellator.generateMesh(new ResourceUrn(TerasologyConstants.ENGINE_MODULE, new Name("gelatinousCube")));
return true;
}
Aggregations