[jME2.x] LWJGLRenderer.draw(Curve curve)

hello,



if we have a curve with 0 step, when it is drawn (via LWJGLRenderer.draw(Curve curve) ) we have an infinite loop due to a divide by 0 in the limit computation.


    public void draw(Curve curve) {
        // set world matrix
        Quaternion rotation = curve.getWorldRotation();
        Vector3f translation = curve.getWorldTranslation();
        Vector3f scale = curve.getWorldScale();
        float rot = rotation.toAngleAxis(vRot) * FastMath.RAD_TO_DEG;
        RendererRecord matRecord = (RendererRecord) DisplaySystem
                .getDisplaySystem().getCurrentContext().getRendererRecord();
        matRecord.switchMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();

        GL11.glTranslatef(translation.x, translation.y, translation.z);
        GL11.glRotatef(rot, vRot.x, vRot.y, vRot.z);
        GL11.glScalef(scale.x, scale.y, scale.z);

        applyStates(curve.states, null);

        // render the object
        GL11.glBegin(GL11.GL_LINE_STRIP);

        FloatBuffer color = curve.getColorBuffer();
        if (color != null)
            color.rewind();
        float colorInterval = 0;
        float colorModifier = 0;
        if (null != color) {
            matRecord.setCurrentColor(color.get(), color.get(), color.get(),
                    color.get());

            colorInterval = 4f / color.limit();
            colorModifier = colorInterval;
            color.rewind();
        }

        Vector3f point;
        float limit = (1 + (1.0f / curve.getSteps())); <


Here
        for (float t = 0; t <= limit; t += 1.0f / curve.getSteps()) { <
Here

            if (t >= colorInterval && color != null) {

                colorInterval += colorModifier;
                matRecord.setCurrentColor(color.get(), color.get(),
                        color.get(), color.get());
            }

            point = curve.getPoint(t, tempVa);
            GL11.glVertex3f(point.x, point.y, point.z);
        }

        if (Debug.stats) {
            StatCollector.addStat(StatType.STAT_VERTEX_COUNT, limit);
        }

        GL11.glEnd();
        undoTransforms(curve);
    }



Of course, a curve with 0 step is not very usefull, but as I dynamically set the number of steps from the curve size, it may happens.