@@ -0,0 +1,3340 @@
+/*%0A * Copyright (c) 2009-2015 jMonkeyEngine%0A * All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are%0A * met:%0A *%0A * * Redistributions of source code must retain the above copyright%0A *   notice, this list of conditions and the following disclaimer.%0A *%0A * * Redistributions in binary form must reproduce the above copyright%0A *   notice, this list of conditions and the following disclaimer in the%0A *   documentation and/or other materials provided with the distribution.%0A *%0A * * Neither the name of 'jMonkeyEngine' nor the names of its contributors%0A *   may be used to endorse or promote products derived from this software%0A *   without specific prior written permission.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED%0A * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR%0A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR%0A * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,%0A * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,%0A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR%0A * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF%0A * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING%0A * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS%0A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0Apackage jme3test.stress;%0A%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0A%0Aimport com.jme3.scene.Geometry;%0Aimport com.jme3.scene.Node;%0Aimport com.jme3.scene.shape.Sphere;%0Aimport com.jme3.util.TangentBinormalGenerator;%0A%0Apublic class TestParallelTangentGeneration %7B%0A%0A    static ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        for (int i = 0; i %3C 10; i++) %7B%0A            %7B%0A                Node root = new Node(%22Root%22);%0A                for (int count = 0; count %3C 10; count++) %7B%0A                    for (int samples = 4; samples %3C 50; samples++) %7B%0A                        Geometry g = new Geometry();%0A                        g.setMesh(new Sphere(samples, samples, 1.0f));%0A                        root.attachChild(g);%0A                    %7D%0A                %7D%0A%0A                long start = System.currentTimeMillis();%0A                TangentBinormalGenerator.generate(root);%0A                System.out.println(%22Serial %22 + (System.currentTimeMillis() - start));%0A            %7D%0A%0A            %7B%0A                Node root = new Node(%22Root%22);%0A                for (int count = 0; count %3C 10; count++) %7B%0A                    for (int samples = 4; samples %3C 50; samples++) %7B%0A                        Geometry g = new Geometry();%0A                        g.setMesh(new Sphere(samples, samples, 1.0f));%0A                        root.attachChild(g);%0A                    %7D%0A                %7D%0A%0A                long start = System.currentTimeMillis();%0A                TangentBinormalGenerator.generateParallel(root, executor);%0A                System.out.println(%22Parallel %22 + (System.currentTimeMillis() - start));%0A            %7D%0A%0A        %7D%0A    %7D%0A%7D

Test for parallel tangent generation