• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MeshGenerator类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.spout.renderer.api.util.MeshGenerator的典型用法代码示例。如果您正苦于以下问题:Java MeshGenerator类的具体用法?Java MeshGenerator怎么用?Java MeshGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MeshGenerator类属于org.spout.renderer.api.util包,在下文中一共展示了MeshGenerator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createPlane

点赞 3

import org.spout.renderer.api.util.MeshGenerator; //导入依赖的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);
}
 

开发者ID:ObsidianBox,
项目名称:Magma,
代码行数:17,
代码来源:Renderer.java

示例2: createTexturedPlane

点赞 2

import org.spout.renderer.api.util.MeshGenerator; //导入依赖的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;
}
 

开发者ID:ObsidianBox,
项目名称:Obsidian,
代码行数:29,
代码来源:GuiRenderer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)