() {
6 | @Override
7 | public T map(T in) {
8 | return in;
9 | }
10 |
11 | @Override
12 | public T unmap(T out) {
13 | return out;
14 | }
15 |
16 | };
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/func/CharSupplier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 | *
5 | *
6 | *
7 | *
8 | *
9 | *
10 | *
11 | *
12 | *
13 | *
14 | *
15 | *
16 | *
17 | *
18 | *
19 | *
20 | *
21 | *
22 | *
23 | *
24 | */
25 | package org.andork.func;
26 |
27 | import java.util.function.Supplier;
28 |
29 | /**
30 | * Represents a supplier of {@code char}-valued results. This is the
31 | * {@code char}-producing primitive specialization of {@link Supplier}.
32 | *
33 | *
34 | * There is no requirement that a distinct result be returned each time the
35 | * supplier is invoked.
36 | *
37 | *
38 | * This is a functional interface whose
39 | * functional method is {@link #getAsChar()}.
40 | *
41 | * @see Supplier
42 | * @since 1.8
43 | */
44 | @FunctionalInterface
45 | public interface CharSupplier {
46 |
47 | /**
48 | * Gets a result.
49 | *
50 | * @return a result
51 | */
52 | char getAsChar();
53 | }
54 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/func/MemoOne.java:
--------------------------------------------------------------------------------
1 | package org.andork.func;
2 |
3 | import java.util.function.Function;
4 |
5 | import org.andork.util.Java7;
6 |
7 | public class MemoOne implements Function {
8 | Function fn;
9 | boolean called = false;
10 | I lastInput = null;
11 | O lastOutput = null;
12 |
13 | private MemoOne(Function fn) {
14 | this.fn = fn;
15 | }
16 |
17 | public static Function memoOne(Function fn) {
18 | return new MemoOne<>(fn);
19 | }
20 |
21 | @Override
22 | public O apply(I input) {
23 | if (called && Java7.Objects.equals(lastInput, input)) {
24 | return lastOutput;
25 | }
26 | called = true;
27 | return lastOutput = fn.apply(lastInput = input);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/func/NullBimapper.java:
--------------------------------------------------------------------------------
1 | package org.andork.func;
2 |
3 | public class NullBimapper implements Bimapper {
4 | @Override
5 | public O map(I in) {
6 | return null;
7 | }
8 |
9 | @Override
10 | public I unmap(O out) {
11 | return null;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/func/ShorterCode.java:
--------------------------------------------------------------------------------
1 | package org.andork.func;
2 |
3 | public class ShorterCode {
4 | public static void swallowException(ExceptionRunnable runnable) {
5 | try {
6 | runnable.run();
7 | } catch (Exception ex) {
8 | throw new RuntimeException(ex);
9 | }
10 | }
11 |
12 | public static T swallowException(ExceptionSupplier supplier) {
13 | try {
14 | return supplier.get();
15 | } catch (Exception ex) {
16 | throw new RuntimeException(ex);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/func/TriFunction.java:
--------------------------------------------------------------------------------
1 | package org.andork.func;
2 |
3 | @FunctionalInterface
4 | public interface TriFunction {
5 | public R apply(T t, U u, V v);
6 | }
7 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/io/FileStreamFlattener.java:
--------------------------------------------------------------------------------
1 | package org.andork.io;
2 |
3 | import java.io.File;
4 | import java.util.Arrays;
5 | import java.util.function.Function;
6 | import java.util.stream.Stream;
7 |
8 | public class FileStreamFlattener implements Function> {
9 | public static final FileStreamFlattener instance = new FileStreamFlattener();
10 |
11 | public static void main(String[] args) {
12 | Arrays.asList(new File(".")).stream().flatMap(instance).forEach(System.out::println);
13 | }
14 |
15 | private FileStreamFlattener() {
16 |
17 | }
18 |
19 | @Override
20 | public Stream apply(File f) {
21 | if (f == null) {
22 | return null;
23 | }
24 | if (f.isDirectory()) {
25 | return Arrays.asList(f.listFiles()).stream().flatMap(this);
26 | }
27 | return Stream.of(f);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/io/FileUtils.java:
--------------------------------------------------------------------------------
1 | package org.andork.io;
2 |
3 | import java.io.IOException;
4 | import java.nio.ByteBuffer;
5 | import java.nio.channels.FileChannel;
6 | import java.nio.file.Files;
7 | import java.nio.file.Path;
8 | import java.nio.file.StandardOpenOption;
9 |
10 | public class FileUtils {
11 | public static ByteBuffer slurp(Path path) throws IOException {
12 | if (Files.size(path) > Integer.MAX_VALUE) {
13 | throw new IOException("File is too large");
14 | }
15 |
16 | try (FileChannel channel = FileChannel.open(path, StandardOpenOption.READ)) {
17 | ByteBuffer buffer = ByteBuffer.allocate((int) channel.size());
18 |
19 | while (channel.read(buffer) > 0) {
20 | ;
21 | }
22 |
23 | buffer.position(0);
24 |
25 | return buffer;
26 | }
27 | }
28 |
29 | public static byte[] slurpAsBytes(Path path) throws IOException {
30 | return slurp(path).array();
31 | }
32 |
33 | public static String slurpAsString(Path path) throws IOException {
34 | return new String(slurp(path).array());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/io/InputStreamUtils.java:
--------------------------------------------------------------------------------
1 | package org.andork.io;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | public class InputStreamUtils {
8 | private InputStreamUtils() {
9 | }
10 |
11 | public static byte[] readAllBytes(InputStream in) throws IOException {
12 | ByteArrayOutputStream out = new ByteArrayOutputStream();
13 | byte[] buf = new byte[4096];
14 | int numRead;
15 | while ((numRead = in.read(buf, 0, buf.length)) >= 0) {
16 | out.write(buf, 0, numRead);
17 | }
18 | return out.toByteArray();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/io/Readers.java:
--------------------------------------------------------------------------------
1 | package org.andork.io;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.Reader;
5 |
6 | public class Readers {
7 | private Readers() {
8 | }
9 |
10 | public static BufferedReader buffered(Reader reader) {
11 | if (reader instanceof BufferedReader)
12 | return (BufferedReader) reader;
13 | return new BufferedReader(reader);
14 | }
15 |
16 | public static BufferedReader buffered(BufferedReader reader) {
17 | return reader;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/task/TaskCallable.java:
--------------------------------------------------------------------------------
1 | package org.andork.task;
2 |
3 | @FunctionalInterface
4 | public interface TaskCallable {
5 | public R work(Task task) throws Exception;
6 | }
7 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/task/TaskCanceledException.java:
--------------------------------------------------------------------------------
1 | package org.andork.task;
2 |
3 | public class TaskCanceledException extends RuntimeException {
4 |
5 | /**
6 | *
7 | */
8 | private static final long serialVersionUID = 2294509510725014491L;
9 |
10 | public TaskCanceledException() {
11 | }
12 |
13 | public TaskCanceledException(String message) {
14 | super(message);
15 | }
16 |
17 | public TaskCanceledException(Throwable cause) {
18 | super(cause);
19 | }
20 |
21 | public TaskCanceledException(String message, Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public TaskCanceledException(String message, Throwable cause, boolean enableSuppression,
26 | boolean writableStackTrace) {
27 | super(message, cause, enableSuppression, writableStackTrace);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/util/Comparables.java:
--------------------------------------------------------------------------------
1 | package org.andork.util;
2 |
3 | import java.util.Comparator;
4 |
5 | public class Comparables {
6 | public static > T max(T a, T b) {
7 | return a == null ? b : b == null ? null : a.compareTo(b) > 0 ? a : b;
8 | }
9 |
10 | public static > T min(T a, T b) {
11 | return a == null ? b : b == null ? null : a.compareTo(b) < 0 ? a : b;
12 | }
13 |
14 | public static int compareNullsLast(T a, T b, Comparator super T> comparator) {
15 | if (a == null) return b == null ? 0 : 1;
16 | if (b == null) return -1;
17 | return comparator.compare(a, b);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/util/Comparators.java:
--------------------------------------------------------------------------------
1 | package org.andork.util;
2 |
3 | import java.util.Comparator;
4 |
5 | public class Comparators {
6 | private Comparators() {
7 |
8 | }
9 |
10 | public static Comparator negate(Comparator super T> c) {
11 | return (a, b) -> -c.compare(a, b);
12 | }
13 |
14 | @SafeVarargs
15 | public static Comparator combine(Comparator super T>... comparators) {
16 | return (a, b) -> {
17 | for (Comparator super T> comparator : comparators) {
18 | int result = comparator.compare(a, b);
19 | if (result != 0) {
20 | return result;
21 | }
22 | }
23 | return 0;
24 | };
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/util/FileRecoveryConfig.java:
--------------------------------------------------------------------------------
1 | package org.andork.util;
2 |
3 | import java.io.File;
4 |
5 | public interface FileRecoveryConfig {
6 | public default File getBackupFile(File f) {
7 | return new File(f.getParentFile(), "~" + f.getName());
8 | }
9 |
10 | public default File getTempFile(File f) {
11 | return new File(f.getPath() + ".tmp");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/util/SizeFormat.java:
--------------------------------------------------------------------------------
1 | package org.andork.util;
2 |
3 | import java.text.CharacterIterator;
4 | import java.text.StringCharacterIterator;
5 |
6 | public class SizeFormat {
7 | public static SizeFormat DEFAULT = new SizeFormat();
8 |
9 | public String format(long bytes) {
10 | if (-1000 < bytes && bytes < 1000) {
11 | return bytes + " B";
12 | }
13 | CharacterIterator ci = new StringCharacterIterator("kMGTPE");
14 | while (bytes <= -999950 || bytes >= 999950) {
15 | bytes /= 1000;
16 | ci.next();
17 | }
18 | return String.format("%.1f %cB", bytes / 1000.0, ci.current());
19 | }
20 |
21 | public String formatProgress(long completed, long total) {
22 | if (-1000 < total && total < 1000) {
23 | return total + " B";
24 | }
25 | CharacterIterator ci = new StringCharacterIterator("kMGTPE");
26 | while (total <= -999950 || total >= 999950) {
27 | completed /= 1000;
28 | total /= 1000;
29 | ci.next();
30 | }
31 | return String.format("%.1f/%.1f %cB", completed / 1000.0, total / 1000.0, ci.current());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/andork-core/src/org/andork/util/VersionUtil.java:
--------------------------------------------------------------------------------
1 | package org.andork.util;
2 |
3 | public class VersionUtil {
4 | public static int compareVersions(String a, String b) {
5 | String[] aParts = a.split("\\.");
6 | String[] bParts = b.split("\\.");
7 |
8 | for (int i = 0; i < Math.min(aParts.length, bParts.length); i++) {
9 | int aNum = Integer.parseInt(aParts[i]);
10 | int bNum = Integer.parseInt(bParts[i]);
11 | if (aNum != bNum) {
12 | return aNum - bNum;
13 | }
14 | }
15 |
16 | return aParts.length - bParts.length;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/andork-core/test/org/andork/io/CSVTest.java:
--------------------------------------------------------------------------------
1 | package org.andork.io;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 |
9 | public class CSVTest {
10 | @Test
11 | public void testParseLine() {
12 | CSVFormat csv = new CSVFormat();
13 |
14 | csv.trimWhitespace(false);
15 |
16 | String original = "\"Test \" \"\"one,\"Test \"\" two\",1997\n, Ford,,E350,\"Super, \"\"luxurious\"\" truck\",";
17 | List fields = Arrays.asList("Test one", "Test \" two", "1997\n", " Ford", "", "E350",
18 | "Super, \"luxurious\" truck", "");
19 |
20 | List parsed = csv.parseLine(original);
21 |
22 | Assert.assertEquals(fields, parsed);
23 |
24 | String formatted = csv.formatLine(fields);
25 |
26 | Assert.assertEquals("Test one,\"Test \"\" two\",1997\n, Ford,,E350,\"Super, \"\"luxurious\"\" truck\",",
27 | formatted);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/andork-cpcurves/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/andork-cpcurves/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
--------------------------------------------------------------------------------
/andork-cpcurves/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-cpcurves
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/andork-gson/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/andork-gson/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
--------------------------------------------------------------------------------
/andork-gson/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-gson
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/andork-gson/src/org/andork/spec/json/JsonSpecArrayList.java:
--------------------------------------------------------------------------------
1 | package org.andork.spec.json;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 |
6 | import org.andork.spec.json.JsonSpec.Format;
7 |
8 | import com.google.gson.JsonArray;
9 |
10 | public class JsonSpecArrayList extends JsonSpecList
11 | {
12 | private JsonSpecArrayList( Format super E> format )
13 | {
14 | super( format );
15 | }
16 |
17 | public static JsonSpecArrayList newInstance( Format super E> format )
18 | {
19 | return new JsonSpecArrayList( format );
20 | }
21 |
22 | @Override
23 | protected Collection createCollection( )
24 | {
25 | return new ArrayList( );
26 | }
27 |
28 | public static JsonSpecArrayList fromJson( JsonArray array , Format super E> format ) throws Exception
29 | {
30 | JsonSpecArrayList list = newInstance( format );
31 | fromJson( array , list );
32 | return list;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/andork-gson/src/org/andork/spec/json/JsonSpecElement.java:
--------------------------------------------------------------------------------
1 | package org.andork.spec.json;
2 |
3 | import org.andork.event.HierarchicalBasicPropertyChangePropagator;
4 | import org.andork.event.HierarchicalBasicPropertyChangeSupport;
5 | import org.andork.model.HasChangeSupport;
6 |
7 | import com.google.gson.JsonElement;
8 |
9 | public abstract class JsonSpecElement implements HasChangeSupport {
10 | protected final HierarchicalBasicPropertyChangeSupport changeSupport = new HierarchicalBasicPropertyChangeSupport();
11 | protected final HierarchicalBasicPropertyChangePropagator propagator = new HierarchicalBasicPropertyChangePropagator(this, changeSupport);
12 |
13 | public HierarchicalBasicPropertyChangeSupport.External changeSupport() {
14 | return changeSupport.external();
15 | }
16 |
17 | public abstract JsonElement toJson();
18 | }
19 |
--------------------------------------------------------------------------------
/andork-j3d-utils/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/andork-j3d-utils/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
--------------------------------------------------------------------------------
/andork-j3d-utils/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-j3d-utils
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/andork-j3d-utils/src/org/andork/j3d/XyzAxes2.java:
--------------------------------------------------------------------------------
1 |
2 | package org.andork.j3d;
3 |
4 | /**
5 | *
6 | */
7 |
8 | import java.awt.Color;
9 |
10 | import javax.media.j3d.BranchGroup;
11 | import javax.vecmath.Color3f;
12 | import javax.vecmath.Point3f;
13 |
14 | import org.andork.j3d.math.TransformComputer3f;
15 |
16 | /**
17 | * @author brian.kamery
18 | *
19 | */
20 | public class XyzAxes2 extends BranchGroup
21 | {
22 | TransformComputer3f m_tc3f = new TransformComputer3f( );
23 | /**
24 | *
25 | * @param radius
26 | * @param length
27 | */
28 | public XyzAxes2( float radius , float length )
29 | {
30 |
31 | Cylinder x = new Cylinder( radius , new Point3f( ) , new Point3f( 1 , 0 , 0 ) , m_tc3f , new Color3f( Color.RED ) );
32 | Cylinder y = new Cylinder( radius , new Point3f( ) , new Point3f( 0 , 1 , 0 ) , m_tc3f , new Color3f( Color.GREEN ) );
33 | Cylinder z = new Cylinder( radius , new Point3f( ) , new Point3f( 0 , 0 , 1 ) , m_tc3f , new Color3f( Color.BLUE ) );
34 |
35 | this.addChild( x );
36 | this.addChild( y );
37 | this.addChild( z );
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/andork-j3d-utils/src/org/andork/j3d/camera/CameraEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 |
5 | package org.andork.j3d.camera;
6 |
7 | import java.util.EventObject;
8 |
9 | /**
10 | * @author brian.kamery
11 | *
12 | */
13 | @SuppressWarnings( "serial" )
14 | public class CameraEvent extends EventObject
15 | {
16 | public CameraEvent( Camera3D source )
17 | {
18 | super( source );
19 | }
20 |
21 | public Camera3D getCamera( )
22 | {
23 | return ( Camera3D ) super.getSource( );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/andork-j3d-utils/src/org/andork/j3d/camera/CameraListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 |
5 | package org.andork.j3d.camera;
6 |
7 | /**
8 | * @author brian.kamery
9 | *
10 | */
11 | public interface CameraListener
12 | {
13 | public void orientationChanged( CameraEvent evt );
14 | }
15 |
--------------------------------------------------------------------------------
/andork-j3d-utils/src/org/andork/j3d/math/OrientationUtils.java:
--------------------------------------------------------------------------------
1 | package org.andork.j3d.math;
2 |
3 | import javax.vecmath.Quat4f;
4 |
5 | public class OrientationUtils
6 | {
7 | public static void taitBryanToQuat( float yaw , float pitch , float roll , Quat4f q )
8 | {
9 | float cphi = ( float ) Math.cos( roll / 2 );
10 | float ctheta = ( float ) Math.cos( pitch / 2 );
11 | float cpsi = ( float ) Math.cos( yaw / 2 );
12 | float sphi = ( float ) Math.sin( roll / 2 );
13 | float stheta = ( float ) Math.sin( pitch / 2 );
14 | float spsi = ( float ) Math.sin( yaw / 2 );
15 |
16 | q.w = cphi * ctheta * cpsi + sphi * stheta * spsi;
17 | q.x = sphi * ctheta * cpsi - cphi * stheta * spsi;
18 | q.y = cphi * stheta * cpsi - sphi * ctheta * spsi;
19 | q.z = cphi * ctheta * spsi - sphi * stheta * cpsi;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/andork-j3d-utils/src/org/andork/spatial/SINode.java:
--------------------------------------------------------------------------------
1 | package org.andork.spatial;
2 |
3 | public interface SINode
4 | {
5 | public SIBranch getParent( );
6 |
7 | public void setParent( SIBranch newParent );
8 |
9 | public BBox getBBox( );
10 |
11 | public boolean isValid( );
12 |
13 | public void validate( );
14 | }
15 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-swing/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-swing/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-jogl-gl2es2-swing
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-swing/src/com/jogamp/opengl/util/packrect/package.html:
--------------------------------------------------------------------------------
1 |
2 | This package implements a rectangle packing algorithm suitable for
3 | tracking the placement of multiple rectangles inside a larger one. It
4 | is useful for cases such as placing the contents of multiple windows
5 | on a larger backing store texture for a compositing window manager;
6 | placing multiple rasterized strings in a texture map for quick
7 | rendering to the screen; and many other situations where it is useful
8 | to carve up a larger texture into smaller pieces dynamically.
9 |
10 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-jogl-gl2es2-utils
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/DevicePixelRatio.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl;
2 |
3 | import java.awt.Component;
4 |
5 | import com.jogamp.opengl.GLAutoDrawable;
6 |
7 | public class DevicePixelRatio
8 | {
9 | private DevicePixelRatio( )
10 | {
11 |
12 | }
13 |
14 | public static float getDevicePixelRatio(GLAutoDrawable drawable) {
15 | if (!(drawable instanceof Component)) return 1;
16 | Component comp = (Component) drawable;
17 | return (float) drawable.getSurfaceWidth( ) / comp.getWidth( );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/JoglBackgroundColor.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl;
2 |
3 | import static org.andork.math3d.Vecmath.setf;
4 |
5 | import java.util.Arrays;
6 |
7 | import com.jogamp.opengl.GL;
8 | import com.jogamp.opengl.GL2ES2;
9 |
10 | public class JoglBackgroundColor implements JoglDrawable {
11 |
12 | private final float[] bgColor = { 0, 0, 0, 1 };
13 |
14 | @Override
15 | public void draw(JoglDrawContext context, GL2ES2 gl, float[] m, float[] n) {
16 | gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]);
17 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
18 | }
19 |
20 | public float[] get() {
21 | return Arrays.copyOf(bgColor, bgColor.length);
22 | }
23 |
24 | public float[] get(float[] out) {
25 | setf(out, bgColor);
26 | return out;
27 | }
28 |
29 | public void set(float... bgColor) {
30 | setf(this.bgColor, bgColor);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/JoglFilter.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl;
2 |
3 | import com.jogamp.opengl.GL3;
4 |
5 | public interface JoglFilter {
6 | /**
7 | * APplies
8 | *
9 | * @param gl
10 | * @param width the width of the viewport
11 | * @param height the height of the viewport
12 | * @param framebuffer the gl framebuffer object
13 | * @param texture the gl texture object
14 | * @param s the s coordinate <= 1 corresponding to x = width
15 | * @param t the t coordinate <= 1 corresponding to y = height
16 | */
17 | void apply(GL3 gl, int width, int height, int framebuffer, int texture, float s, float t);
18 | }
19 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/JoglManagedResource.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public abstract class JoglManagedResource implements JoglResource {
6 | int referenceCount = 0;
7 |
8 | @Override
9 | public void dispose(GL2ES2 gl) {
10 | if (referenceCount == 0) {
11 | throw new IllegalStateException("expected referenceCount to be > 0");
12 | }
13 | if (--referenceCount == 0) {
14 | doDispose(gl);
15 | }
16 | }
17 |
18 | @Override
19 | public boolean init(GL2ES2 gl) {
20 | if (referenceCount++ == 0) {
21 | return doInit(gl);
22 | }
23 | return true;
24 | }
25 |
26 | protected abstract boolean doInit(GL2ES2 gl);
27 |
28 | protected abstract void doDispose(GL2ES2 gl);
29 | }
30 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/AttribLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class AttribLocation extends GLLocation {
6 | public AttribLocation(String name) {
7 | super(name);
8 | }
9 |
10 | @Override
11 | public void update(GL2ES2 gl, int program) {
12 | location = gl.glGetAttribLocation(program, name);
13 | }
14 |
15 | public void enableArray(GL2ES2 gl) {
16 | gl.glEnableVertexAttribArray(location);
17 | }
18 |
19 | public void disableArray(GL2ES2 gl) {
20 | gl.glDisableVertexAttribArray(location);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/FlatColorFragment.fp:
--------------------------------------------------------------------------------
1 | #version 330
2 |
3 | uniform vec4 color;
4 | out vec4 color_out;
5 |
6 | void main() {
7 | color_out = color;
8 | }
9 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/FlatColorVertex.vp:
--------------------------------------------------------------------------------
1 | #version 330
2 |
3 | uniform mat4 m;
4 | uniform mat4 v;
5 | uniform mat4 p;
6 | in vec3 position;
7 |
8 | void main() {
9 | gl_Position = p * v * m * vec4(position, 1.0);
10 | }
11 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/FlatColorVertexScreen.vp:
--------------------------------------------------------------------------------
1 | #version 330
2 |
3 | uniform mat4 screenXform;
4 | in vec3 position;
5 |
6 | void main() {
7 | gl_Position = screenXform * vec4(position, 1.0);
8 | }
9 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/GLLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public abstract class GLLocation {
6 | protected final String name;
7 | protected int location;
8 |
9 | public GLLocation(String name) {
10 | this.name = name;
11 | }
12 |
13 | public int location() {
14 | return location;
15 | }
16 |
17 | public String name() {
18 | return name;
19 | }
20 |
21 | public abstract void update(GL2ES2 gl, int program);
22 | }
23 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/MaxBlur.fp:
--------------------------------------------------------------------------------
1 | # version 330
2 |
3 | uniform sampler2D u_texture;
4 | uniform int u_count;
5 | uniform float u_coeff[11];
6 | in vec2 v_texcoord[11];
7 | out vec4 color_out;
8 |
9 | void main() {
10 | vec4 color = vec4(0, 0, 0, 0);
11 | for (int i = 0; i < u_count; i++) {
12 | vec4 sample = texture(u_texture, v_texcoord[i]) * u_coeff[i];
13 | color = max(
14 | color,
15 | sample
16 | );
17 | }
18 | color_out = color;
19 | }
20 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/MaxBlur.vp:
--------------------------------------------------------------------------------
1 | # version 330
2 |
3 | in vec2 a_position;
4 | in vec2 a_texcoord;
5 | uniform int u_count;
6 | uniform vec2 u_offset[11];
7 | out vec2 v_texcoord[11];
8 |
9 | void main() {
10 | gl_Position = vec4(a_position, 0, 1);
11 | for (int i = 0; i < u_count; i++) {
12 | v_texcoord[i] = a_texcoord + u_offset[i];
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/Uniform1fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class Uniform1fvLocation extends UniformLocation {
6 | public Uniform1fvLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, float... value) {
11 | gl.glUniform1fv(location(), 1, value, 0);
12 | }
13 |
14 | public void put(GL2ES2 gl, int count, float... value) {
15 | gl.glUniform1fv(location(), count, value, 0);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/Uniform1ivLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class Uniform1ivLocation extends UniformLocation {
6 | public Uniform1ivLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, int... value) {
11 | gl.glUniform1iv(location(), 1, value, 0);
12 | }
13 | }
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/Uniform2fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class Uniform2fvLocation extends UniformLocation {
6 | public Uniform2fvLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, float... value) {
11 | gl.glUniform2fv(location(), 1, value, 0);
12 | }
13 |
14 | public void put(GL2ES2 gl, int count, float... value) {
15 | gl.glUniform2fv(location(), count, value, 0);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/Uniform3fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class Uniform3fvLocation extends UniformLocation {
6 | public Uniform3fvLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, float... value) {
11 | gl.glUniform3fv(location(), 1, value, 0);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/Uniform4fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import java.awt.Color;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class Uniform4fvLocation extends UniformLocation {
8 | public Uniform4fvLocation(String name) {
9 | super(name);
10 | }
11 |
12 | public void put(GL2ES2 gl, float... value) {
13 | gl.glUniform4fv(location(), 1, value, 0);
14 | }
15 |
16 | public void putColor(GL2ES2 gl, Color color) {
17 | put(gl, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/UniformLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class UniformLocation extends GLLocation {
6 | public UniformLocation(String name) {
7 | super(name);
8 | }
9 |
10 | @Override
11 | public void update(GL2ES2 gl, int program) {
12 | location = gl.glGetUniformLocation(program, name);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/UniformMatrix3fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class UniformMatrix3fvLocation extends UniformLocation {
6 | public UniformMatrix3fvLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, float... value) {
11 | gl.glUniformMatrix3fv(location(), 1, false, value, 0);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/shader/UniformMatrix4fvLocation.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.shader;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class UniformMatrix4fvLocation extends UniformLocation {
6 | public UniformMatrix4fvLocation(String name) {
7 | super(name);
8 | }
9 |
10 | public void put(GL2ES2 gl, float... value) {
11 | gl.glUniformMatrix4fv(location(), 1, false, value, 0);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public abstract interface Uniform {
6 | public abstract void put(GL2ES2 gl, int location);
7 | }
8 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform1fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.Uniform1fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class Uniform1fv implements Uniform {
8 | int count = 1;
9 | float[] value;
10 | int value_offset;
11 |
12 | public Uniform1fv count(int count) {
13 | this.count = count;
14 | return this;
15 | }
16 |
17 | @Override
18 | public void put(GL2ES2 gl, int location) {
19 | gl.glUniform1fv(location, count, value, value_offset);
20 | }
21 |
22 | public Uniform1fv value(float... value) {
23 | this.value = value;
24 | return this;
25 | }
26 |
27 | public float[] value() {
28 | return value;
29 | }
30 |
31 | public Uniform1fv value_offset(int value_offset) {
32 | this.value_offset = value_offset;
33 | return this;
34 | }
35 |
36 | public void put(GL2ES2 gl, Uniform1fvLocation location) {
37 | put(gl, location.location());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform1iv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import com.jogamp.opengl.GL2ES2;
4 |
5 | public class Uniform1iv implements Uniform {
6 | int count = 1;
7 | int[] value;
8 | int value_offset;
9 |
10 | public Uniform1iv count(int count) {
11 | this.count = count;
12 | return this;
13 | }
14 |
15 | @Override
16 | public void put(GL2ES2 gl, int location) {
17 | gl.glUniform1iv(location, count, value, value_offset);
18 | }
19 |
20 | public Uniform1iv value(int... value) {
21 | this.value = value;
22 | return this;
23 | }
24 |
25 | public int[] value() {
26 | return value;
27 | }
28 |
29 | public Uniform1iv value_offset(int value_offset) {
30 | this.value_offset = value_offset;
31 | return this;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform2fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.Uniform2fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class Uniform2fv implements Uniform {
8 | int count = 1;
9 | float[] value;
10 | int value_offset;
11 |
12 | public Uniform2fv count(int count) {
13 | this.count = count;
14 | return this;
15 | }
16 |
17 | @Override
18 | public void put(GL2ES2 gl, int location) {
19 | gl.glUniform2fv(location, count, value, value_offset);
20 | }
21 |
22 | public Uniform2fv value(float... value) {
23 | this.value = value;
24 | return this;
25 | }
26 |
27 | public float[] value() {
28 | return value;
29 | }
30 |
31 | public Uniform2fv value_offset(int value_offset) {
32 | this.value_offset = value_offset;
33 | return this;
34 | }
35 |
36 | public void put(GL2ES2 gl, Uniform2fvLocation location) {
37 | put(gl, location.location());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform3fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.Uniform3fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class Uniform3fv implements Uniform {
8 | int count = 1;
9 | float[] value;
10 | int value_offset;
11 |
12 | public Uniform3fv count(int count) {
13 | this.count = count;
14 | return this;
15 | }
16 |
17 | @Override
18 | public void put(GL2ES2 gl, int location) {
19 | gl.glUniform3fv(location, count, value, value_offset);
20 | }
21 |
22 | public Uniform3fv value(float... value) {
23 | this.value = value;
24 | return this;
25 | }
26 |
27 | public float[] value() {
28 | return value;
29 | }
30 |
31 | public Uniform3fv value_offset(int value_offset) {
32 | this.value_offset = value_offset;
33 | return this;
34 | }
35 |
36 | public void put(GL2ES2 gl, Uniform3fvLocation location) {
37 | put(gl, location.location());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/Uniform4fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.Uniform4fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class Uniform4fv implements Uniform {
8 | int count = 1;
9 | float[] value;
10 | int value_offset;
11 |
12 | public Uniform4fv count(int count) {
13 | this.count = count;
14 | return this;
15 | }
16 |
17 | @Override
18 | public void put(GL2ES2 gl, int location) {
19 | gl.glUniform4fv(location, count, value, value_offset);
20 | }
21 |
22 | public Uniform4fv value(float... value) {
23 | this.value = value;
24 | return this;
25 | }
26 |
27 | public float[] value() {
28 | return value;
29 | }
30 |
31 | public Uniform4fv value_offset(int value_offset) {
32 | this.value_offset = value_offset;
33 | return this;
34 | }
35 |
36 | public void put(GL2ES2 gl, Uniform4fvLocation location) {
37 | put(gl, location.location());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/UniformMatrix3fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.UniformMatrix3fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class UniformMatrix3fv implements Uniform {
8 | int count;
9 | boolean transpose;
10 | float[] value;
11 | int value_offset;
12 |
13 | public UniformMatrix3fv count(int count) {
14 | this.count = count;
15 | return this;
16 | }
17 |
18 | @Override
19 | public void put(GL2ES2 gl, int location) {
20 | gl.glUniformMatrix3fv(location, count, transpose, value, value_offset);
21 | }
22 |
23 | public UniformMatrix3fv transpose(boolean transpose) {
24 | this.transpose = transpose;
25 | return this;
26 | }
27 |
28 | public UniformMatrix3fv value(float[] value) {
29 | this.value = value;
30 | return this;
31 | }
32 |
33 | public float[] value() {
34 | return value;
35 | }
36 |
37 | public UniformMatrix3fv value_offset(int value_offset) {
38 | this.value_offset = value_offset;
39 | return this;
40 | }
41 |
42 | public void put(GL2ES2 gl, UniformMatrix3fvLocation location) {
43 | put(gl, location.location());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/andork-jogl-gl2es2-utils/src/org/andork/jogl/uniform/UniformMatrix4fv.java:
--------------------------------------------------------------------------------
1 | package org.andork.jogl.uniform;
2 |
3 | import org.andork.jogl.shader.UniformMatrix4fvLocation;
4 |
5 | import com.jogamp.opengl.GL2ES2;
6 |
7 | public class UniformMatrix4fv implements Uniform {
8 | int count;
9 | boolean transpose;
10 | float[] value;
11 | int value_offset;
12 |
13 | public UniformMatrix4fv count(int count) {
14 | this.count = count;
15 | return this;
16 | }
17 |
18 | @Override
19 | public void put(GL2ES2 gl, int location) {
20 | gl.glUniformMatrix4fv(location, count, transpose, value, value_offset);
21 | }
22 |
23 | public UniformMatrix4fv transpose(boolean transpose) {
24 | this.transpose = transpose;
25 | return this;
26 | }
27 |
28 | public UniformMatrix4fv value(float[] value) {
29 | this.value = value;
30 | return this;
31 | }
32 |
33 | public float[] value() {
34 | return value;
35 | }
36 |
37 | public UniformMatrix4fv value_offset(int value_offset) {
38 | this.value_offset = value_offset;
39 | return this;
40 | }
41 |
42 | public void put(GL2ES2 gl, UniformMatrix4fvLocation location) {
43 | put(gl, location.location());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/andork-math/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/andork-math/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-math/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-math
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-math/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | org.andork
4 | andork-math
5 | 0.0.0-SNAPSHOT
6 |
7 | src
8 |
9 |
10 | maven-compiler-plugin
11 | 3.3
12 |
13 | 1.8
14 | 1.8
15 |
16 |
17 |
18 |
19 |
20 |
21 | javax.vecmath
22 | vecmath
23 | 1.5.2
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/andork-math3d/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-math3d/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-math3d
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-math3d/test/org/andork/math3d/NormalGenerator3fTest.java:
--------------------------------------------------------------------------------
1 | package org.andork.math3d;
2 |
3 | import org.andork.math3d.NormalGenerator3f.MeshBuilder;
4 | import org.andork.math3d.NormalGenerator3f.Triangle;
5 | import org.junit.Assert;
6 | import org.junit.Test;
7 |
8 | public class NormalGenerator3fTest {
9 | @Test
10 | public void test001() {
11 | MeshBuilder mesh = new MeshBuilder();
12 |
13 | Triangle side = mesh.add(1, 0, 0, 0, 1, 0, -1, 0, 0);
14 |
15 | float SQRT_2_2 = (float) Math.sqrt(2) / 2;
16 | Triangle t1 = mesh.add(-1, 0, 0, 0, 1, 0, -SQRT_2_2, 0, SQRT_2_2);
17 | Triangle t2 = mesh.add(-SQRT_2_2, 0, SQRT_2_2, 0, 1, 0, 0, 0, 1);
18 | Triangle t3 = mesh.add(0, 0, 1, 0, 1, 0, SQRT_2_2, 0, SQRT_2_2);
19 | Triangle t4 = mesh.add(SQRT_2_2, 0, SQRT_2_2, 0, 1, 0, 1, 0, 0);
20 |
21 | Triangle[] triangles = mesh.getTriangles();
22 |
23 | NormalGenerator3f generator = new NormalGenerator3f(triangles);
24 | generator.foldAngle(Math.PI / 2);
25 | generator.foldSharpness(1);
26 | int vertexCount = generator.generateNormals();
27 | Assert.assertEquals(9, vertexCount);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/andork-plot/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-plot/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-plot
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-plot/src/com/andork/plot/link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-plot/src/com/andork/plot/link.png
--------------------------------------------------------------------------------
/andork-plot/src/com/andork/plot/unlink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-plot/src/com/andork/plot/unlink.png
--------------------------------------------------------------------------------
/andork-qh2/dist/lib/andork-qh2-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-qh2/dist/lib/andork-qh2-sources.jar
--------------------------------------------------------------------------------
/andork-qh2/dist/lib/andork-qh2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-qh2/dist/lib/andork-qh2.jar
--------------------------------------------------------------------------------
/andork-qh2/dist/lib/h2-1.3.176.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-qh2/dist/lib/h2-1.3.176.jar
--------------------------------------------------------------------------------
/andork-qh2/dist/lib/iciql-1.2.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-qh2/dist/lib/iciql-1.2.0.jar
--------------------------------------------------------------------------------
/andork-spatial/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-spatial/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-spatial
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-ui-debug/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/andork-ui-debug/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-ui-debug/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-ui-debug
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/delete-node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/delete-node.png
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/insert-child.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/insert-child.png
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/insert-sibling.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/insert-sibling.png
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/new.png
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/nullify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/nullify.png
--------------------------------------------------------------------------------
/andork-ui-debug/src/org/andork/ui/debug/remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jedwards1211/breakout/89429b4c7a49af124871a5c3a29f5f1e468b1402/andork-ui-debug/src/org/andork/ui/debug/remove.png
--------------------------------------------------------------------------------
/andork-ui-test/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/andork-ui-test/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-ui-test/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-ui-test
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-ui/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /build
3 | /dist
4 | .settings
5 | /target/
6 |
--------------------------------------------------------------------------------
/andork-ui/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | andork-ui
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.jdt.core.javanature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/andork-ui/src/org/andork/awt/FontMetricsUtils.java:
--------------------------------------------------------------------------------
1 | package org.andork.awt;
2 |
3 | import java.awt.Font;
4 | import java.awt.font.FontRenderContext;
5 | import java.awt.geom.Rectangle2D;
6 |
7 | public class FontMetricsUtils {
8 |
9 | private FontMetricsUtils() {
10 | }
11 |
12 | public static Rectangle2D getMultilineStringBounds(String s, Font font, FontRenderContext frc) {
13 | return getMultilineStringBounds(s.split("\r\n?|\n"), font, frc);
14 | }
15 |
16 | public static Rectangle2D getMultilineStringBounds(String[] lines, Font font, FontRenderContext frc) {
17 | Rectangle2D bounds = font.getStringBounds(lines[0], frc);
18 | for (int i = 1; i < lines.length; i++) {
19 | Rectangle2D nextBounds = font.getStringBounds(lines[i], frc);
20 | bounds.setFrame(
21 | bounds.getX(),
22 | bounds.getY(),
23 | Math.max(bounds.getWidth(), nextBounds.getWidth()),
24 | bounds.getHeight() + nextBounds.getHeight()
25 | );
26 | }
27 | return bounds;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/andork-ui/src/org/andork/awt/KeyEvents.java:
--------------------------------------------------------------------------------
1 | package org.andork.awt;
2 |
3 | import java.awt.event.KeyEvent;
4 | import java.util.regex.Pattern;
5 |
6 | public class KeyEvents {
7 | private static final boolean isMacOS = Pattern.compile("\\bmac|\\bos\\s*x\\b", Pattern.CASE_INSENSITIVE)
8 | .matcher(System.getProperty("os.name")).find();
9 |
10 | public static final int CTRL_OR_META_DOWN_MASK = isMacOS
11 | ? KeyEvent.META_DOWN_MASK
12 | : KeyEvent.CTRL_DOWN_MASK;
13 | }
14 |
--------------------------------------------------------------------------------
/andork-ui/src/org/andork/awt/event/WheelEventAggregator.java:
--------------------------------------------------------------------------------
1 | package org.andork.awt.event;
2 |
3 | import java.awt.event.MouseAdapter;
4 | import java.awt.event.MouseWheelEvent;
5 |
6 | import javax.swing.SwingUtilities;
7 |
8 | public class WheelEventAggregator extends MouseAdapter {
9 | boolean queued = false;
10 | double queuedRotation = 0.0;
11 | Callback callback;
12 |
13 | public WheelEventAggregator(Callback callback) {
14 | this.callback = callback;
15 | }
16 |
17 | public static interface Callback {
18 | public void mouseWheelMoved(double rotation);
19 | }
20 |
21 | @Override
22 | public void mouseWheelMoved(MouseWheelEvent e) {
23 | double rotation = e.getPreciseWheelRotation();
24 | if ((rotation >= 0) != (queuedRotation >= 0)) {
25 | queuedRotation = 0;
26 | }
27 | queuedRotation += rotation;
28 |
29 | if (!queued) {
30 | queued = true;
31 | SwingUtilities.invokeLater(() -> {
32 | double totalRotation = queuedRotation;
33 | queuedRotation = 0f;
34 | queued = false;
35 | callback.mouseWheelMoved(totalRotation);
36 | });
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/andork-ui/src/org/andork/awt/layout/DrawerHolder.java:
--------------------------------------------------------------------------------
1 | package org.andork.awt.layout;
2 |
3 | import java.util.WeakHashMap;
4 |
5 | public class DrawerHolder {
6 | private DrawerLayoutDelegate delegate;
7 | private boolean animate;
8 |
9 | private final WeakHashMap