23
kesk
3y

Was just scrolling through some 3rd party code and I had my "What the hell" moment

Comments
  • 8
    WTF is this?!

    Btw, your tags... "devrant" is not "developer rant" (every rant is because there are only devs here). It's about devrant.com stuff.
  • 1
    Umm...he just created a one time loop or I’m seeing things. Had to read it a few times...
  • 5
    A for loop starting at 1, that in itself is a dirty flag for me.

    Tell me there's more contextual code below this, surely there's a reason we have a loop only iterating once.... hopefully
  • 1
    Tell him to wrap the entire code block in a loop like that for performance
  • 2
    @Fast-Nop ops... my bad
  • 1
    @C0D4 is a block of code to update objects rotation for drawing:
    // doubler
    for(var i = 1; i < 2; i++) {
    var zpos = i * -2.0;

    pointFlower.offset[0] = pointFlower.area.x * -1.0;
    pointFlower.offset[1] = pointFlower.area.y * -1.0;
    pointFlower.offset[2] = pointFlower.area.z * zpos;
    gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
    gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);

    [cut for chars limit, the rest of code are the same last 5 line, with different *-1.0; pattern, so rotating betwen -1 and 1]
    }
  • 2
    Whyyyyy
Add Comment