Yan 1b2c84da2e [taken]Fix issue #764
Fix infinity loop in EmitterSphereShape. issue #764

I test on both method:

    public void getRandomPoint1(Vector3f store) {
        float l = FastMath.pow(FastMath.nextRandomFloat(), 1f / 3f);
        float u = FastMath.nextRandomFloat() * 2f - 1f;
        float o = FastMath.nextRandomFloat() * FastMath.TWO_PI;

        store.z = l * u;
        u = 1f / FastMath.fastInvSqrt(1f - u * u);
        store.x = l * u * FastMath.cos(o);
        store.y = l * u * FastMath.sin(o);
        store.multLocal(radius);
        store.addLocal(center);
    }

    public void getRandomPoint2(Vector3f store) {
        do {
            store.x = (FastMath.nextRandomFloat() * 2f - 1f);
            store.y = (FastMath.nextRandomFloat() * 2f - 1f);
            store.z = (FastMath.nextRandomFloat() * 2f - 1f);
        } while (store.lengthSquared() > 1);
        store.multLocal(radius);
        store.addLocal(center);
    }
    // Test
    public void testGetRandomPoint() {
        int n = 1000000;
        long start = System.nanoTime();
        for (int i = 0; i < n; i++) {
            getRandomPoint1(store);
        }
        long time1 = System.nanoTime() - start;

        start = System.nanoTime();
        for (int i = 0; i < n; i++) {
            getRandomPoint2(store);
        }
        long time2 = System.nanoTime() - start;

        System.out.println("t1:" + time1);
        System.out.println("t2:" + time2);
        System.out.println("t1/t2:" + (float) time1 / time2);
    }

Result:

    t1:352272158
    t2:94436324
    t1/t2:3.7302613

Method2 seems nearly 4 times faster than method1.
2018-01-21 09:37:49 +01:00
2017-11-28 08:29:55 +01:00
2018-01-21 09:37:49 +01:00
2018-01-21 09:37:49 +01:00
2017-12-24 22:16:18 +01:00
2017-08-31 21:39:54 +02:00
2017-11-28 08:29:55 +01:00
2017-11-28 08:26:41 +01:00
2018-01-18 14:45:06 +01:00
2017-11-28 08:29:55 +01:00
2017-11-28 08:29:55 +01:00
2015-01-23 20:01:09 -05:00
2018-01-15 20:03:11 +01:00
2017-01-26 12:00:24 +01:00
2016-11-25 14:04:56 -05:00

jMonkeyEngine

Build Status

jMonkeyEngine is a 3D game engine for adventurous Java developers. Its open-source, cross-platform, and cutting-edge. 3.2.0 is the latest stable version of the jMonkeyEngine 3 SDK, a complete game development suite. We'll release 3.2.x updates until the major 3.3 release arrives.

The engine is used by several commercial game studios and computer-science courses. Here's a taste:

jME3 Games Mashup

Getting started

Go to https://github.com/jMonkeyEngine/sdk/releases to download the jMonkeyEngine SDK. Read the wiki for a complete install guide. Power up with some SDK Plugins and AssetPacks and you are off to the races. At this point you're gonna want to join the forum so our tribe can grow stronger.

Note: The master branch on GitHub is a development version of the engine and is NOT MEANT TO BE USED IN PRODUCTION, it will break constantly during development of the stable jME versions!

Technology Stack

  • Java
  • NetBeans Platform
  • Gradle

Plus a bunch of awesome libraries & tight integrations like Bullet, Blender, NiftyGUI and other goodies.

Documentation

Did you miss it? Don't sweat it, here it is again.

Contributing

Read our contribution guide.

License

New BSD (3-clause) License. In other words, you do whatever makes you happy!

Description
A complete 3D game development suite written purely in Java.
Readme 844 MiB
Languages
Java 95.4%
C++ 2.5%
GLSL 1.5%
C 0.3%
HTML 0.2%