Results 1 to 10 of 179

Thread: nxPascal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Yeah, nxPascal doesn't have real physics engine at the moment, so i made them "manually", using my little knowledge of physics. First lets take a look at the source code, as i finally got the shaders working and uploaded all to SVN. (I was sending array index to glUniform, when i should have sent index variable from that array's data... That's the point of using GLint type where header types are wanted, i just missed it.)

    https://code.google.com/p/nxpascal/s...meUnit.pas#114
    The program runs in single thread for simplicity. It gets vector that is from 1 walker position to other, and then pushes them both away from eachother by amount that is half of movement speed. Then sets function result true, meaning that collision happened. Main program will then check if there's time to count it again and runs the physics again and again until there are no collisions, or the 10ms that was allocated to each frame has elapsed.

    I know i could've used syntax like:
    position:=position+v;
    ... for vector math. But operator overloading is not Delphi 5-7 compatible, so i don't use them in the demos or engine internals.

    edit: I added both versions, shader and non-shader to dropbox link too. Shader version is unsurprisingly slower because of increasing amount of GL program changes as walker amount goes higher. The demo uses 6 different programs per frame, changing frequently.
    (It doesn't mean shaders are bad, the opposite. They're just not meant to be changed that much )
    Last edited by User137; 12-08-2013 at 12:38 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •