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); } }
public void setColor(Vector4f v) { activeColor.set(v); }
@Override public void onEmission(final ColorRangeGeneratorComponent component, final ParticleData particleData, final Random random ) { particleData.color.setX(random.nextFloat(component.minColorComponents.x(), component.maxColorComponents.x())); particleData.color.setY(random.nextFloat(component.minColorComponents.y(), component.maxColorComponents.y())); particleData.color.setZ(random.nextFloat(component.minColorComponents.z(), component.maxColorComponents.z())); particleData.color.setW(random.nextFloat(component.minColorComponents.w(), component.maxColorComponents.w())); } }
@Override public Vector4f calcColor(Biome biome) { return new Vector4f(1, 1, 1, 1); } },
public void resetParams() { activeColor.set(1, 1, 1, 1); activeTex.set(0, 0); lighting.set(1, 1, 1); activeNormal.set(0, 1, 0); }
@Override public Vector4f copy(Vector4f value) { if (value != null) { return new Vector4f(value); } return null; } }
temporaryParticleData.color.set( color[index4 + X_OFFSET], color[index4 + Y_OFFSET],
/** * 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); } };
@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; }