本文整理汇总了Java中com.flowpowered.math.vector.Vector2f类的典型用法代码示例。如果您正苦于以下问题:Java Vector2f类的具体用法?Java Vector2f怎么用?Java Vector2f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2f类属于com.flowpowered.math.vector包,在下文中一共展示了Vector2f类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerSerializers
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public static void registerSerializers(DataManager dataManager) {
dataManager.registerTranslator(UUID.class, UUID_DATA_SERIALIZER);
dataManager.registerTranslator(Vector2d.class, VECTOR_2_D_DATA_SERIALIZER);
dataManager.registerTranslator(Vector2f.class, VECTOR_2_F_DATA_SERIALIZER);
dataManager.registerTranslator(Vector2i.class, VECTOR_2_I_DATA_SERIALIZER);
dataManager.registerTranslator(Vector2l.class, VECTOR_2_L_DATA_SERIALIZER);
dataManager.registerTranslator(Vector3d.class, VECTOR_3_D_DATA_SERIALIZER);
dataManager.registerTranslator(Vector3f.class, VECTOR_3_F_DATA_SERIALIZER);
dataManager.registerTranslator(Vector3i.class, VECTOR_3_I_DATA_SERIALIZER);
dataManager.registerTranslator(Vector3l.class, VECTOR_3_L_DATA_SERIALIZER);
dataManager.registerTranslator(Vector4d.class, VECTOR_4_D_DATA_SERIALIZER);
dataManager.registerTranslator(Vector4f.class, VECTOR_4_F_DATA_SERIALIZER);
dataManager.registerTranslator(Vector4i.class, VECTOR_4_I_DATA_SERIALIZER);
dataManager.registerTranslator(Vector4l.class, VECTOR_4_L_DATA_SERIALIZER);
dataManager.registerTranslator(Complexd.class, COMPLEXD_DATA_SERIALIZER);
dataManager.registerTranslator(Complexf.class, COMPLEXF_DATA_SERIALIZER);
dataManager.registerTranslator(Quaterniond.class, QUATERNIOND_DATA_SERIALIZER);
dataManager.registerTranslator(Quaternionf.class, QUATERNIONF_DATA_SERIALIZER);
dataManager.registerTranslator(LocalTime.class, LOCAL_TIME_DATA_SERIALIZER);
dataManager.registerTranslator(LocalDate.class, LOCAL_DATE_DATA_SERIALIZER);
dataManager.registerTranslator(LocalDateTime.class, LOCAL_DATE_TIME_DATA_SERIALIZER);
dataManager.registerTranslator(ZonedDateTime.class, ZONED_DATE_TIME_DATA_SERIALIZER);
dataManager.registerTranslator(Instant.class, INSTANT_DATA_SERIALIZER);
dataManager.registerTranslator(Month.class, MONTH_DATA_SERIALIZER);
}
示例2: createPlane
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public Model createPlane(Addon addon, String programName, UniformHolder uniforms, Vector2f size) throws IOException {
// Generate the plane
final VertexData data = MeshGenerator.generatePlane(size);
final VertexArray array = context.newVertexArray();
array.create();
array.setData(data);
// Grab the program
Program program = loadProgram(addon, programName);
// Create a material for it
final Material material = new Material(program);
material.getUniforms().addAll(uniforms);
return new Model(array, material);
}
示例3: Button
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public Button(Form form, String name, int x, int y, String text, Font font, int width, int height) {
super(form, name, x, y, text, font);
final Model backgroundModel;
final StringModel stringModel;
try {
backgroundModel = form.getAddon().getGame().getGuiRenderer().createColoredPlane(form.getAddon(), "basic", backgroundUniforms, Colors.BLUE.getValue(), new Vector2f(width, height));
stringModel = form.getAddon().getGame().getGuiRenderer().createString(form.getAddon(), "font", text, font, StringModel.AntiAliasing.ON, Font.PLAIN, 12);
} catch (Exception e) {
// Should NEVER get here as font is provided by the mod
throw new RuntimeException(e);
}
models.add(backgroundModel);
models.add(stringModel);
}
示例4: createTexturedPlane
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
@Override
public Model createTexturedPlane(Addon addon, String programName, UniformHolder holder, Texture diffuse, Texture normal, Texture specular, Vector2f size) throws IOException {
// We ignore normal and specular for the GUI
if (diffuse == null) {
throw new IOException(addon.getDescription().getName() + " attempted to texture a plane with a null diffuse!");
}
// Generate the plane
final VertexData data = MeshGenerator.generatePlane(size);
final VertexArray array = context.newVertexArray();
array.create();
array.setData(data);
// Grab the textured program
final Program program = loadProgram(((CommonAddonManager) game.getAddonManager()).getInternalAddon(), programName);
// Create a material for it
final Material material = new Material(program);
if (holder != null) {
material.getUniforms().addAll(holder);
}
material.addTexture(0, diffuse);
final Model model = new Model(array, material);
final float aspect = diffuse.getWidth() / (float) diffuse.getHeight();
model.setScale(new Vector3f(aspect, 1, 1));
return model;
}
示例5: serialize
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public static JsonObject serialize(Vector2f vector2f) {
return JsonBuilder.object()
.add("x", vector2f.getX())
.add("y", vector2f.getY())
.build();
}
示例6: deserialize2f
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public static Vector2f deserialize2f(JsonElement element) {
return new Vector2f(
element.getAsJsonObject().get("x").getAsFloat(),
element.getAsJsonObject().get("y").getAsFloat()
);
}
示例7: translate
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
@Override
public Vector2f translate(DataView view) throws InvalidDataException {
final double x = view.getDouble(DataQueries.X_POS).orElseThrow(invalidDataQuery(DataQueries.X_POS));
final double y = view.getDouble(DataQueries.Y_POS).orElseThrow(invalidDataQuery(DataQueries.Y_POS));
return new Vector2f(x, y);
}
示例8: createColoredPlane
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public Model createColoredPlane(Addon addon, String programName, UniformHolder holder, Color color, Vector2f size) throws IOException {
holder.add(new Uniform.Vector4Uniform("inputColor", color.asFloatVector()));
return createPlane(addon, programName, holder, size);
}
示例9: getDisplaySize
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public Vector2f getDisplaySize() {
return displaySize;
}
示例10: renderString
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public void renderString(String string, Vector2f position) {
nvgFontFaceId(this.nvgHandle, this.fontMem);
nvgFontSize(this.nvgHandle, this.data.getFontSize());
nvgTextBox(this.nvgHandle, position.getX(), position.getY(), 1e5f, string, MemoryUtil.NULL);
}
示例11: createTexturedPlane
import com.flowpowered.math.vector.Vector2f; //导入依赖的package包/类
public abstract Model createTexturedPlane(Addon addon, String programName, UniformHolder holder, Texture diffuse, Texture normal, Texture specular, Vector2f size) throws IOException;