Java Code Examples for com.jme3.scene.Mesh#getLineWidth()

The following examples show how to use com.jme3.scene.Mesh#getLineWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
    public void renderMesh(Mesh mesh, int lod, int count, VertexBuffer[] instanceData) {
        if (mesh.getVertexCount() == 0 || mesh.getTriangleCount() == 0 || count == 0) {
            return;
        }

        if (count > 1 && !caps.contains(Caps.MeshInstancing)) {
            throw new RendererException("Mesh instancing is not supported by the video hardware");
        }

        if (mesh.getLineWidth() != 1f && context.lineWidth != mesh.getLineWidth()) {
            gl.glLineWidth(mesh.getLineWidth());
            context.lineWidth = mesh.getLineWidth();
        }

        if (gl4 != null && mesh.getMode().equals(Mode.Patch)) {
            gl4.glPatchParameter(mesh.getPatchVertexCount());
        }
        statistics.onMeshDrawn(mesh, lod, count);
//        if (ctxCaps.GL_ARB_vertex_array_object){
//            renderMeshVertexArray(mesh, lod, count);
//        }else{
        renderMeshDefault(mesh, lod, count, instanceData);
//        }
    }
 
Example 2
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void renderMesh(Mesh mesh, int lod, int count) {
	if (mesh.getVertexCount() == 0)
        return;
    if (context.pointSize != mesh.getPointSize()) {
        gl.glPointSize(mesh.getPointSize());
        context.pointSize = mesh.getPointSize();
    }
    if (context.lineWidth != mesh.getLineWidth()) {
        gl.glLineWidth(mesh.getLineWidth());
        context.lineWidth = mesh.getLineWidth();
    }

    checkTexturingUsed();

    if (vbo) {
        renderMeshVBO(mesh, lod, count);
    } else {
        boolean dynamic = false;
        if (mesh.getNumLodLevels() == 0) {
            IntMap<VertexBuffer> bufs = mesh.getBuffers();
            for (Entry<VertexBuffer> entry : bufs) {
                if (entry.getValue().getUsage() != VertexBuffer.Usage.Static) {
                    dynamic = true;
                    break;
                }
            }
        } else {
            dynamic = true;
        }

        if (!dynamic) {
            // dealing with a static object, generate display list
            renderMeshDisplayList(mesh);
        } else {
            renderMeshDefault(mesh, lod, count);
        }
    }
}
 
Example 3
Source File: JoglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void renderMesh(Mesh mesh, int lod, int count) {
    GL gl = GLContext.getCurrentGL();
    if (context.pointSize != mesh.getPointSize()) {
        gl.getGL2().glPointSize(mesh.getPointSize());
        context.pointSize = mesh.getPointSize();
    }
    if (context.lineWidth != mesh.getLineWidth()) {
        gl.glLineWidth(mesh.getLineWidth());
        context.lineWidth = mesh.getLineWidth();
    }

    checkTexturingUsed();

    if (vbo) {
        renderMeshVBO(mesh, lod, count);
    }
    else {
        boolean dynamic = false;
        if (mesh.getNumLodLevels() == 0) {
            IntMap<VertexBuffer> bufs = mesh.getBuffers();
            for (Entry<VertexBuffer> entry : bufs) {
                if (entry.getValue().getUsage() != VertexBuffer.Usage.Static) {
                    dynamic = true;
                    break;
                }
            }
        }
        else {
            dynamic = true;
        }

        if (!dynamic) {
            // dealing with a static object, generate display list
            renderMeshDisplayList(mesh);
        }
        else {
            renderMeshDefault(mesh, lod, count);
        }
    }
}
 
Example 4
Source File: LwjglRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void renderMesh(Mesh mesh, int lod, int count) {
        if (mesh.getVertexCount() == 0) {
            return;
        }

        if (context.pointSprite && mesh.getMode() != Mode.Points){
            // XXX: Hack, disable point sprite mode if mesh not in point mode
            if (context.boundTextures[0] != null){
                if (context.boundTextureUnit != 0){
                    glActiveTexture(GL_TEXTURE0);
                    context.boundTextureUnit = 0;
                }
                glDisable(GL_POINT_SPRITE);
                glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
                context.pointSprite = false;
            }
        }

        if (context.pointSize != mesh.getPointSize()) {
            glPointSize(mesh.getPointSize());
            context.pointSize = mesh.getPointSize();
        }
        if (context.lineWidth != mesh.getLineWidth()) {
            glLineWidth(mesh.getLineWidth());
            context.lineWidth = mesh.getLineWidth();
        }

        statistics.onMeshDrawn(mesh, lod);
//        if (GLContext.getCapabilities().GL_ARB_vertex_array_object){
//            renderMeshVertexArray(mesh, lod, count);
//        }else{
            renderMeshDefault(mesh, lod, count);
//        }
    }
 
Example 5
Source File: GdxRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void renderMesh(Mesh mesh, int lod, int count) {
        if (context.pointSize != mesh.getPointSize()) {

            if (verboseLogging) {
                logger.log(Level.INFO, "GLES10.glPointSize({0})", mesh.getPointSize());
            }
            // TODO
            Gdx.gl10.glPointSize(mesh.getPointSize());
            context.pointSize = mesh.getPointSize();
        }
        if (context.lineWidth != mesh.getLineWidth()) {

            if (verboseLogging) {
                logger.log(Level.INFO, "GLES20.glLineWidth({0})", mesh.getLineWidth());
            }

            Gdx.gl20.glLineWidth(mesh.getLineWidth());
            context.lineWidth = mesh.getLineWidth();
        }

        statistics.onMeshDrawn(mesh, lod);
//        if (GLContext.getCapabilities().GL_ARB_vertex_array_object){
//            renderMeshVertexArray(mesh, lod, count);
//        }else{

        if (useVBO) {
            if (verboseLogging) {
                logger.info("RENDERING A MESH USING VertexBufferObject");
            }

            renderMeshDefault(mesh, lod, count);
        } else {
            if (verboseLogging) {
                logger.info("RENDERING A MESH USING VertexArray");
            }

            renderMeshVertexArray(mesh, lod, count);
        }

//        }
    }
 
Example 6
Source File: OGLESShaderRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void renderMesh(Mesh mesh, int lod, int count) {
        if (context.pointSize != mesh.getPointSize()) {

            if (verboseLogging) {
                logger.log(Level.INFO, "GLES10.glPointSize({0})", mesh.getPointSize());
            }

            GLES10.glPointSize(mesh.getPointSize());
            context.pointSize = mesh.getPointSize();
        }
        if (context.lineWidth != mesh.getLineWidth()) {

            if (verboseLogging) {
                logger.log(Level.INFO, "GLES20.glLineWidth({0})", mesh.getLineWidth());
            }

            GLES20.glLineWidth(mesh.getLineWidth());
            context.lineWidth = mesh.getLineWidth();
        }

        statistics.onMeshDrawn(mesh, lod);
//        if (GLContext.getCapabilities().GL_ARB_vertex_array_object){
//            renderMeshVertexArray(mesh, lod, count);
//        }else{

        if (useVBO) {
            if (verboseLogging) {
                logger.info("RENDERING A MESH USING VertexBufferObject");
            }

            renderMeshDefault(mesh, lod, count);
        } else {
            if (verboseLogging) {
                logger.info("RENDERING A MESH USING VertexArray");
            }

            renderMeshVertexArray(mesh, lod, count);
        }

//        }
    }