@Override public Vector4f calcColor(Biome biome) { return new Vector4f(1, 1, 1, 1); } },
@Override public Vector4f copy(Vector4f value) { if (value != null) { return new Vector4f(value); } return null; } }
/** * Init. a new block with default properties in place. */ public Block() { for (BlockPart part : BlockPart.values()) { colorSource.put(part, DefaultColorSource.DEFAULT); colorOffsets.put(part, new Vector4f(1.0f, 1.0f, 1.0f, 1.0f)); } }
public void setAllColorOffsets(BaseVector4f offset) { for (BlockPart part : BlockPart.values()) { colorOffsets.put(part, new Vector4f(offset)); } }
@Override public Vector4f calcColor(Biome biome) { float humidity = biome.getHumidity(); float temperature = biome.getTemperature(); float prod = temperature * humidity; int rgbValue = colorLut.getRGB((int) ((1.0 - temperature) * 255.0), (int) ((1.0 - prod) * 255.0)); Color c = new Color(rgbValue); return new Vector4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 1.0f); } },
@Override public Vector4f calcColor(Biome biome) { float humidity = biome.getHumidity(); float temperature = biome.getTemperature(); float prod = humidity * temperature; int rgbValue = foliageLut.getRGB((int) ((1.0 - temperature) * 255.0), (int) ((1.0 - prod) * 255.0)); Color c = new Color(rgbValue); return new Vector4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 1.0f); } };
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); } }
@Override public Vector4f deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (json.isJsonArray()) { JsonArray array = json.getAsJsonArray(); if (array.size() == 4) { return new Vector4f(array.get(0).getAsFloat(), array.get(1).getAsFloat(), array.get(2).getAsFloat(), array.get(3).getAsFloat()); } else if (array.size() == 3) { return new Vector4f(array.get(0).getAsFloat(), array.get(1).getAsFloat(), array.get(2).getAsFloat(), 1); } } return null; } }
public SectionDefinitionData() { colorSources = Maps.newEnumMap(BlockPart.class); colorOffsets = Maps.newEnumMap(BlockPart.class); for (BlockPart part : BlockPart.values()) { colorSources.put(part, DefaultColorSource.DEFAULT); colorOffsets.put(part, new Vector4f(1, 1, 1, 1)); } }
public Vector4f toVector4f() { return new Vector4f(rf(), gf(), bf(), af()); }
private void initialize() { Tessellator tessellator = new Tessellator(); TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, 1f), textureRegion.min(), textureRegion.size(), 1.001f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f); overlayMesh = tessellator.generateMesh(); tessellator = new Tessellator(); TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, .2f), textureRegion.min(), textureRegion.size(), 1.001f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f); overlayMesh2 = tessellator.generateMesh(); defaultTextured = Assets.getMaterial("engine:prog.defaultTextured").get(); }
@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; }
Vector4f color = new Vector4f(r / 255f, g / 255f, b / 255f, a / 255f); TessellatorHelper.addBlockMesh(tessellator, color, 2f / textureSize, 1.0f, 0.5f, 2f / textureSize * x - 1f, 2f / textureSize * (tex.getHeight() - y - 1) - 1f, 0f); Vector4f cColor = new Vector4f(colorContour.x / 255f, colorContour.y / 255f, colorContour.z / 255f, colorContour.w); TessellatorHelper.addBlockMesh(tessellator, cColor, 0.125f, 1.0f, 0.5f, 2f * 0.0625f * newX - 0.5f, 0.125f * (15 - newY) - 1f, 0f);
@Override public Vector4f deserialize(PersistedData data, DeserializationContext context) { if (data.isArray()) { PersistedDataArray dataArray = data.getAsArray(); if (dataArray.isNumberArray() && dataArray.size() > 3) { TFloatList floats = dataArray.getAsFloatArray(); return new Vector4f(floats.get(0), floats.get(1), floats.get(2), floats.get(3)); } } return null; } }
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); }