diff --git a/.gitignore b/.gitignore index b77d7132..51f3f6bc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,23 @@ /AccessorVis /JglTF /jgltf-jgltfifier +/jgltf-asset-creator + +# Preliminary for extension experiments: +# --- /jgltf-impl-v2-khr-lights-punctual +/jgltf-impl-v2-khr-materials-variants +/jgltf-impl-v2-khr-materials-clearcoat +/jgltf-impl-v2-khr-texture-transform +/jgltf-impl-v2-ext-draco-mesh-compression + /jgltf-model-khr-lights-punctual -/jgltf-asset-creator +/jgltf-model-khr-materials-variants +/jgltf-model-khr-materials-clearcoat/ +/jgltf-model-khr-texture-transform + +/jgltf-draco-test +# --- /jgltf-browser/.classpath /jgltf-browser/.settings diff --git a/jgltf-browser/src/main/java/de/javagl/jgltf/browser/ExternalCameraRendering.java b/jgltf-browser/src/main/java/de/javagl/jgltf/browser/ExternalCameraRendering.java index 239ced8b..67a350af 100644 --- a/jgltf-browser/src/main/java/de/javagl/jgltf/browser/ExternalCameraRendering.java +++ b/jgltf-browser/src/main/java/de/javagl/jgltf/browser/ExternalCameraRendering.java @@ -72,12 +72,12 @@ class ExternalCameraRendering implements RenderedCamera /** * The view matrix */ - private final float viewMatrix[]; + private final double viewMatrix[]; /** * The projection matrix */ - private final float projectionMatrix[]; + private final double projectionMatrix[]; /** * A listener for the {@link #component} that will update the aspect @@ -100,8 +100,8 @@ public void componentResized(ComponentEvent e) ExternalCameraRendering() { this.view = Views.create(); - this.viewMatrix = new float[16]; - this.projectionMatrix = new float[16]; + this.viewMatrix = new double[16]; + this.projectionMatrix = new double[16]; view.getCamera().addCameraListener(new CameraListener() { @@ -118,7 +118,7 @@ public void cameraChanged(Camera camera) } @Override - public float[] getViewMatrix() + public double[] getViewMatrix() { Matrix4f m = CameraUtils.computeViewMatrix(view.getCamera()); writeMatrixToArrayColumnMajor4f(m, viewMatrix, 0); @@ -126,7 +126,7 @@ public float[] getViewMatrix() } @Override - public float[] getProjectionMatrix() + public double[] getProjectionMatrix() { Matrix4f m = view.getProjectionMatrix(); writeMatrixToArrayColumnMajor4f(m, projectionMatrix, 0); @@ -143,7 +143,7 @@ public float[] getProjectionMatrix() * @param offset The offset where to start writing into the array */ private static void writeMatrixToArrayColumnMajor4f( - Matrix4f m, float a[], int offset) + Matrix4f m, double a[], int offset) { int i = offset; a[i++] = m.m00; @@ -264,18 +264,18 @@ private static void fitCamera(Camera camera, GltfModel gltfModel) // generously moves the camera so that for usual scenes // everything is visible, regardless of the aspect ratio - float minMax[] = BoundingBoxes.computeBoundingBoxMinMax(gltfModel); + double minMax[] = BoundingBoxes.computeBoundingBoxMinMax(gltfModel); // Compute diagonal length and center of the bounding box Point3f min = new Point3f(); - min.x = minMax[0]; - min.y = minMax[1]; - min.z = minMax[2]; + min.x = (float)minMax[0]; + min.y = (float)minMax[1]; + min.z = (float)minMax[2]; Point3f max = new Point3f(); - max.x = minMax[3]; - max.y = minMax[4]; - max.z = minMax[5]; + max.x = (float)minMax[3]; + max.y = (float)minMax[4]; + max.z = (float)minMax[5]; float diagonalLength = max.distance(min); diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Accessor.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Accessor.java index fc1b97d0..a8d35703 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Accessor.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Accessor.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -59,8 +59,7 @@ public class Accessor /** * Specifies if the attribute is a scalar, vector, or matrix. * (required)
- * Valid values: ["SCALAR", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", - * "MAT4"] + * Valid values: [SCALAR, VEC2, VEC3, VEC4, MAT2, MAT3, MAT4] * */ private String type; @@ -256,8 +255,7 @@ public Integer getCount() { /** * Specifies if the attribute is a scalar, vector, or matrix. * (required)
- * Valid values: ["SCALAR", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", - * "MAT4"] + * Valid values: [SCALAR, VEC2, VEC3, VEC4, MAT2, MAT3, MAT4] * * @param type The type to set * @throws NullPointerException If the given value is null @@ -270,7 +268,7 @@ public void setType(String type) { throw new NullPointerException((("Invalid value for type: "+ type)+", may not be null")); } if (((((((!"SCALAR".equals(type))&&(!"VEC2".equals(type)))&&(!"VEC3".equals(type)))&&(!"VEC4".equals(type)))&&(!"MAT2".equals(type)))&&(!"MAT3".equals(type)))&&(!"MAT4".equals(type))) { - throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [\"SCALAR\", \"VEC2\", \"VEC3\", \"VEC4\", \"MAT2\", \"MAT3\", \"MAT4\"]")); + throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [SCALAR, VEC2, VEC3, VEC4, MAT2, MAT3, MAT4]")); } this.type = type; } @@ -278,8 +276,7 @@ public void setType(String type) { /** * Specifies if the attribute is a scalar, vector, or matrix. * (required)
- * Valid values: ["SCALAR", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", - * "MAT4"] + * Valid values: [SCALAR, VEC2, VEC3, VEC4, MAT2, MAT3, MAT4] * * @return The type * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Animation.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Animation.java index 7ca8d705..ab481e68 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Animation.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Animation.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannel.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannel.java index cd4addf4..d3ade8e1 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannel.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannel.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannelTarget.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannelTarget.java index cee3dcb1..dd30f310 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannelTarget.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationChannelTarget.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -27,7 +27,7 @@ public class AnimationChannelTarget private String id; /** * The name of the node's TRS property to modify. (required)
- * Valid values: ["translation", "rotation", "scale"] + * Valid values: [translation, rotation, scale] * */ private String path; @@ -58,7 +58,7 @@ public String getId() { /** * The name of the node's TRS property to modify. (required)
- * Valid values: ["translation", "rotation", "scale"] + * Valid values: [translation, rotation, scale] * * @param path The path to set * @throws NullPointerException If the given value is null @@ -71,14 +71,14 @@ public void setPath(String path) { throw new NullPointerException((("Invalid value for path: "+ path)+", may not be null")); } if (((!"translation".equals(path))&&(!"rotation".equals(path)))&&(!"scale".equals(path))) { - throw new IllegalArgumentException((("Invalid value for path: "+ path)+", valid: [\"translation\", \"rotation\", \"scale\"]")); + throw new IllegalArgumentException((("Invalid value for path: "+ path)+", valid: [translation, rotation, scale]")); } this.path = path; } /** * The name of the node's TRS property to modify. (required)
- * Valid values: ["translation", "rotation", "scale"] + * Valid values: [translation, rotation, scale] * * @return The path * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationSampler.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationSampler.java index 2530a37b..965b16dc 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationSampler.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AnimationSampler.java @@ -1,10 +1,10 @@ -/* - * glTF JSON model - * - * Do not modify this class. It is automatically generated - * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de - */ +/* + * glTF JSON model + * + * Do not modify this class. It is automatically generated + * with JsonModelGen (https://github.com/javagl/JsonModelGen) + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de + */ package de.javagl.jgltf.impl.v1; @@ -30,7 +30,7 @@ public class AnimationSampler /** * Interpolation algorithm. (optional)
* Default: "LINEAR"
- * Valid values: ["LINEAR", "STEP"] + * Valid values: [LINEAR] * */ private String interpolation; @@ -70,7 +70,7 @@ public String getInput() { /** * Interpolation algorithm. (optional)
* Default: "LINEAR"
- * Valid values: ["LINEAR"] + * Valid values: [LINEAR] * * @param interpolation The interpolation to set * @throws IllegalArgumentException If the given value does not meet @@ -82,8 +82,8 @@ public void setInterpolation(String interpolation) { this.interpolation = interpolation; return ; } - if ((!"LINEAR".equals(interpolation))&&(!"STEP".equals(interpolation))) { - throw new IllegalArgumentException((("Invalid value for interpolation: "+ interpolation)+", valid: [\"LINEAR\", \"STEP\"]")); + if (!"LINEAR".equals(interpolation)) { + throw new IllegalArgumentException((("Invalid value for interpolation: "+ interpolation)+", valid: [LINEAR]")); } this.interpolation = interpolation; } @@ -91,7 +91,7 @@ public void setInterpolation(String interpolation) { /** * Interpolation algorithm. (optional)
* Default: "LINEAR"
- * Valid values: ["LINEAR"] + * Valid values: [LINEAR] * * @return The interpolation * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Asset.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Asset.java index db3336bf..2e22fae2 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Asset.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Asset.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AssetProfile.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AssetProfile.java index 1da21659..cdce1691 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AssetProfile.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/AssetProfile.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Buffer.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Buffer.java index 12030df0..a0a807aa 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Buffer.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Buffer.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -35,7 +35,7 @@ public class Buffer /** * XMLHttpRequest `responseType`. (optional)
* Default: "arraybuffer"
- * Valid values: ["arraybuffer", "text"] + * Valid values: [arraybuffer, text] * */ private String type; @@ -111,7 +111,7 @@ public Integer defaultByteLength() { /** * XMLHttpRequest `responseType`. (optional)
* Default: "arraybuffer"
- * Valid values: ["arraybuffer", "text"] + * Valid values: [arraybuffer, text] * * @param type The type to set * @throws IllegalArgumentException If the given value does not meet @@ -124,7 +124,7 @@ public void setType(String type) { return ; } if ((!"arraybuffer".equals(type))&&(!"text".equals(type))) { - throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [\"arraybuffer\", \"text\"]")); + throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [arraybuffer, text]")); } this.type = type; } @@ -132,7 +132,7 @@ public void setType(String type) { /** * XMLHttpRequest `responseType`. (optional)
* Default: "arraybuffer"
- * Valid values: ["arraybuffer", "text"] + * Valid values: [arraybuffer, text] * * @return The type * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/BufferView.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/BufferView.java index f2204eab..5a74f7ed 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/BufferView.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/BufferView.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Camera.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Camera.java index 718e72a6..2453b1d1 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Camera.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Camera.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -36,7 +36,7 @@ public class Camera /** * Specifies if the camera uses a perspective or orthographic projection. * (required)
- * Valid values: ["perspective", "orthographic"] + * Valid values: [perspective, orthographic] * */ private String type; @@ -96,7 +96,7 @@ public CameraPerspective getPerspective() { /** * Specifies if the camera uses a perspective or orthographic projection. * (required)
- * Valid values: ["perspective", "orthographic"] + * Valid values: [perspective, orthographic] * * @param type The type to set * @throws NullPointerException If the given value is null @@ -109,7 +109,7 @@ public void setType(String type) { throw new NullPointerException((("Invalid value for type: "+ type)+", may not be null")); } if ((!"perspective".equals(type))&&(!"orthographic".equals(type))) { - throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [\"perspective\", \"orthographic\"]")); + throw new IllegalArgumentException((("Invalid value for type: "+ type)+", valid: [perspective, orthographic]")); } this.type = type; } @@ -117,7 +117,7 @@ public void setType(String type) { /** * Specifies if the camera uses a perspective or orthographic projection. * (required)
- * Valid values: ["perspective", "orthographic"] + * Valid values: [perspective, orthographic] * * @return The type * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraOrthographic.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraOrthographic.java index 3a3d5cc1..ef14bdf3 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraOrthographic.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraOrthographic.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -25,24 +25,24 @@ public class CameraOrthographic * The floating-point horizontal magnification of the view. (required) * */ - private Float xmag; + private Double xmag; /** * The floating-point vertical magnification of the view. (required) * */ - private Float ymag; + private Double ymag; /** * The floating-point distance to the far clipping plane. (required)
* Minimum: 0.0 (inclusive) * */ - private Float zfar; + private Double zfar; /** * The floating-point distance to the near clipping plane. (required)
* Minimum: 0.0 (inclusive) * */ - private Float znear; + private Double znear; /** * The floating-point horizontal magnification of the view. (required) @@ -51,7 +51,7 @@ public class CameraOrthographic * @throws NullPointerException If the given value is null * */ - public void setXmag(Float xmag) { + public void setXmag(Double xmag) { if (xmag == null) { throw new NullPointerException((("Invalid value for xmag: "+ xmag)+", may not be null")); } @@ -64,7 +64,7 @@ public void setXmag(Float xmag) { * @return The xmag * */ - public Float getXmag() { + public Double getXmag() { return this.xmag; } @@ -75,7 +75,7 @@ public Float getXmag() { * @throws NullPointerException If the given value is null * */ - public void setYmag(Float ymag) { + public void setYmag(Double ymag) { if (ymag == null) { throw new NullPointerException((("Invalid value for ymag: "+ ymag)+", may not be null")); } @@ -88,7 +88,7 @@ public void setYmag(Float ymag) { * @return The ymag * */ - public Float getYmag() { + public Double getYmag() { return this.ymag; } @@ -102,7 +102,7 @@ public Float getYmag() { * the given constraints * */ - public void setZfar(Float zfar) { + public void setZfar(Double zfar) { if (zfar == null) { throw new NullPointerException((("Invalid value for zfar: "+ zfar)+", may not be null")); } @@ -119,7 +119,7 @@ public void setZfar(Float zfar) { * @return The zfar * */ - public Float getZfar() { + public Double getZfar() { return this.zfar; } @@ -133,7 +133,7 @@ public Float getZfar() { * the given constraints * */ - public void setZnear(Float znear) { + public void setZnear(Double znear) { if (znear == null) { throw new NullPointerException((("Invalid value for znear: "+ znear)+", may not be null")); } @@ -150,7 +150,7 @@ public void setZnear(Float znear) { * @return The znear * */ - public Float getZnear() { + public Double getZnear() { return this.znear; } diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraPerspective.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraPerspective.java index 428cfbb8..aabf01de 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraPerspective.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/CameraPerspective.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -26,25 +26,23 @@ public class CameraPerspective * Minimum: 0.0 (inclusive) * */ - private Float aspectRatio; + private Double aspectRatio; /** * The floating-point vertical field of view in radians. (required)
* Minimum: 0.0 (inclusive) * */ - private Float yfov; + private Double yfov; /** - * The floating-point distance to the far clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the far clipping plane. (required) * */ - private Float zfar; + private Double zfar; /** - * The floating-point distance to the near clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the near clipping plane. (required) * */ - private Float znear; + private Double znear; /** * The floating-point aspect ratio of the field of view. (optional)
@@ -55,7 +53,7 @@ public class CameraPerspective * the given constraints * */ - public void setAspectRatio(Float aspectRatio) { + public void setAspectRatio(Double aspectRatio) { if (aspectRatio == null) { this.aspectRatio = aspectRatio; return ; @@ -73,7 +71,7 @@ public void setAspectRatio(Float aspectRatio) { * @return The aspectRatio * */ - public Float getAspectRatio() { + public Double getAspectRatio() { return this.aspectRatio; } @@ -87,7 +85,7 @@ public Float getAspectRatio() { * the given constraints * */ - public void setYfov(Float yfov) { + public void setYfov(Double yfov) { if (yfov == null) { throw new NullPointerException((("Invalid value for yfov: "+ yfov)+", may not be null")); } @@ -104,69 +102,55 @@ public void setYfov(Float yfov) { * @return The yfov * */ - public Float getYfov() { + public Double getYfov() { return this.yfov; } /** - * The floating-point distance to the far clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the far clipping plane. (required) * * @param zfar The zfar to set * @throws NullPointerException If the given value is null - * @throws IllegalArgumentException If the given value does not meet - * the given constraints * */ - public void setZfar(Float zfar) { + public void setZfar(Double zfar) { if (zfar == null) { throw new NullPointerException((("Invalid value for zfar: "+ zfar)+", may not be null")); } - if (zfar<= 0.0D) { - throw new IllegalArgumentException("zfar <= 0.0"); - } this.zfar = zfar; } /** - * The floating-point distance to the far clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the far clipping plane. (required) * * @return The zfar * */ - public Float getZfar() { + public Double getZfar() { return this.zfar; } /** - * The floating-point distance to the near clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the near clipping plane. (required) * * @param znear The znear to set * @throws NullPointerException If the given value is null - * @throws IllegalArgumentException If the given value does not meet - * the given constraints * */ - public void setZnear(Float znear) { + public void setZnear(Double znear) { if (znear == null) { throw new NullPointerException((("Invalid value for znear: "+ znear)+", may not be null")); } - if (znear<= 0.0D) { - throw new IllegalArgumentException("znear <= 0.0"); - } this.znear = znear; } /** - * The floating-point distance to the near clipping plane. (required)
- * Minimum: 0.0 (exclusive) + * The floating-point distance to the near clipping plane. (required) * * @return The znear * */ - public Float getZnear() { + public Double getZnear() { return this.znear; } diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTF.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTF.java index db8a62a3..5073ed71 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTF.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTF.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFChildOfRootProperty.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFChildOfRootProperty.java index e2246341..82aa9ba9 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFChildOfRootProperty.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFChildOfRootProperty.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFProperty.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFProperty.java index 50b4e1fd..22aba2b7 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFProperty.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/GlTFProperty.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -19,18 +19,18 @@ public class GlTFProperty { /** - * Dictionary object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * */ private Map extensions; /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * */ private Object extras; /** - * Dictionary object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * * @param extensions The extensions to set * @@ -44,7 +44,7 @@ public void setExtensions(Map extensions) { } /** - * Dictionary object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * * @return The extensions * @@ -108,7 +108,7 @@ public void removeExtensions(String key) { } /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * * @param extras The extras to set * @@ -122,7 +122,7 @@ public void setExtras(Object extras) { } /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * * @return The extras * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Image.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Image.java index d35d535b..84ee85e6 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Image.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Image.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Material.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Material.java index 12540f3d..60bc7569 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Material.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Material.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Mesh.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Mesh.java index 640efadc..58c650d9 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Mesh.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Mesh.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/MeshPrimitive.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/MeshPrimitive.java index 351849cb..b8e863e9 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/MeshPrimitive.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/MeshPrimitive.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Node.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Node.java index 04c395b1..72275bd6 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Node.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Node.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -75,7 +75,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] matrix; + private double[] matrix; /** * The IDs of the meshes in this node. (optional)
* Array elements:
@@ -92,7 +92,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] rotation; + private double[] rotation; /** * The node's non-uniform scale. (optional)
* Default: [1.0,1.0,1.0]
@@ -101,7 +101,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] scale; + private double[] scale; /** * The node's translation. (optional)
* Default: [0.0,0.0,0.0]
@@ -110,7 +110,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] translation; + private double[] translation; /** * The ID of the camera referenced by this node. (optional) @@ -367,7 +367,7 @@ public String getJointName() { * the given constraints * */ - public void setMatrix(float[] matrix) { + public void setMatrix(double[] matrix) { if (matrix == null) { this.matrix = matrix; return ; @@ -393,7 +393,7 @@ public void setMatrix(float[] matrix) { * @return The matrix * */ - public float[] getMatrix() { + public double[] getMatrix() { return this.matrix; } @@ -404,8 +404,8 @@ public float[] getMatrix() { * @return The default matrix * */ - public float[] defaultMatrix() { - return new float[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F }; + public double[] defaultMatrix() { + return new double[] { 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D }; } /** @@ -499,7 +499,7 @@ public void removeMeshes(String element) { * the given constraints * */ - public void setRotation(float[] rotation) { + public void setRotation(double[] rotation) { if (rotation == null) { this.rotation = rotation; return ; @@ -524,7 +524,7 @@ public void setRotation(float[] rotation) { * @return The rotation * */ - public float[] getRotation() { + public double[] getRotation() { return this.rotation; } @@ -535,8 +535,8 @@ public float[] getRotation() { * @return The default rotation * */ - public float[] defaultRotation() { - return new float[] { 0.0F, 0.0F, 0.0F, 1.0F }; + public double[] defaultRotation() { + return new double[] { 0.0D, 0.0D, 0.0D, 1.0D }; } /** @@ -551,7 +551,7 @@ public float[] defaultRotation() { * the given constraints * */ - public void setScale(float[] scale) { + public void setScale(double[] scale) { if (scale == null) { this.scale = scale; return ; @@ -575,7 +575,7 @@ public void setScale(float[] scale) { * @return The scale * */ - public float[] getScale() { + public double[] getScale() { return this.scale; } @@ -586,8 +586,8 @@ public float[] getScale() { * @return The default scale * */ - public float[] defaultScale() { - return new float[] { 1.0F, 1.0F, 1.0F }; + public double[] defaultScale() { + return new double[] { 1.0D, 1.0D, 1.0D }; } /** @@ -602,7 +602,7 @@ public float[] defaultScale() { * the given constraints * */ - public void setTranslation(float[] translation) { + public void setTranslation(double[] translation) { if (translation == null) { this.translation = translation; return ; @@ -626,7 +626,7 @@ public void setTranslation(float[] translation) { * @return The translation * */ - public float[] getTranslation() { + public double[] getTranslation() { return this.translation; } @@ -637,8 +637,8 @@ public float[] getTranslation() { * @return The default translation * */ - public float[] defaultTranslation() { - return new float[] { 0.0F, 0.0F, 0.0F }; + public double[] defaultTranslation() { + return new double[] { 0.0D, 0.0D, 0.0D }; } } diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Program.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Program.java index 4e5236aa..087f80b0 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Program.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Program.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Sampler.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Sampler.java index 40fa8218..3fefccbc 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Sampler.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Sampler.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Scene.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Scene.java index a1b0bdcd..68d2c3b1 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Scene.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Scene.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Shader.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Shader.java index 3ab6db55..a2a7bb1a 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Shader.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Shader.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Skin.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Skin.java index 9f24fd86..c1cc2790 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Skin.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Skin.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -32,7 +32,7 @@ public class Skin *   The elements of this array (optional) * */ - private float[] bindShapeMatrix; + private double[] bindShapeMatrix; /** * The ID of the accessor containing the floating-point 4x4 inverse-bind * matrices. (required) @@ -62,7 +62,7 @@ public class Skin * the given constraints * */ - public void setBindShapeMatrix(float[] bindShapeMatrix) { + public void setBindShapeMatrix(double[] bindShapeMatrix) { if (bindShapeMatrix == null) { this.bindShapeMatrix = bindShapeMatrix; return ; @@ -88,7 +88,7 @@ public void setBindShapeMatrix(float[] bindShapeMatrix) { * @return The bindShapeMatrix * */ - public float[] getBindShapeMatrix() { + public double[] getBindShapeMatrix() { return this.bindShapeMatrix; } @@ -99,8 +99,8 @@ public float[] getBindShapeMatrix() { * @return The default bindShapeMatrix * */ - public float[] defaultBindShapeMatrix() { - return new float[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F }; + public double[] defaultBindShapeMatrix() { + return new double[] { 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D }; } /** diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Technique.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Technique.java index 9580d312..972b0606 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Technique.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Technique.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueParameters.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueParameters.java index a03f9919..68f6c2b4 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueParameters.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueParameters.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStates.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStates.java index 5c2c84ee..586d006d 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStates.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStates.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -32,8 +32,7 @@ public class TechniqueStates */ private List enable; /** - * Arguments for fixed-function rendering state functions other than - * `enable()`/`disable()`. (optional) + * The functions of this TechniqueStates (optional) * */ private TechniqueStatesFunctions functions; @@ -139,8 +138,7 @@ public List defaultEnable() { } /** - * Arguments for fixed-function rendering state functions other than - * `enable()`/`disable()`. (optional) + * The functions of this TechniqueStates (optional) * * @param functions The functions to set * @@ -154,8 +152,7 @@ public void setFunctions(TechniqueStatesFunctions functions) { } /** - * Arguments for fixed-function rendering state functions other than - * `enable()`/`disable()`. (optional) + * The functions of this TechniqueStates (optional) * * @return The functions * diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStatesFunctions.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStatesFunctions.java index 335c3f93..0b751658 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStatesFunctions.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/TechniqueStatesFunctions.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; @@ -30,7 +30,7 @@ public class TechniqueStatesFunctions *   The elements of this array (optional) * */ - private float[] blendColor; + private double[] blendColor; /** * Integer values passed to `blendEquationSeparate()`. (optional)
* Default: [32774,32774]
@@ -100,7 +100,7 @@ public class TechniqueStatesFunctions *   The elements of this array (optional) * */ - private float[] depthRange; + private double[] depthRange; /** * Integer value passed to `frontFace()`. (optional)
* Default: [2305]
@@ -116,11 +116,10 @@ public class TechniqueStatesFunctions * Default: [1.0]
* Number of items: 1
* Array elements:
- *   The elements of this array (optional)
- *   Minimum: 0.0 (exclusive) + *   The elements of this array (optional) * */ - private float[] lineWidth; + private double[] lineWidth; /** * Floating-point value passed to `polygonOffset()`. [factor, units] * (optional)
@@ -130,7 +129,7 @@ public class TechniqueStatesFunctions *   The elements of this array (optional) * */ - private float[] polygonOffset; + private double[] polygonOffset; /** * Floating-point value passed to `scissor()`. [x, y, width, height]. * (optional)
@@ -140,7 +139,7 @@ public class TechniqueStatesFunctions *   The elements of this array (optional) * */ - private float[] scissor; + private double[] scissor; /** * Floating-point values passed to `blendColor()`. [red, green, blue, @@ -155,7 +154,7 @@ public class TechniqueStatesFunctions * the given constraints * */ - public void setBlendColor(float[] blendColor) { + public void setBlendColor(double[] blendColor) { if (blendColor == null) { this.blendColor = blendColor; return ; @@ -180,7 +179,7 @@ public void setBlendColor(float[] blendColor) { * @return The blendColor * */ - public float[] getBlendColor() { + public double[] getBlendColor() { return this.blendColor; } @@ -191,8 +190,8 @@ public float[] getBlendColor() { * @return The default blendColor * */ - public float[] defaultBlendColor() { - return new float[] { 0.0F, 0.0F, 0.0F, 0.0F }; + public double[] defaultBlendColor() { + return new double[] { 0.0D, 0.0D, 0.0D, 0.0D }; } /** @@ -546,7 +545,7 @@ public boolean[] defaultDepthMask() { * the given constraints * */ - public void setDepthRange(float[] depthRange) { + public void setDepthRange(double[] depthRange) { if (depthRange == null) { this.depthRange = depthRange; return ; @@ -571,7 +570,7 @@ public void setDepthRange(float[] depthRange) { * @return The depthRange * */ - public float[] getDepthRange() { + public double[] getDepthRange() { return this.depthRange; } @@ -582,8 +581,8 @@ public float[] getDepthRange() { * @return The default depthRange * */ - public float[] defaultDepthRange() { - return new float[] { 0.0F, 1.0F }; + public double[] defaultDepthRange() { + return new double[] { 0.0D, 1.0D }; } /** @@ -649,15 +648,14 @@ public int[] defaultFrontFace() { * Default: [1.0]
* Number of items: 1
* Array elements:
- *   The elements of this array (optional)
- *   Minimum: 0.0 (exclusive) + *   The elements of this array (optional) * * @param lineWidth The lineWidth to set * @throws IllegalArgumentException If the given value does not meet * the given constraints * */ - public void setLineWidth(float[] lineWidth) { + public void setLineWidth(double[] lineWidth) { if (lineWidth == null) { this.lineWidth = lineWidth; return ; @@ -668,11 +666,6 @@ public void setLineWidth(float[] lineWidth) { if (lineWidth.length > 1) { throw new IllegalArgumentException("Number of lineWidth elements is > 1"); } - for (float lineWidthElement: lineWidth) { - if (lineWidthElement<= 0.0D) { - throw new IllegalArgumentException("lineWidthElement <= 0.0"); - } - } this.lineWidth = lineWidth; } @@ -681,13 +674,12 @@ public void setLineWidth(float[] lineWidth) { * Default: [1.0]
* Number of items: 1
* Array elements:
- *   The elements of this array (optional)
- *   Minimum: 0.0 (exclusive) + *   The elements of this array (optional) * * @return The lineWidth * */ - public float[] getLineWidth() { + public double[] getLineWidth() { return this.lineWidth; } @@ -698,8 +690,8 @@ public float[] getLineWidth() { * @return The default lineWidth * */ - public float[] defaultLineWidth() { - return new float[] { 1.0F }; + public double[] defaultLineWidth() { + return new double[] { 1.0D }; } /** @@ -715,7 +707,7 @@ public float[] defaultLineWidth() { * the given constraints * */ - public void setPolygonOffset(float[] polygonOffset) { + public void setPolygonOffset(double[] polygonOffset) { if (polygonOffset == null) { this.polygonOffset = polygonOffset; return ; @@ -740,7 +732,7 @@ public void setPolygonOffset(float[] polygonOffset) { * @return The polygonOffset * */ - public float[] getPolygonOffset() { + public double[] getPolygonOffset() { return this.polygonOffset; } @@ -751,8 +743,8 @@ public float[] getPolygonOffset() { * @return The default polygonOffset * */ - public float[] defaultPolygonOffset() { - return new float[] { 0.0F, 0.0F }; + public double[] defaultPolygonOffset() { + return new double[] { 0.0D, 0.0D }; } /** @@ -768,7 +760,7 @@ public float[] defaultPolygonOffset() { * the given constraints * */ - public void setScissor(float[] scissor) { + public void setScissor(double[] scissor) { if (scissor == null) { this.scissor = scissor; return ; @@ -793,7 +785,7 @@ public void setScissor(float[] scissor) { * @return The scissor * */ - public float[] getScissor() { + public double[] getScissor() { return this.scissor; } @@ -804,8 +796,8 @@ public float[] getScissor() { * @return The default scissor * */ - public float[] defaultScissor() { - return new float[] { 0.0F, 0.0F, 0.0F, 0.0F }; + public double[] defaultScissor() { + return new double[] { 0.0D, 0.0D, 0.0D, 0.0D }; } } diff --git a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Texture.java b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Texture.java index 5437bc6a..f8773adf 100644 --- a/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Texture.java +++ b/jgltf-impl-v1/src/main/java/de/javagl/jgltf/impl/v1/Texture.java @@ -3,7 +3,7 @@ * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) - * Copyright (c) 2016 Marco Hutter - http://www.javagl.de + * Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl.v1; diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraOrthographic.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraOrthographic.java index a8b368cc..07a5d90b 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraOrthographic.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraOrthographic.java @@ -27,14 +27,14 @@ public class CameraOrthographic * (required) * */ - private Float xmag; + private Double xmag; /** * The floating-point vertical magnification of the view. This value * **MUST NOT** be equal to zero. This value **SHOULD NOT** be negative. * (required) * */ - private Float ymag; + private Double ymag; /** * The floating-point distance to the far clipping plane. This value * **MUST NOT** be equal to zero. `zfar` **MUST** be greater than @@ -42,13 +42,13 @@ public class CameraOrthographic * Minimum: 0.0 (exclusive) * */ - private Float zfar; + private Double zfar; /** * The floating-point distance to the near clipping plane. (required)
* Minimum: 0.0 (inclusive) * */ - private Float znear; + private Double znear; /** * The floating-point horizontal magnification of the view. This value @@ -59,7 +59,7 @@ public class CameraOrthographic * @throws NullPointerException If the given value is null * */ - public void setXmag(Float xmag) { + public void setXmag(Double xmag) { if (xmag == null) { throw new NullPointerException((("Invalid value for xmag: "+ xmag)+", may not be null")); } @@ -74,7 +74,7 @@ public void setXmag(Float xmag) { * @return The xmag * */ - public Float getXmag() { + public Double getXmag() { return this.xmag; } @@ -87,7 +87,7 @@ public Float getXmag() { * @throws NullPointerException If the given value is null * */ - public void setYmag(Float ymag) { + public void setYmag(Double ymag) { if (ymag == null) { throw new NullPointerException((("Invalid value for ymag: "+ ymag)+", may not be null")); } @@ -102,7 +102,7 @@ public void setYmag(Float ymag) { * @return The ymag * */ - public Float getYmag() { + public Double getYmag() { return this.ymag; } @@ -118,7 +118,7 @@ public Float getYmag() { * the given constraints * */ - public void setZfar(Float zfar) { + public void setZfar(Double zfar) { if (zfar == null) { throw new NullPointerException((("Invalid value for zfar: "+ zfar)+", may not be null")); } @@ -137,7 +137,7 @@ public void setZfar(Float zfar) { * @return The zfar * */ - public Float getZfar() { + public Double getZfar() { return this.zfar; } @@ -151,7 +151,7 @@ public Float getZfar() { * the given constraints * */ - public void setZnear(Float znear) { + public void setZnear(Double znear) { if (znear == null) { throw new NullPointerException((("Invalid value for znear: "+ znear)+", may not be null")); } @@ -168,7 +168,7 @@ public void setZnear(Float znear) { * @return The znear * */ - public Float getZnear() { + public Double getZnear() { return this.znear; } diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraPerspective.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraPerspective.java index ba0ac1c3..edb772ad 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraPerspective.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/CameraPerspective.java @@ -26,26 +26,26 @@ public class CameraPerspective * Minimum: 0.0 (exclusive) * */ - private Float aspectRatio; + private Double aspectRatio; /** * The floating-point vertical field of view in radians. This value * **SHOULD** be less than π. (required)
* Minimum: 0.0 (exclusive) * */ - private Float yfov; + private Double yfov; /** * The floating-point distance to the far clipping plane. (optional)
* Minimum: 0.0 (exclusive) * */ - private Float zfar; + private Double zfar; /** * The floating-point distance to the near clipping plane. (required)
* Minimum: 0.0 (exclusive) * */ - private Float znear; + private Double znear; /** * The floating-point aspect ratio of the field of view. (optional)
@@ -56,7 +56,7 @@ public class CameraPerspective * the given constraints * */ - public void setAspectRatio(Float aspectRatio) { + public void setAspectRatio(Double aspectRatio) { if (aspectRatio == null) { this.aspectRatio = aspectRatio; return ; @@ -74,7 +74,7 @@ public void setAspectRatio(Float aspectRatio) { * @return The aspectRatio * */ - public Float getAspectRatio() { + public Double getAspectRatio() { return this.aspectRatio; } @@ -89,7 +89,7 @@ public Float getAspectRatio() { * the given constraints * */ - public void setYfov(Float yfov) { + public void setYfov(Double yfov) { if (yfov == null) { throw new NullPointerException((("Invalid value for yfov: "+ yfov)+", may not be null")); } @@ -107,7 +107,7 @@ public void setYfov(Float yfov) { * @return The yfov * */ - public Float getYfov() { + public Double getYfov() { return this.yfov; } @@ -120,7 +120,7 @@ public Float getYfov() { * the given constraints * */ - public void setZfar(Float zfar) { + public void setZfar(Double zfar) { if (zfar == null) { this.zfar = zfar; return ; @@ -138,7 +138,7 @@ public void setZfar(Float zfar) { * @return The zfar * */ - public Float getZfar() { + public Double getZfar() { return this.zfar; } @@ -152,7 +152,7 @@ public Float getZfar() { * the given constraints * */ - public void setZnear(Float znear) { + public void setZnear(Double znear) { if (znear == null) { throw new NullPointerException((("Invalid value for znear: "+ znear)+", may not be null")); } @@ -169,7 +169,7 @@ public void setZnear(Float znear) { * @return The znear * */ - public Float getZnear() { + public Double getZnear() { return this.znear; } diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/GlTFProperty.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/GlTFProperty.java index 5a850d4e..a06033a9 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/GlTFProperty.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/GlTFProperty.java @@ -19,18 +19,18 @@ public class GlTFProperty { /** - * JSON object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * */ private Map extensions; /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * */ private Object extras; /** - * JSON object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * * @param extensions The extensions to set * @@ -44,7 +44,7 @@ public void setExtensions(Map extensions) { } /** - * JSON object with extension-specific objects. (optional) + * The extensions of this GlTFProperty (optional) * * @return The extensions * @@ -108,7 +108,7 @@ public void removeExtensions(String key) { } /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * * @param extras The extras to set * @@ -122,7 +122,7 @@ public void setExtras(Object extras) { } /** - * Application-specific data. (optional) + * The extras of this GlTFProperty (optional) * * @return The extras * diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Material.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Material.java index 9e327f92..ed8a7fde 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Material.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Material.java @@ -53,7 +53,7 @@ public class Material *   Maximum: 1.0 (inclusive) * */ - private float[] emissiveFactor; + private double[] emissiveFactor; /** * The alpha rendering mode of the material. (optional)
* Default: "OPAQUE"
@@ -67,7 +67,7 @@ public class Material * Minimum: 0.0 (inclusive) * */ - private Float alphaCutoff; + private Double alphaCutoff; /** * Specifies whether the material is double sided. (optional)
* Default: false @@ -191,7 +191,7 @@ public TextureInfo getEmissiveTexture() { * the given constraints * */ - public void setEmissiveFactor(float[] emissiveFactor) { + public void setEmissiveFactor(double[] emissiveFactor) { if (emissiveFactor == null) { this.emissiveFactor = emissiveFactor; return ; @@ -202,7 +202,7 @@ public void setEmissiveFactor(float[] emissiveFactor) { if (emissiveFactor.length > 3) { throw new IllegalArgumentException("Number of emissiveFactor elements is > 3"); } - for (float emissiveFactorElement: emissiveFactor) { + for (double emissiveFactorElement: emissiveFactor) { if (emissiveFactorElement > 1.0D) { throw new IllegalArgumentException("emissiveFactorElement > 1.0"); } @@ -225,7 +225,7 @@ public void setEmissiveFactor(float[] emissiveFactor) { * @return The emissiveFactor * */ - public float[] getEmissiveFactor() { + public double[] getEmissiveFactor() { return this.emissiveFactor; } @@ -236,8 +236,8 @@ public float[] getEmissiveFactor() { * @return The default emissiveFactor * */ - public float[] defaultEmissiveFactor() { - return new float[] { 0.0F, 0.0F, 0.0F }; + public double[] defaultEmissiveFactor() { + return new double[] { 0.0D, 0.0D, 0.0D }; } /** @@ -294,7 +294,7 @@ public String defaultAlphaMode() { * the given constraints * */ - public void setAlphaCutoff(Float alphaCutoff) { + public void setAlphaCutoff(Double alphaCutoff) { if (alphaCutoff == null) { this.alphaCutoff = alphaCutoff; return ; @@ -313,7 +313,7 @@ public void setAlphaCutoff(Float alphaCutoff) { * @return The alphaCutoff * */ - public Float getAlphaCutoff() { + public Double getAlphaCutoff() { return this.alphaCutoff; } @@ -324,8 +324,8 @@ public Float getAlphaCutoff() { * @return The default alphaCutoff * */ - public Float defaultAlphaCutoff() { - return 0.5F; + public Double defaultAlphaCutoff() { + return 0.5D; } /** diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialNormalTextureInfo.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialNormalTextureInfo.java index ff7323e0..f7694f16 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialNormalTextureInfo.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialNormalTextureInfo.java @@ -24,7 +24,7 @@ public class MaterialNormalTextureInfo * Default: 1.0 * */ - private Float scale; + private Double scale; /** * The scalar parameter applied to each normal vector of the normal @@ -34,7 +34,7 @@ public class MaterialNormalTextureInfo * @param scale The scale to set * */ - public void setScale(Float scale) { + public void setScale(Double scale) { if (scale == null) { this.scale = scale; return ; @@ -50,7 +50,7 @@ public void setScale(Float scale) { * @return The scale * */ - public Float getScale() { + public Double getScale() { return this.scale; } @@ -61,8 +61,8 @@ public Float getScale() { * @return The default scale * */ - public Float defaultScale() { - return 1.0F; + public Double defaultScale() { + return 1.0D; } } diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialOcclusionTextureInfo.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialOcclusionTextureInfo.java index e3f9d3a2..fe6204c1 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialOcclusionTextureInfo.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialOcclusionTextureInfo.java @@ -26,7 +26,7 @@ public class MaterialOcclusionTextureInfo * Maximum: 1.0 (inclusive) * */ - private Float strength; + private Double strength; /** * A scalar multiplier controlling the amount of occlusion applied. @@ -40,7 +40,7 @@ public class MaterialOcclusionTextureInfo * the given constraints * */ - public void setStrength(Float strength) { + public void setStrength(Double strength) { if (strength == null) { this.strength = strength; return ; @@ -64,7 +64,7 @@ public void setStrength(Float strength) { * @return The strength * */ - public Float getStrength() { + public Double getStrength() { return this.strength; } @@ -75,8 +75,8 @@ public Float getStrength() { * @return The default strength * */ - public Float defaultStrength() { - return 1.0F; + public Double defaultStrength() { + return 1.0D; } } diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialPbrMetallicRoughness.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialPbrMetallicRoughness.java index bf4a3394..0e899610 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialPbrMetallicRoughness.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/MaterialPbrMetallicRoughness.java @@ -32,7 +32,7 @@ public class MaterialPbrMetallicRoughness *   Maximum: 1.0 (inclusive) * */ - private float[] baseColorFactor; + private double[] baseColorFactor; /** * The base color texture. (optional) * @@ -45,7 +45,7 @@ public class MaterialPbrMetallicRoughness * Maximum: 1.0 (inclusive) * */ - private Float metallicFactor; + private Double metallicFactor; /** * The factor for the roughness of the material. (optional)
* Default: 1.0
@@ -53,7 +53,7 @@ public class MaterialPbrMetallicRoughness * Maximum: 1.0 (inclusive) * */ - private Float roughnessFactor; + private Double roughnessFactor; /** * The metallic-roughness texture. (optional) * @@ -74,7 +74,7 @@ public class MaterialPbrMetallicRoughness * the given constraints * */ - public void setBaseColorFactor(float[] baseColorFactor) { + public void setBaseColorFactor(double[] baseColorFactor) { if (baseColorFactor == null) { this.baseColorFactor = baseColorFactor; return ; @@ -85,7 +85,7 @@ public void setBaseColorFactor(float[] baseColorFactor) { if (baseColorFactor.length > 4) { throw new IllegalArgumentException("Number of baseColorFactor elements is > 4"); } - for (float baseColorFactorElement: baseColorFactor) { + for (double baseColorFactorElement: baseColorFactor) { if (baseColorFactorElement > 1.0D) { throw new IllegalArgumentException("baseColorFactorElement > 1.0"); } @@ -108,7 +108,7 @@ public void setBaseColorFactor(float[] baseColorFactor) { * @return The baseColorFactor * */ - public float[] getBaseColorFactor() { + public double[] getBaseColorFactor() { return this.baseColorFactor; } @@ -119,8 +119,8 @@ public float[] getBaseColorFactor() { * @return The default baseColorFactor * */ - public float[] defaultBaseColorFactor() { - return new float[] { 1.0F, 1.0F, 1.0F, 1.0F }; + public double[] defaultBaseColorFactor() { + return new double[] { 1.0D, 1.0D, 1.0D, 1.0D }; } /** @@ -158,7 +158,7 @@ public TextureInfo getBaseColorTexture() { * the given constraints * */ - public void setMetallicFactor(Float metallicFactor) { + public void setMetallicFactor(Double metallicFactor) { if (metallicFactor == null) { this.metallicFactor = metallicFactor; return ; @@ -181,7 +181,7 @@ public void setMetallicFactor(Float metallicFactor) { * @return The metallicFactor * */ - public Float getMetallicFactor() { + public Double getMetallicFactor() { return this.metallicFactor; } @@ -192,8 +192,8 @@ public Float getMetallicFactor() { * @return The default metallicFactor * */ - public Float defaultMetallicFactor() { - return 1.0F; + public Double defaultMetallicFactor() { + return 1.0D; } /** @@ -207,7 +207,7 @@ public Float defaultMetallicFactor() { * the given constraints * */ - public void setRoughnessFactor(Float roughnessFactor) { + public void setRoughnessFactor(Double roughnessFactor) { if (roughnessFactor == null) { this.roughnessFactor = roughnessFactor; return ; @@ -230,7 +230,7 @@ public void setRoughnessFactor(Float roughnessFactor) { * @return The roughnessFactor * */ - public Float getRoughnessFactor() { + public Double getRoughnessFactor() { return this.roughnessFactor; } @@ -241,8 +241,8 @@ public Float getRoughnessFactor() { * @return The default roughnessFactor * */ - public Float defaultRoughnessFactor() { - return 1.0F; + public Double defaultRoughnessFactor() { + return 1.0D; } /** diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Mesh.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Mesh.java index caaade4f..887ac1a6 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Mesh.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Mesh.java @@ -42,7 +42,7 @@ public class Mesh *   The elements of this array (optional) * */ - private List weights; + private List weights; /** * An array of primitives, each defining geometry to be rendered. @@ -140,7 +140,7 @@ public void removePrimitives(MeshPrimitive element) { * the given constraints * */ - public void setWeights(List weights) { + public void setWeights(List weights) { if (weights == null) { this.weights = weights; return ; @@ -162,7 +162,7 @@ public void setWeights(List weights) { * @return The weights * */ - public List getWeights() { + public List getWeights() { return this.weights; } @@ -175,12 +175,12 @@ public List getWeights() { * @throws NullPointerException If the given element is null * */ - public void addWeights(Float element) { + public void addWeights(Double element) { if (element == null) { throw new NullPointerException("The element may not be null"); } - List oldList = this.weights; - List newList = new ArrayList(); + List oldList = this.weights; + List newList = new ArrayList(); if (oldList!= null) { newList.addAll(oldList); } @@ -199,12 +199,12 @@ public void addWeights(Float element) { * @throws NullPointerException If the given element is null * */ - public void removeWeights(Float element) { + public void removeWeights(Double element) { if (element == null) { throw new NullPointerException("The element may not be null"); } - List oldList = this.weights; - List newList = new ArrayList(); + List oldList = this.weights; + List newList = new ArrayList(); if (oldList!= null) { newList.addAll(oldList); } diff --git a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Node.java b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Node.java index bffdb7f7..4edaa3bc 100644 --- a/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Node.java +++ b/jgltf-impl-v2/src/main/java/de/javagl/jgltf/impl/v2/Node.java @@ -60,7 +60,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] matrix; + private double[] matrix; /** * The index of the mesh in this node. (optional) * @@ -77,7 +77,7 @@ public class Node *   Maximum: 1.0 (inclusive) * */ - private float[] rotation; + private double[] rotation; /** * The node's non-uniform scale, given as the scaling factors along the * x, y, and z axes. (optional)
@@ -87,7 +87,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] scale; + private double[] scale; /** * The node's translation along the x, y, and z axes. (optional)
* Default: [0.0,0.0,0.0]
@@ -96,7 +96,7 @@ public class Node *   The elements of this array (optional) * */ - private float[] translation; + private double[] translation; /** * The weights of the instantiated morph target. The number of array * elements **MUST** match the number of morph targets of the referenced @@ -106,7 +106,7 @@ public class Node *   The elements of this array (optional) * */ - private List weights; + private List weights; /** * The index of the camera referenced by this node. (optional) @@ -262,7 +262,7 @@ public Integer getSkin() { * the given constraints * */ - public void setMatrix(float[] matrix) { + public void setMatrix(double[] matrix) { if (matrix == null) { this.matrix = matrix; return ; @@ -288,7 +288,7 @@ public void setMatrix(float[] matrix) { * @return The matrix * */ - public float[] getMatrix() { + public double[] getMatrix() { return this.matrix; } @@ -299,8 +299,8 @@ public float[] getMatrix() { * @return The default matrix * */ - public float[] defaultMatrix() { - return new float[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F }; + public double[] defaultMatrix() { + return new double[] { 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D }; } /** @@ -342,7 +342,7 @@ public Integer getMesh() { * the given constraints * */ - public void setRotation(float[] rotation) { + public void setRotation(double[] rotation) { if (rotation == null) { this.rotation = rotation; return ; @@ -353,7 +353,7 @@ public void setRotation(float[] rotation) { if (rotation.length > 4) { throw new IllegalArgumentException("Number of rotation elements is > 4"); } - for (float rotationElement: rotation) { + for (double rotationElement: rotation) { if (rotationElement > 1.0D) { throw new IllegalArgumentException("rotationElement > 1.0"); } @@ -377,7 +377,7 @@ public void setRotation(float[] rotation) { * @return The rotation * */ - public float[] getRotation() { + public double[] getRotation() { return this.rotation; } @@ -388,8 +388,8 @@ public float[] getRotation() { * @return The default rotation * */ - public float[] defaultRotation() { - return new float[] { 0.0F, 0.0F, 0.0F, 1.0F }; + public double[] defaultRotation() { + return new double[] { 0.0D, 0.0D, 0.0D, 1.0D }; } /** @@ -405,7 +405,7 @@ public float[] defaultRotation() { * the given constraints * */ - public void setScale(float[] scale) { + public void setScale(double[] scale) { if (scale == null) { this.scale = scale; return ; @@ -430,7 +430,7 @@ public void setScale(float[] scale) { * @return The scale * */ - public float[] getScale() { + public double[] getScale() { return this.scale; } @@ -441,8 +441,8 @@ public float[] getScale() { * @return The default scale * */ - public float[] defaultScale() { - return new float[] { 1.0F, 1.0F, 1.0F }; + public double[] defaultScale() { + return new double[] { 1.0D, 1.0D, 1.0D }; } /** @@ -457,7 +457,7 @@ public float[] defaultScale() { * the given constraints * */ - public void setTranslation(float[] translation) { + public void setTranslation(double[] translation) { if (translation == null) { this.translation = translation; return ; @@ -481,7 +481,7 @@ public void setTranslation(float[] translation) { * @return The translation * */ - public float[] getTranslation() { + public double[] getTranslation() { return this.translation; } @@ -492,8 +492,8 @@ public float[] getTranslation() { * @return The default translation * */ - public float[] defaultTranslation() { - return new float[] { 0.0F, 0.0F, 0.0F }; + public double[] defaultTranslation() { + return new double[] { 0.0D, 0.0D, 0.0D }; } /** @@ -509,7 +509,7 @@ public float[] defaultTranslation() { * the given constraints * */ - public void setWeights(List weights) { + public void setWeights(List weights) { if (weights == null) { this.weights = weights; return ; @@ -531,7 +531,7 @@ public void setWeights(List weights) { * @return The weights * */ - public List getWeights() { + public List getWeights() { return this.weights; } @@ -544,12 +544,12 @@ public List getWeights() { * @throws NullPointerException If the given element is null * */ - public void addWeights(Float element) { + public void addWeights(Double element) { if (element == null) { throw new NullPointerException("The element may not be null"); } - List oldList = this.weights; - List newList = new ArrayList(); + List oldList = this.weights; + List newList = new ArrayList(); if (oldList!= null) { newList.addAll(oldList); } @@ -568,12 +568,12 @@ public void addWeights(Float element) { * @throws NullPointerException If the given element is null * */ - public void removeWeights(Float element) { + public void removeWeights(Double element) { if (element == null) { throw new NullPointerException("The element may not be null"); } - List oldList = this.weights; - List newList = new ArrayList(); + List oldList = this.weights; + List newList = new ArrayList(); if (oldList!= null) { newList.addAll(oldList); } diff --git a/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialBuilder.java b/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialBuilder.java index 20568587..181af698 100644 --- a/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialBuilder.java +++ b/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialBuilder.java @@ -69,9 +69,9 @@ private MaterialBuilder() * @return This builder */ public MaterialBuilder setBaseColorFactor( - float r, float g, float b, float a) + double r, double g, double b, double a) { - materialModel.setBaseColorFactor(new float[] { r, g, b, a }); + materialModel.setBaseColorFactor(new double[] { r, g, b, a }); return this; } @@ -115,7 +115,7 @@ public MaterialBuilder setBaseColorTexture( * @return This builder */ public MaterialBuilder setMetallicRoughnessFactors( - float metallicFactor, float roughnessFactor) + double metallicFactor, double roughnessFactor) { materialModel.setMetallicFactor(metallicFactor); materialModel.setRoughnessFactor(roughnessFactor); @@ -166,7 +166,7 @@ public MaterialBuilder setMetallicRoughnessTexture( */ public MaterialBuilder setNormalTexture( String fileName, String uri, - float scale, Integer texCoord) + double scale, Integer texCoord) { TextureModel textureModel = TextureModels.createFromImageFile(fileName, uri); @@ -182,7 +182,7 @@ public MaterialBuilder setNormalTexture( * @return This builder */ public MaterialBuilder setNormalTexture( - TextureModel normalTexture, float scale, Integer texCoord) + TextureModel normalTexture, double scale, Integer texCoord) { materialModel.setNormalTexture(normalTexture); materialModel.setNormalScale(scale); @@ -202,7 +202,7 @@ public MaterialBuilder setNormalTexture( */ public MaterialBuilder setOcclusionTexture( String fileName, String uri, - float strength, Integer texCoord) + double strength, Integer texCoord) { TextureModel textureModel = TextureModels.createFromImageFile(fileName, uri); @@ -218,7 +218,7 @@ public MaterialBuilder setOcclusionTexture( * @return This builder */ public MaterialBuilder setOcclusionTexture( - TextureModel occlusionTexture, float strength, Integer texCoord) + TextureModel occlusionTexture, double strength, Integer texCoord) { materialModel.setOcclusionTexture(occlusionTexture); materialModel.setOcclusionStrength(strength); @@ -240,7 +240,7 @@ public MaterialBuilder setOcclusionTexture( */ public MaterialBuilder setEmissiveTexture( String fileName, String uri, - float r, float g, float b, Integer texCoord) + double r, double g, double b, Integer texCoord) { TextureModel textureModel = TextureModels.createFromImageFile(fileName, uri); @@ -258,10 +258,10 @@ public MaterialBuilder setEmissiveTexture( * @return This builder */ public MaterialBuilder setEmissiveTexture(TextureModel emissiveTexture, - float r, float g, float b, Integer texCoord) + double r, double g, double b, Integer texCoord) { materialModel.setEmissiveTexture(emissiveTexture); - materialModel.setEmissiveFactor(new float[] { r, g, b }); + materialModel.setEmissiveFactor(new double[] { r, g, b }); materialModel.setEmissiveTexcoord(texCoord); return this; } @@ -284,7 +284,7 @@ public MaterialBuilder setAlphaMode(AlphaMode alphaMode) * @param alphaCutoff The alpha cutoff * @return This builder */ - public MaterialBuilder setAlphaCutoff(float alphaCutoff) + public MaterialBuilder setAlphaCutoff(double alphaCutoff) { materialModel.setAlphaCutoff(alphaCutoff); return this; diff --git a/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialModels.java b/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialModels.java index 4862e2ce..4ff785bf 100644 --- a/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialModels.java +++ b/jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MaterialModels.java @@ -49,12 +49,12 @@ public class MaterialModels * @return The material model */ public static MaterialModelV2 createFromBaseColor( - float r, float g, float b, float a) + double r, double g, double b, double a) { MaterialBuilder builder = MaterialBuilder.create(); builder.setBaseColorFactor(r, g, b, a); builder.setDoubleSided(true); - builder.setMetallicRoughnessFactors(0.0f, 1.0f); + builder.setMetallicRoughnessFactors(0.0, 1.0); MaterialModelV2 result = builder.build(); return result; } @@ -73,7 +73,7 @@ public static MaterialModelV2 createFromBaseColorTexture( MaterialBuilder builder = MaterialBuilder.create(); builder.setBaseColorTexture(baseColorTexture, texCoord); builder.setDoubleSided(true); - builder.setMetallicRoughnessFactors(0.0f, 1.0f); + builder.setMetallicRoughnessFactors(0.0, 1.0); MaterialModelV2 result = builder.build(); return result; } @@ -93,7 +93,7 @@ public static MaterialModelV2 createFromImageFile( MaterialBuilder builder = MaterialBuilder.create(); builder.setBaseColorTexture(imageFileName, uri, null); builder.setDoubleSided(true); - builder.setMetallicRoughnessFactors(0.0f, 1.0f); + builder.setMetallicRoughnessFactors(0.0, 1.0); MaterialModelV2 result = builder.build(); return result; } @@ -116,7 +116,7 @@ public static MaterialModelV2 createFromBufferedImage( MaterialBuilder builder = MaterialBuilder.create(); builder.setBaseColorTexture(baseColorTexture, null); builder.setDoubleSided(true); - builder.setMetallicRoughnessFactors(0.0f, 1.0f); + builder.setMetallicRoughnessFactors(0.0, 1.0); MaterialModelV2 result = builder.build(); return result; } diff --git a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/DuplicateMeshesTest.java b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/DuplicateMeshesTest.java index 6fe484a9..5a7c2c72 100644 --- a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/DuplicateMeshesTest.java +++ b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/DuplicateMeshesTest.java @@ -61,12 +61,12 @@ private static GltfModel createGltfModel() // Add the same mesh to the scene twice DefaultNodeModel nodeModel0 = new DefaultNodeModel(); - nodeModel0.setTranslation(new float[] { -1.0f, 0, 0 }); + nodeModel0.setTranslation(new double[] { -1.0f, 0, 0 }); nodeModel0.addMeshModel(meshModel); sceneModel.addNode(nodeModel0); DefaultNodeModel nodeModel1 = new DefaultNodeModel(); - nodeModel1.setTranslation(new float[] { 1.0f, 0, 0 }); + nodeModel1.setTranslation(new double[] { 1.0f, 0, 0 }); nodeModel1.addMeshModel(meshModel); sceneModel.addNode(nodeModel1); diff --git a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/MorphTargetsBuildingTest.java b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/MorphTargetsBuildingTest.java index 2eeab44d..513aba36 100644 --- a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/MorphTargetsBuildingTest.java +++ b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/MorphTargetsBuildingTest.java @@ -40,7 +40,7 @@ public void testWriteTargets() throws IOException // Create a scene with a node with a mesh with the given primitive DefaultMeshModel meshModel = new DefaultMeshModel(); meshModel.addMeshPrimitiveModel(inputMeshPrimitiveModel); - meshModel.setWeights(new float[] + meshModel.setWeights(new double[] { 0.0f, 0.25f }); DefaultNodeModel nodeModel = new DefaultNodeModel(); nodeModel.addMeshModel(meshModel); diff --git a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/example/GltfModelCreationMorphTargetsExample.java b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/example/GltfModelCreationMorphTargetsExample.java index 07e20be7..7336d140 100644 --- a/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/example/GltfModelCreationMorphTargetsExample.java +++ b/jgltf-model-builder/src/test/java/de/javagl/jgltf/model/creation/example/GltfModelCreationMorphTargetsExample.java @@ -81,7 +81,7 @@ private static GltfModel createGltfModel() // Create a mesh with the mesh primitive, assigning // the morph target weights DefaultMeshModel meshModel = new DefaultMeshModel(); - meshModel.setWeights(new float[] { 0.0f, 0.25f } ); + meshModel.setWeights(new double[] { 0.0f, 0.25f } ); meshModel.addMeshPrimitiveModel(meshPrimitiveModel); // Create a scene that only contains the given mesh diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBox.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBox.java index 20934157..faacd348 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBox.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBox.java @@ -36,32 +36,32 @@ class BoundingBox /** * The minimum x coordinate */ - private float minX; + private double minX; /** * The minimum y coordinate */ - private float minY; + private double minY; /** * The minimum z coordinate */ - private float minZ; + private double minZ; /** * The maximum x coordinate */ - private float maxX; + private double maxX; /** * The maximum y coordinate */ - private float maxY; + private double maxY; /** * The maximum z coordinate */ - private float maxZ; + private double maxZ; /** * Creates a bounding box @@ -83,7 +83,7 @@ class BoundingBox * @param y The y-coordinate * @param z The z-coordinate */ - void combine(float x, float y, float z) + void combine(double x, double y, double z) { minX = Math.min(minX, x); minY = Math.min(minY, y); @@ -114,9 +114,9 @@ void combine(BoundingBox other) * * @return The x-coordinate of the center */ - float getCenterX() + double getCenterX() { - return getMinX() + getSizeX() * 0.5f; + return getMinX() + getSizeX() * 0.5; } /** @@ -124,9 +124,9 @@ float getCenterX() * * @return The y-coordinate of the center */ - float getCenterY() + double getCenterY() { - return getMinY() + getSizeY() * 0.5f; + return getMinY() + getSizeY() * 0.5; } /** @@ -134,9 +134,9 @@ float getCenterY() * * @return The z-coordinate of the center */ - float getCenterZ() + double getCenterZ() { - return getMinZ() + getSizeZ() * 0.5f; + return getMinZ() + getSizeZ() * 0.5; } /** @@ -144,7 +144,7 @@ float getCenterZ() * * @return The size in x-direction */ - float getSizeX() + double getSizeX() { return getMaxX() - getMinX(); } @@ -154,7 +154,7 @@ float getSizeX() * * @return The size in y-direction */ - float getSizeY() + double getSizeY() { return getMaxY() - getMinY(); } @@ -164,7 +164,7 @@ float getSizeY() * * @return The size in z-direction */ - float getSizeZ() + double getSizeZ() { return getMaxZ() - getMinZ(); } @@ -174,7 +174,7 @@ float getSizeZ() * * @return The minimum x coordinate */ - float getMinX() + double getMinX() { return minX; } @@ -184,7 +184,7 @@ float getMinX() * * @return The minimum y coordinate */ - float getMinY() + double getMinY() { return minY; } @@ -194,7 +194,7 @@ float getMinY() * * @return The minimum z coordinate */ - float getMinZ() + double getMinZ() { return minZ; } @@ -204,7 +204,7 @@ float getMinZ() * * @return The maximum x coordinate */ - float getMaxX() + double getMaxX() { return maxX; } @@ -214,7 +214,7 @@ float getMaxX() * * @return The maximum y coordinate */ - float getMaxY() + double getMaxY() { return maxY; } @@ -224,7 +224,7 @@ float getMaxY() * * @return The maximum z coordinate */ - float getMaxZ() + double getMaxZ() { return maxZ; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxComputer.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxComputer.java index 320a7068..c6925de9 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxComputer.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxComputer.java @@ -67,7 +67,7 @@ BoundingBox compute() List sceneModels = gltfModel.getSceneModels(); for (SceneModel sceneModel : sceneModels) { - float rootTransform[] = MathUtils.createIdentity4x4(); + double rootTransform[] = MathUtils.createIdentity4x4(); computeSceneBoundingBox(sceneModel, rootTransform, boundingBox); } return boundingBox; @@ -86,7 +86,7 @@ BoundingBox compute() * @return The result */ private BoundingBox computeSceneBoundingBox( - SceneModel sceneModel, float transform[], BoundingBox boundingBox) + SceneModel sceneModel, double transform[], BoundingBox boundingBox) { BoundingBox localResult = boundingBox; if (localResult == null) @@ -115,7 +115,7 @@ private BoundingBox computeSceneBoundingBox( * @return The result */ private BoundingBox computeNodeBoundingBox( - NodeModel nodeModel, float parentTransform[], BoundingBox boundingBox) + NodeModel nodeModel, double parentTransform[], BoundingBox boundingBox) { BoundingBox result = boundingBox; if (result == null) @@ -123,8 +123,8 @@ private BoundingBox computeNodeBoundingBox( result = new BoundingBox(); } - float[] localTransform = nodeModel.computeLocalTransform(null); - float[] transform = new float[16]; + double[] localTransform = nodeModel.computeLocalTransform(null); + double[] transform = new double[16]; MathUtils.mul4x4(parentTransform, localTransform, transform); List meshModels = nodeModel.getMeshModels(); @@ -157,7 +157,7 @@ private BoundingBox computeNodeBoundingBox( * @return The result */ private BoundingBox computeMeshBoundingBox( - MeshModel meshModel, float transform[], BoundingBox boundingBox) + MeshModel meshModel, double transform[], BoundingBox boundingBox) { BoundingBox result = boundingBox; if (result == null) @@ -194,7 +194,7 @@ private BoundingBox computeMeshBoundingBox( * returned. */ private BoundingBox computeBoundingBox( - MeshPrimitiveModel meshPrimitiveModel, float transform[]) + MeshPrimitiveModel meshPrimitiveModel, double transform[]) { Map attributes = meshPrimitiveModel.getAttributes(); @@ -226,11 +226,11 @@ private BoundingBox computeBoundingBox( AccessorData accessorData = accessorModel.getAccessorData(); AccessorFloatData accessorFloatData = (AccessorFloatData)accessorData; - float point[] = new float[3]; - float transformedPoint[]; + double point[] = new double[3]; + double transformedPoint[]; if (transform != null) { - transformedPoint = new float[3]; + transformedPoint = new double[3]; } else { diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxes.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxes.java index ac22953d..c8a0abe8 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxes.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/BoundingBoxes.java @@ -43,7 +43,7 @@ public class BoundingBoxes * @param gltfModel The {@link GltfModel} * @return The bounding box */ - public static float[] computeBoundingBoxMinMax(GltfModel gltfModel) + public static double[] computeBoundingBoxMinMax(GltfModel gltfModel) { Objects.requireNonNull(gltfModel, "The gltfModel may not be null"); @@ -51,7 +51,7 @@ public static float[] computeBoundingBoxMinMax(GltfModel gltfModel) new BoundingBoxComputer(gltfModel); BoundingBox boundingBox = boundingBoxComputer.compute(); - float result[] = { + double result[] = { boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraModel.java index 7e71e92d..5559cc82 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraModel.java @@ -65,12 +65,12 @@ public interface CameraModel extends NamedModelElement * camera will be used. * @return The result array */ - float[] computeProjectionMatrix(float result[], Float aspectRatio); + double[] computeProjectionMatrix(double result[], Double aspectRatio); /** * Create the supplier of the projection matrix for this camera model.
*
- * The matrix will be provided as a float array with 16 elements, + * The matrix will be provided as a double array with 16 elements, * storing the matrix entries in column-major order.
*
* Note: If the type of the camera that this {@link CameraModel} was @@ -84,7 +84,7 @@ public interface CameraModel extends NamedModelElement * aspect ratio of the camera will be used. * @return The supplier */ - Supplier createProjectionMatrixSupplier( + Supplier createProjectionMatrixSupplier( DoubleSupplier aspectRatioSupplier); } \ No newline at end of file diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraOrthographicModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraOrthographicModel.java index af673341..bc6bfdc4 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraOrthographicModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraOrthographicModel.java @@ -36,27 +36,27 @@ public interface CameraOrthographicModel * * @return The magnification */ - Float getXmag(); + Double getXmag(); /** * Returns the vertical magnification * * @return The magnification */ - Float getYmag(); + Double getYmag(); /** * Returns the distance of the far clipping plane * * @return The distance */ - Float getZfar(); + Double getZfar(); /** * Returns the distance of the near clipping plane * * @return The distance */ - Float getZnear(); + Double getZnear(); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraPerspectiveModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraPerspectiveModel.java index 74ac9bc4..fd414811 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraPerspectiveModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/CameraPerspectiveModel.java @@ -36,27 +36,27 @@ public interface CameraPerspectiveModel * * @return The aspect ratio */ - Float getAspectRatio(); + Double getAspectRatio(); /** * Returns the FOV, in y-direction, in radians * * @return The FOV */ - Float getYfov(); + Double getYfov(); /** * Returns the distance of the far clipping plane * * @return The distance */ - Float getZfar(); + Double getZfar(); /** * Returns the distance of the near clipping plane * * @return The distance */ - Float getZnear(); + Double getZnear(); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/GltfAnimations.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/GltfAnimations.java index 07337743..23092a49 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/GltfAnimations.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/GltfAnimations.java @@ -225,7 +225,7 @@ static Animation createAnimation( InterpolatorType interpolatorType) { int numKeyElements = timeData.getNumElements(); - float keys[] = new float[numKeyElements]; + double keys[] = new double[numKeyElements]; for (int e=0; e { - float translation[] = nodeModel.getTranslation(); + double translation[] = nodeModel.getTranslation(); if (translation == null) { translation = values.clone(); @@ -334,7 +334,7 @@ private static AnimationListener createRotationAnimationListener( { return (animation, timeS, values) -> { - float rotation[] = nodeModel.getRotation(); + double rotation[] = nodeModel.getRotation(); if (rotation == null) { rotation = values.clone(); @@ -360,7 +360,7 @@ private static AnimationListener createScaleAnimationListener( { return (animation, timeS, values) -> { - float scale[] = nodeModel.getScale(); + double scale[] = nodeModel.getScale(); if (scale == null) { scale = values.clone(); @@ -386,7 +386,7 @@ private static AnimationListener createWeightsAnimationListener( { return (animation, timeS, values) -> { - float weights[] = nodeModel.getWeights(); + double weights[] = nodeModel.getWeights(); if (weights == null) { weights = values.clone(); diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/MathUtils.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/MathUtils.java index 9afc5076..7d8ddf67 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/MathUtils.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/MathUtils.java @@ -58,16 +58,16 @@ public class MathUtils /** * Epsilon for floating point computations */ - private static final float FLOAT_EPSILON = 1e-8f; + private static final float EPSILON = 1e-12f; /** * Creates a 4x4 identity matrix * * @return The matrix */ - public static float[] createIdentity4x4() + public static double[] createIdentity4x4() { - float m[] = new float[16]; + double m[] = new double[16]; setIdentity4x4(m); return m; } @@ -77,13 +77,13 @@ public static float[] createIdentity4x4() * * @param m The matrix */ - public static void setIdentity4x4(float m[]) + public static void setIdentity4x4(double m[]) { - Arrays.fill(m, 0.0f); - m[0] = 1.0f; - m[5] = 1.0f; - m[10] = 1.0f; - m[15] = 1.0f; + Arrays.fill(m, 0.0); + m[0] = 1.0; + m[5] = 1.0; + m[10] = 1.0; + m[15] = 1.0; } /** @@ -91,12 +91,12 @@ public static void setIdentity4x4(float m[]) * * @param m The matrix */ - static void setIdentity3x3(float m[]) + static void setIdentity3x3(double m[]) { - Arrays.fill(m, 0.0f); - m[0] = 1.0f; - m[4] = 1.0f; - m[8] = 1.0f; + Arrays.fill(m, 0.0); + m[0] = 1.0; + m[4] = 1.0; + m[8] = 1.0; } /** @@ -107,7 +107,7 @@ static void setIdentity3x3(float m[]) * @param source The source array * @param target The target array */ - static void set(float source[], float target[]) + static void set(double source[], double target[]) { System.arraycopy(source, 0, target, 0, Math.min(source.length, target.length)); @@ -122,7 +122,7 @@ static void set(float source[], float target[]) * @param targetMatrix3x3 The target matrix */ public static void getRotationScale( - float sourceMatrix4x4[], float targetMatrix3x3[]) + double sourceMatrix4x4[], double targetMatrix3x3[]) { targetMatrix3x3[0] = sourceMatrix4x4[ 0]; targetMatrix3x3[1] = sourceMatrix4x4[ 1]; @@ -143,17 +143,17 @@ public static void getRotationScale( * @param m The input matrix * @param t The target matrix */ - static void transpose3x3(float m[], float t[]) + static void transpose3x3(double m[], double t[]) { - float m0 = m[0]; - float m1 = m[1]; - float m2 = m[2]; - float m3 = m[3]; - float m4 = m[4]; - float m5 = m[5]; - float m6 = m[6]; - float m7 = m[7]; - float m8 = m[8]; + double m0 = m[0]; + double m1 = m[1]; + double m2 = m[2]; + double m3 = m[3]; + double m4 = m[4]; + double m5 = m[5]; + double m6 = m[6]; + double m7 = m[7]; + double m8 = m[8]; t[0] = m0; t[1] = m3; t[2] = m6; @@ -172,24 +172,24 @@ static void transpose3x3(float m[], float t[]) * @param m The input matrix * @param t The target matrix */ - public static void transpose4x4(float m[], float t[]) + public static void transpose4x4(double m[], double t[]) { - float m0 = m[ 0]; - float m1 = m[ 1]; - float m2 = m[ 2]; - float m3 = m[ 3]; - float m4 = m[ 4]; - float m5 = m[ 5]; - float m6 = m[ 6]; - float m7 = m[ 7]; - float m8 = m[ 8]; - float m9 = m[ 9]; - float mA = m[10]; - float mB = m[11]; - float mC = m[12]; - float mD = m[13]; - float mE = m[14]; - float mF = m[15]; + double m0 = m[ 0]; + double m1 = m[ 1]; + double m2 = m[ 2]; + double m3 = m[ 3]; + double m4 = m[ 4]; + double m5 = m[ 5]; + double m6 = m[ 6]; + double m7 = m[ 7]; + double m8 = m[ 8]; + double m9 = m[ 9]; + double mA = m[10]; + double mB = m[11]; + double mC = m[12]; + double mD = m[13]; + double mE = m[14]; + double mF = m[15]; t[ 0] = m0; t[ 1] = m4; t[ 2] = m8; @@ -215,61 +215,61 @@ public static void transpose4x4(float m[], float t[]) * @param b The second matrix * @param m The result matrix */ - public static void mul4x4(float a[], float b[], float m[]) + public static void mul4x4(double a[], double b[], double m[]) { - float a00 = a[ 0]; - float a10 = a[ 1]; - float a20 = a[ 2]; - float a30 = a[ 3]; - float a01 = a[ 4]; - float a11 = a[ 5]; - float a21 = a[ 6]; - float a31 = a[ 7]; - float a02 = a[ 8]; - float a12 = a[ 9]; - float a22 = a[10]; - float a32 = a[11]; - float a03 = a[12]; - float a13 = a[13]; - float a23 = a[14]; - float a33 = a[15]; + double a00 = a[ 0]; + double a10 = a[ 1]; + double a20 = a[ 2]; + double a30 = a[ 3]; + double a01 = a[ 4]; + double a11 = a[ 5]; + double a21 = a[ 6]; + double a31 = a[ 7]; + double a02 = a[ 8]; + double a12 = a[ 9]; + double a22 = a[10]; + double a32 = a[11]; + double a03 = a[12]; + double a13 = a[13]; + double a23 = a[14]; + double a33 = a[15]; - float b00 = b[ 0]; - float b10 = b[ 1]; - float b20 = b[ 2]; - float b30 = b[ 3]; - float b01 = b[ 4]; - float b11 = b[ 5]; - float b21 = b[ 6]; - float b31 = b[ 7]; - float b02 = b[ 8]; - float b12 = b[ 9]; - float b22 = b[10]; - float b32 = b[11]; - float b03 = b[12]; - float b13 = b[13]; - float b23 = b[14]; - float b33 = b[15]; + double b00 = b[ 0]; + double b10 = b[ 1]; + double b20 = b[ 2]; + double b30 = b[ 3]; + double b01 = b[ 4]; + double b11 = b[ 5]; + double b21 = b[ 6]; + double b31 = b[ 7]; + double b02 = b[ 8]; + double b12 = b[ 9]; + double b22 = b[10]; + double b32 = b[11]; + double b03 = b[12]; + double b13 = b[13]; + double b23 = b[14]; + double b33 = b[15]; - float m00 = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; - float m01 = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; - float m02 = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; - float m03 = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33; + double m00 = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30; + double m01 = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31; + double m02 = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32; + double m03 = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33; - float m10 = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; - float m11 = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; - float m12 = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; - float m13 = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33; + double m10 = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30; + double m11 = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31; + double m12 = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32; + double m13 = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33; - float m20 = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; - float m21 = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; - float m22 = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; - float m23 = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33; + double m20 = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30; + double m21 = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31; + double m22 = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32; + double m23 = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33; - float m30 = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30; - float m31 = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31; - float m32 = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32; - float m33 = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33; + double m30 = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30; + double m31 = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31; + double m32 = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32; + double m33 = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33; m[ 0] = m00; m[ 1] = m10; @@ -298,31 +298,31 @@ public static void mul4x4(float a[], float b[], float m[]) * @param q The quaternion * @param m The matrix */ - public static void quaternionToMatrix4x4(float q[], float m[]) + public static void quaternionToMatrix4x4(double q[], double m[]) { - float invLength = 1.0f / (float)Math.sqrt(dot(q, q)); + double invLength = 1.0 / Math.sqrt(dot(q, q)); // Adapted from javax.vecmath.Matrix4f - float qx = q[0] * invLength; - float qy = q[1] * invLength; - float qz = q[2] * invLength; - float qw = q[3] * invLength; - m[ 0] = 1.0f - 2.0f * qy * qy - 2.0f * qz * qz; - m[ 1] = 2.0f * (qx * qy + qw * qz); - m[ 2] = 2.0f * (qx * qz - qw * qy); - m[ 3] = 0.0f; - m[ 4] = 2.0f * (qx * qy - qw * qz); - m[ 5] = 1.0f - 2.0f * qx * qx - 2.0f * qz * qz; - m[ 6] = 2.0f * (qy * qz + qw * qx); - m[ 7] = 0.0f; - m[ 8] = 2.0f * (qx * qz + qw * qy); - m[ 9] = 2.0f * (qy * qz - qw * qx); - m[10] = 1.0f - 2.0f * qx * qx - 2.0f * qy * qy; - m[11] = 0.0f; - m[12] = 0.0f; - m[13] = 0.0f; - m[14] = 0.0f; - m[15] = 1.0f; + double qx = q[0] * invLength; + double qy = q[1] * invLength; + double qz = q[2] * invLength; + double qw = q[3] * invLength; + m[ 0] = 1.0 - 2.0 * qy * qy - 2.0 * qz * qz; + m[ 1] = 2.0 * (qx * qy + qw * qz); + m[ 2] = 2.0 * (qx * qz - qw * qy); + m[ 3] = 0.0; + m[ 4] = 2.0 * (qx * qy - qw * qz); + m[ 5] = 1.0 - 2.0 * qx * qx - 2.0 * qz * qz; + m[ 6] = 2.0 * (qy * qz + qw * qx); + m[ 7] = 0.0; + m[ 8] = 2.0 * (qx * qz + qw * qy); + m[ 9] = 2.0 * (qy * qz - qw * qx); + m[10] = 1.0 - 2.0 * qx * qx - 2.0 * qy * qy; + m[11] = 0.0; + m[12] = 0.0; + m[13] = 0.0; + m[14] = 0.0; + m[15] = 1.0; } /** @@ -333,27 +333,27 @@ public static void quaternionToMatrix4x4(float q[], float m[]) * @param m The input matrix * @param inv The inverse matrix */ - public static void invert4x4(float m[], float inv[]) + public static void invert4x4(double m[], double inv[]) { // Adapted from The Mesa 3-D graphics library. // Copyright (C) 1999-2007 Brian Paul All Rights Reserved. // Published under the MIT license (see the header of this file) - float m0 = m[ 0]; - float m1 = m[ 1]; - float m2 = m[ 2]; - float m3 = m[ 3]; - float m4 = m[ 4]; - float m5 = m[ 5]; - float m6 = m[ 6]; - float m7 = m[ 7]; - float m8 = m[ 8]; - float m9 = m[ 9]; - float mA = m[10]; - float mB = m[11]; - float mC = m[12]; - float mD = m[13]; - float mE = m[14]; - float mF = m[15]; + double m0 = m[ 0]; + double m1 = m[ 1]; + double m2 = m[ 2]; + double m3 = m[ 3]; + double m4 = m[ 4]; + double m5 = m[ 5]; + double m6 = m[ 6]; + double m7 = m[ 7]; + double m8 = m[ 8]; + double m9 = m[ 9]; + double mA = m[10]; + double mB = m[11]; + double mC = m[12]; + double mD = m[13]; + double mE = m[14]; + double mF = m[15]; inv[ 0] = m5 * mA * mF - m5 * mB * mE - m9 * m6 * mF + m9 * m7 * mE + mD * m6 * mB - mD * m7 * mA; @@ -389,8 +389,8 @@ public static void invert4x4(float m[], float inv[]) m4 * m2 * m9 + m8 * m1 * m6 - m8 * m2 * m5; // (Ain't that pretty?) - float det = m0 * inv[0] + m1 * inv[4] + m2 * inv[8] + m3 * inv[12]; - if (Math.abs(det) <= FLOAT_EPSILON) + double det = m0 * inv[0] + m1 * inv[4] + m2 * inv[8] + m3 * inv[12]; + if (Math.abs(det) <= EPSILON) { if (logger.isLoggable(Level.FINE)) { @@ -400,7 +400,7 @@ public static void invert4x4(float m[], float inv[]) setIdentity4x4(inv); return; } - float invDet = 1.0f / det; + double invDet = 1.0 / det; for (int i = 0; i < 16; i++) { inv[i] *= invDet; @@ -415,22 +415,22 @@ public static void invert4x4(float m[], float inv[]) * @param m The input matrix * @param inv The inverse matrix */ - public static void invert3x3(float m[], float inv[]) + public static void invert3x3(double m[], double inv[]) { // Adapted from http://stackoverflow.com/a/18504573 - float m0 = m[0]; - float m1 = m[1]; - float m2 = m[2]; - float m3 = m[3]; - float m4 = m[4]; - float m5 = m[5]; - float m6 = m[6]; - float m7 = m[7]; - float m8 = m[8]; - float det = m0 * (m4 * m8 - m5 * m7) - + double m0 = m[0]; + double m1 = m[1]; + double m2 = m[2]; + double m3 = m[3]; + double m4 = m[4]; + double m5 = m[5]; + double m6 = m[6]; + double m7 = m[7]; + double m8 = m[8]; + double det = m0 * (m4 * m8 - m5 * m7) - m3 * (m1 * m8 - m7 * m2) + m6 * (m1 * m5 - m4 * m2); - if (Math.abs(det) <= FLOAT_EPSILON) + if (Math.abs(det) <= EPSILON) { if (logger.isLoggable(Level.FINE)) { @@ -440,7 +440,7 @@ public static void invert3x3(float m[], float inv[]) setIdentity3x3(inv); return; } - float invDet = 1.0f / det; + double invDet = 1.0 / det; inv[0] = (m4 * m8 - m5 * m7) * invDet; inv[3] = (m6 * m5 - m3 * m8) * invDet; inv[6] = (m3 * m7 - m6 * m4) * invDet; @@ -463,7 +463,7 @@ public static void invert3x3(float m[], float inv[]) * @param result The result matrix */ public static void translate( - float m[], float x, float y, float z, float result[]) + double m[], double x, double y, double z, double result[]) { set(m, result); result[12] += x; @@ -481,17 +481,17 @@ public static void translate( * @param m The matrix to fill */ public static void infinitePerspective4x4( - float fovyDeg, float aspect, float zNear, float m[]) + double fovyDeg, double aspect, double zNear, double m[]) { setIdentity4x4(m); - float fovyRad = (float)Math.toRadians(fovyDeg); - float t = (float)Math.tan(0.5 * fovyRad); - m[0] = 1.0f / (aspect * t); - m[5] = 1.0f / t; - m[10] = -1.0f; - m[11] = -1.0f; - m[14] = 2.0f * zNear; - m[15] = 0.0f; + double fovyRad = Math.toRadians(fovyDeg); + double t = Math.tan(0.5 * fovyRad); + m[0] = 1.0 / (aspect * t); + m[5] = 1.0 / t; + m[10] = -1.0; + m[11] = -1.0; + m[14] = 2.0 * zNear; + m[15] = 0.0; } /** @@ -505,17 +505,17 @@ public static void infinitePerspective4x4( * @param m The matrix to fill */ public static void perspective4x4( - float fovyDeg, float aspect, float zNear, float zFar, float m[]) + double fovyDeg, double aspect, double zNear, double zFar, double m[]) { setIdentity4x4(m); - float fovyRad = (float)Math.toRadians(fovyDeg); - float t = (float)Math.tan(0.5 * fovyRad); - m[0] = 1.0f / (aspect * t); - m[5] = 1.0f / t; + double fovyRad = Math.toRadians(fovyDeg); + double t = Math.tan(0.5 * fovyRad); + m[0] = 1.0 / (aspect * t); + m[5] = 1.0 / t; m[10] = (zFar + zNear) / (zNear - zFar); - m[11] = -1.0f; - m[14] = 2.0f * zFar * zNear / (zNear - zFar); - m[15] = 0.0f; + m[11] = -1.0; + m[14] = 2.0 * zFar * zNear / (zNear - zFar); + m[15] = 0.0; } @@ -527,9 +527,9 @@ public static void perspective4x4( * @param b The second array * @return The dot product */ - private static float dot(float a[], float b[]) + private static double dot(double a[], double b[]) { - float sum = 0; + double sum = 0; for (int i=0; ireference to the array storing the matrix of this node. @@ -97,7 +97,7 @@ public interface NodeModel extends NamedModelElement * * @return The matrix */ - float[] getMatrix(); + double[] getMatrix(); /** * Set the translation of this node to be a reference to the given @@ -107,7 +107,7 @@ public interface NodeModel extends NamedModelElement * @throws IllegalArgumentException If the given array does not have * a length of 3 */ - void setTranslation(float translation[]); + void setTranslation(double translation[]); /** * Returns a reference to the array storing the translation of this @@ -115,18 +115,18 @@ public interface NodeModel extends NamedModelElement * * @return The translation */ - float[] getTranslation(); + double[] getTranslation(); /** * Set the rotation of this node to be a reference to the given * array. The array is assumed to be a quaternion, consisting of 4 - * float elements. + * double elements. * * @param rotation The rotation * @throws IllegalArgumentException If the given array does not have * a length of 4 */ - void setRotation(float rotation[]); + void setRotation(double rotation[]); /** * Returns a reference to the array storing the rotation of this @@ -134,7 +134,7 @@ public interface NodeModel extends NamedModelElement * * @return The rotation */ - float[] getRotation(); + double[] getRotation(); /** * Set the scale of this node to be a reference to the given @@ -144,7 +144,7 @@ public interface NodeModel extends NamedModelElement * @throws IllegalArgumentException If the given array does not have * a length of 3 */ - void setScale(float scale[]); + void setScale(double scale[]); /** * Returns a reference to the array storing the scale of this @@ -152,7 +152,7 @@ public interface NodeModel extends NamedModelElement * * @return The scale */ - float[] getScale(); + double[] getScale(); /** * Set the morph target weights to be a reference to the given @@ -160,7 +160,7 @@ public interface NodeModel extends NamedModelElement * * @param weights The weights */ - void setWeights(float weights[]); + void setWeights(double weights[]); /** * Returns a reference to the morph target weights, @@ -168,7 +168,7 @@ public interface NodeModel extends NamedModelElement * * @return The morph target weights */ - float[] getWeights(); + double[] getWeights(); /** * Computes the local transform of this node.
@@ -181,7 +181,7 @@ public interface NodeModel extends NamedModelElement * @param result The result array * @return The result array */ - float[] computeLocalTransform(float result[]); + double[] computeLocalTransform(double result[]); /** * Computes the global transform of this node.
@@ -194,13 +194,13 @@ public interface NodeModel extends NamedModelElement * @param result The result array * @return The result array */ - float[] computeGlobalTransform(float result[]); + double[] computeGlobalTransform(double result[]); /** * Creates a supplier for the global transform matrix of this node * model.
*
- * The matrix will be provided as a float array with 16 elements, + * The matrix will be provided as a double array with 16 elements, * storing the matrix entries in column-major order.
*
* Note: The supplier MAY always return the same array instance. @@ -208,12 +208,12 @@ public interface NodeModel extends NamedModelElement * * @return The supplier */ - Supplier createGlobalTransformSupplier(); + Supplier createGlobalTransformSupplier(); /** * Creates a supplier for the local transform matrix of this node model.
*
- * The matrix will be provided as a float array with 16 elements, + * The matrix will be provided as a double array with 16 elements, * storing the matrix entries in column-major order.
*
* Note: The supplier MAY always return the same array instance. @@ -221,6 +221,6 @@ public interface NodeModel extends NamedModelElement * * @return The supplier */ - Supplier createLocalTransformSupplier(); + Supplier createLocalTransformSupplier(); } \ No newline at end of file diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/Optionals.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/Optionals.java index c3e2d342..3053edcf 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/Optionals.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/Optionals.java @@ -139,7 +139,7 @@ public static V get(Object key, Map map) * @param array The array * @return The result */ - public static float[] clone(float array[]) + public static double[] clone(double array[]) { if (array == null) { diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/SkinModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/SkinModel.java index 324a9f90..4302c8b3 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/SkinModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/SkinModel.java @@ -44,7 +44,7 @@ public interface SkinModel extends NamedModelElement * @param result The result array * @return The result array */ - float[] getBindShapeMatrix(float result[]); + double[] getBindShapeMatrix(double result[]); /** * Returns an unmodifiable list containing the joint nodes of the skeleton @@ -82,5 +82,5 @@ public interface SkinModel extends NamedModelElement * @param result The result array * @return The result array */ - float[] getInverseBindMatrix(int index, float result[]); + double[] getInverseBindMatrix(int index, double result[]); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/Suppliers.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/Suppliers.java index b9d2e594..1e1e1936 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/Suppliers.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/Suppliers.java @@ -50,10 +50,10 @@ public class Suppliers * @param computer The computer function * @return The supplier */ - public static Supplier createTransformSupplier( - T object, BiConsumer computer) + public static Supplier createTransformSupplier( + T object, BiConsumer computer) { - float transform[] = new float[16]; + double transform[] = new double[16]; if (object == null) { return () -> diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/Utils.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/Utils.java index 2c5f9360..01549c16 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/Utils.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/Utils.java @@ -40,13 +40,13 @@ public class Utils * @param length The length * @return The array, or a new array with the desired length */ - public static float[] validate(float array[], int length) + public static double[] validate(double array[], int length) { if (array != null && array.length == length) { return array; } - return new float[length]; + return new double[length]; } /** diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Animation.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Animation.java index 4973f222..5560dad7 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Animation.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Animation.java @@ -42,13 +42,13 @@ public final class Animation /** * The key frame times, in seconds */ - private final float timesS[]; + private final double timesS[]; /** * The values. Each element of this array corresponds to one key * frame time */ - private final float values[][]; + private final double values[][]; /** * The interpolator for the values @@ -60,7 +60,7 @@ public final class Animation * to the listeners. The listeners are not allowed to store or * modify this array. */ - private final float outputValues[]; + private final double outputValues[]; /** * The {@link AnimationListener}s that are informed about the progress @@ -86,8 +86,8 @@ public final class Animation * has a length that is different from the length of the times array. */ public Animation( - float timesS[], - float values[][], + double timesS[], + double values[][], InterpolatorType interpolatorType) { Objects.requireNonNull(timesS, "The times may not be null"); @@ -104,12 +104,12 @@ public Animation( "but have a length of "+values.length); } this.timesS = timesS.clone(); - this.values = new float[values.length][]; + this.values = new double[values.length][]; for (int i=0; i(); } @@ -120,7 +120,7 @@ public Animation( * * @return The start time */ - float getStartTimeS() + double getStartTimeS() { return timesS[0]; } @@ -130,7 +130,7 @@ float getStartTimeS() * * @return The end time */ - float getEndTimeS() + double getEndTimeS() { return timesS[timesS.length-1]; } @@ -140,7 +140,7 @@ float getEndTimeS() * * @return The duration */ - float getDurationS() + double getDurationS() { return getEndTimeS() - getStartTimeS(); } @@ -172,19 +172,19 @@ public void removeAnimationListener(AnimationListener listener) * * @param timeS The time, in seconds */ - void update(float timeS) + void update(double timeS) { int index0 = InterpolatorKeys.computeIndex(timeS, timesS); int index1 = Math.min(timesS.length - 1, index0 + 1); - float alpha = InterpolatorKeys.computeAlpha(timeS, timesS, index0); + double alpha = InterpolatorKeys.computeAlpha(timeS, timesS, index0); //System.out.println("For "+timeS+" in "+Arrays.toString(timesS)); //System.out.println("index0 "+index0); //System.out.println("index1 "+index1); //System.out.println("alpha "+alpha); - float a[] = values[index0]; - float b[] = values[index1]; + double a[] = values[index0]; + double b[] = values[index1]; interpolator.interpolate(a, b, alpha, outputValues); for (AnimationListener listener : listeners) { diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationListener.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationListener.java index b2e402c3..e85512f3 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationListener.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationListener.java @@ -44,5 +44,5 @@ public interface AnimationListener * @param values The interpolated values for the given time */ void animationUpdated( - Animation source, float timeS, float values[]); + Animation source, double timeS, double values[]); } \ No newline at end of file diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationManager.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationManager.java index 503633d8..45f16265 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationManager.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/AnimationManager.java @@ -83,7 +83,7 @@ public enum AnimationPolicy /** * The maximum {@link Animation#getEndTimeS()} of all animations */ - private float maxEndTimeS; + private double maxEndTimeS; /** * The list of {@link AnimationManagerListener}s that want to be @@ -102,7 +102,7 @@ public AnimationManager(AnimationPolicy animationPolicy) this.startNs = System.nanoTime(); this.currentNs = startNs; this.animations = new CopyOnWriteArrayList(); - this.maxEndTimeS = 0.0f; + this.maxEndTimeS = 0.0; this.animationManagerListeners = new CopyOnWriteArrayList(); } @@ -197,7 +197,7 @@ public List getAnimations() */ private void updateMaxEndTime() { - maxEndTimeS = 0.0f; + maxEndTimeS = 0.0; for (Animation animation : animations) { maxEndTimeS = Math.max(maxEndTimeS, animation.getEndTimeS()); @@ -224,14 +224,14 @@ void performStep(long deltaNs) { if (animationPolicy == AnimationPolicy.LOOP) { - float loopTimeS = currentTimeS % maxEndTimeS; + double loopTimeS = currentTimeS % maxEndTimeS; animation.update(loopTimeS); } else if (animationPolicy == AnimationPolicy.PING_PONG) { int interval = (int)(currentTimeS / maxEndTimeS); - float loopTimeS = currentTimeS % maxEndTimeS; - float pingPongTimeS = loopTimeS; + double loopTimeS = currentTimeS % maxEndTimeS; + double pingPongTimeS = loopTimeS; if ((interval & 1) != 0) { pingPongTimeS = maxEndTimeS - loopTimeS; diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Interpolator.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Interpolator.java index 03030e83..f2591ace 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Interpolator.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/Interpolator.java @@ -28,7 +28,7 @@ /** * Package-private interface for classes that can interpolate between - * (equal-length) arrays of float values + * (equal-length) arrays of double values */ interface Interpolator { @@ -46,5 +46,5 @@ interface Interpolator * @throws IndexOutOfBoundsException May be thrown if the arrays do not * have the same length */ - void interpolate(float a[], float b[], float alpha, float result[]); + void interpolate(double a[], double b[], double alpha, double result[]); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/InterpolatorKeys.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/InterpolatorKeys.java index 3f348dfc..69154a18 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/InterpolatorKeys.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/InterpolatorKeys.java @@ -30,7 +30,7 @@ /** * Methods to compute {@link Interpolator} keys from a given value and a - * (sorted) float array + * (sorted) double array */ class InterpolatorKeys { @@ -44,7 +44,7 @@ class InterpolatorKeys * @param keys The sorted keys * @return The index for the key */ - static int computeIndex(float key, float keys[]) + static int computeIndex(double key, double keys[]) { int index = Arrays.binarySearch(keys, key); if (index >= 0) @@ -64,19 +64,19 @@ static int computeIndex(float key, float keys[]) * @param index The index of the key * @return The alpha value */ - static float computeAlpha(float key, float keys[], int index) + static double computeAlpha(double key, double keys[], int index) { if (key <= keys[0]) { - return 0.0f; + return 0.0; } if (key >= keys[keys.length-1]) { - return 1.0f; + return 1.0; } - float local = key - keys[index]; - float delta = keys[index+1] - keys[index]; - float alpha = local / delta; + double local = key - keys[index]; + double delta = keys[index+1] - keys[index]; + double alpha = local / delta; return alpha; } @@ -87,11 +87,11 @@ static float computeAlpha(float key, float keys[], int index) */ public static void main(String[] args) { - float keys[] = { 1, 8, 11 }; - for (float d = -1; d <= 12; d+=0.1) + double keys[] = { 1, 8, 11 }; + for (double d = -1; d <= 12; d+=0.1) { int index = computeIndex(d, keys); - float alpha = computeAlpha(d, keys, index); + double alpha = computeAlpha(d, keys, index); System.out.println("For "+d); System.out.println(" index "+index); System.out.println(" alpha "+alpha); diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/LinearInterpolator.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/LinearInterpolator.java index d5131056..5486c3e3 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/LinearInterpolator.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/LinearInterpolator.java @@ -34,13 +34,13 @@ class LinearInterpolator implements Interpolator { @Override public void interpolate( - float[] a, float[] b, float alpha, float[] result) + double[] a, double[] b, double alpha, double[] result) { for (int i=0; i epsilon) { - float omega = (float)Math.acos(dot); - float invSinOmega = 1.0f / (float)Math.sin(omega); - s0 = (float)Math.sin((1.0 - alpha) * omega) * invSinOmega; - s1 = (float)Math.sin(alpha * omega) * invSinOmega; + double omega = Math.acos(dot); + double invSinOmega = 1.0 / Math.sin(omega); + s0 = Math.sin((1.0 - alpha) * omega) * invSinOmega; + s1 = Math.sin(alpha * omega) * invSinOmega; } else { s0 = 1.0f - alpha; s1 = alpha; } - float rx = s0 * ax + s1 * bx; - float ry = s0 * ay + s1 * by; - float rz = s0 * az + s1 * bz; - float rw = s0 * aw + s1 * bw; + double rx = s0 * ax + s1 * bx; + double ry = s0 * ay + s1 * by; + double rz = s0 * az + s1 * bz; + double rw = s0 * aw + s1 * bw; result[0] = rx; result[1] = ry; result[2] = rz; diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/StepInterpolator.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/StepInterpolator.java index 5efd974a..75f4a286 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/StepInterpolator.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/animation/StepInterpolator.java @@ -33,7 +33,7 @@ class StepInterpolator implements Interpolator { @Override public void interpolate( - float[] a, float[] b, float alpha, float[] result) + double[] a, double[] b, double alpha, double[] result) { System.arraycopy(a, 0, result, 0, a.length); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/TechniqueStatesFunctionsModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/TechniqueStatesFunctionsModel.java index f3f31103..503267ef 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/TechniqueStatesFunctionsModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/TechniqueStatesFunctionsModel.java @@ -43,7 +43,7 @@ public interface TechniqueStatesFunctionsModel * * @return The blend color */ - float[] getBlendColor(); + double[] getBlendColor(); /** * Returns the blend equation @@ -92,7 +92,7 @@ public interface TechniqueStatesFunctionsModel * * @return The depth range */ - float[] getDepthRange(); + double[] getDepthRange(); /** * Returns the front face @@ -106,12 +106,12 @@ public interface TechniqueStatesFunctionsModel * * @return The line width */ - float[] getLineWidth(); + double[] getLineWidth(); /** * Returns the polygon offset * * @return The polygon offset */ - float[] getPolygonOffset(); + double[] getPolygonOffset(); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/impl/DefaultTechniqueStatesFunctionsModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/impl/DefaultTechniqueStatesFunctionsModel.java index d792e834..32db3a87 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/impl/DefaultTechniqueStatesFunctionsModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/gl/impl/DefaultTechniqueStatesFunctionsModel.java @@ -41,7 +41,7 @@ public class DefaultTechniqueStatesFunctionsModel /** * The BlendColor */ - private float[] blendColor; + private double[] blendColor; /** * The BlendEquationSeparate @@ -76,7 +76,7 @@ public class DefaultTechniqueStatesFunctionsModel /** * The DepthRange */ - private float[] depthRange; + private double[] depthRange; /** * The FrontFace @@ -86,12 +86,12 @@ public class DefaultTechniqueStatesFunctionsModel /** * The LineWidth */ - private float[] lineWidth; + private double[] lineWidth; /** * The PolygonOffset */ - private float[] polygonOffset; + private double[] polygonOffset; /** * Default constructor @@ -102,7 +102,7 @@ public DefaultTechniqueStatesFunctionsModel() } @Override - public float[] getBlendColor() + public double[] getBlendColor() { return blendColor; } @@ -112,7 +112,7 @@ public float[] getBlendColor() * * @param blendColor The BlendColor */ - public void setBlendColor(float[] blendColor) + public void setBlendColor(double[] blendColor) { this.blendColor = blendColor; } @@ -214,7 +214,7 @@ public void setDepthMask(boolean[] depthMask) } @Override - public float[] getDepthRange() + public double[] getDepthRange() { return depthRange; } @@ -224,7 +224,7 @@ public float[] getDepthRange() * * @param depthRange The DepthRange */ - public void setDepthRange(float[] depthRange) + public void setDepthRange(double[] depthRange) { this.depthRange = depthRange; } @@ -246,7 +246,7 @@ public void setFrontFace(int[] frontFace) } @Override - public float[] getLineWidth() + public double[] getLineWidth() { return lineWidth; } @@ -256,13 +256,13 @@ public float[] getLineWidth() * * @param lineWidth The LineWidth */ - public void setLineWidth(float[] lineWidth) + public void setLineWidth(double[] lineWidth) { this.lineWidth = lineWidth; } @Override - public float[] getPolygonOffset() + public double[] getPolygonOffset() { return polygonOffset; } @@ -272,7 +272,7 @@ public float[] getPolygonOffset() * * @param polygonOffset The PolygonOffset */ - public void setPolygonOffset(float[] polygonOffset) + public void setPolygonOffset(double[] polygonOffset) { this.polygonOffset = polygonOffset; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/Cameras.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/Cameras.java index 866b4c40..d9ebed56 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/Cameras.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/Cameras.java @@ -61,10 +61,10 @@ class Cameras * @param result The array storing the result * @return The result array */ - static float[] computeProjectionMatrix( - CameraModel cameraModel, Float aspectRatio, float result[]) + static double[] computeProjectionMatrix( + CameraModel cameraModel, Double aspectRatio, double result[]) { - float localResult[] = Utils.validate(result, 16); + double localResult[] = Utils.validate(result, 16); CameraPerspectiveModel cameraPerspective = cameraModel.getCameraPerspectiveModel(); @@ -74,9 +74,9 @@ static float[] computeProjectionMatrix( if (cameraPerspective != null) { - float fovRad = cameraPerspective.getYfov(); - float fovDeg = (float)Math.toDegrees(fovRad); - float localAspectRatio = 1.0f; + double fovRad = cameraPerspective.getYfov(); + double fovDeg = Math.toDegrees(fovRad); + double localAspectRatio = 1.0; if (aspectRatio != null) { localAspectRatio = aspectRatio; @@ -85,8 +85,8 @@ else if (cameraPerspective.getAspectRatio() != null) { localAspectRatio = cameraPerspective.getAspectRatio(); } - float zNear = cameraPerspective.getZnear(); - Float zFar = cameraPerspective.getZfar(); + Double zNear = cameraPerspective.getZnear(); + Double zFar = cameraPerspective.getZfar(); if (zFar == null) { MathUtils.infinitePerspective4x4( @@ -100,14 +100,14 @@ else if (cameraPerspective.getAspectRatio() != null) } else if (cameraOrthographic != null) { - float xMag = cameraOrthographic.getXmag(); - float yMag = cameraOrthographic.getYmag(); - float zNear = cameraOrthographic.getZnear(); - float zFar = cameraOrthographic.getZfar(); + double xMag = cameraOrthographic.getXmag(); + double yMag = cameraOrthographic.getYmag(); + double zNear = cameraOrthographic.getZnear(); + double zFar = cameraOrthographic.getZfar(); MathUtils.setIdentity4x4(localResult); - localResult[0] = 1.0f / xMag; - localResult[5] = 1.0f / yMag; - localResult[10] = 2.0f / (zNear - zFar); + localResult[0] = 1.0 / xMag; + localResult[5] = 1.0 / yMag; + localResult[10] = 2.0 / (zNear - zFar); localResult[14] = (zFar + zNear) / (zNear - zFar); } else diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraModel.java index 2ebe121d..8b49d392 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraModel.java @@ -93,21 +93,21 @@ public CameraPerspectiveModel getCameraPerspectiveModel() } @Override - public float[] computeProjectionMatrix(float result[], Float aspectRatio) + public double[] computeProjectionMatrix(double result[], Double aspectRatio) { return Cameras.computeProjectionMatrix(this, aspectRatio, result); } @Override - public Supplier createProjectionMatrixSupplier( + public Supplier createProjectionMatrixSupplier( DoubleSupplier aspectRatioSupplier) { return Suppliers.createTransformSupplier(this, (c, t) -> { - Float aspectRatio = null; + Double aspectRatio = null; if (aspectRatioSupplier != null) { - aspectRatio = (float)aspectRatioSupplier.getAsDouble(); + aspectRatio = (double)aspectRatioSupplier.getAsDouble(); } computeProjectionMatrix(t, aspectRatio); }); diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraOrthographicModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraOrthographicModel.java index 86d06b3e..d1510ae3 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraOrthographicModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraOrthographicModel.java @@ -36,29 +36,29 @@ public class DefaultCameraOrthographicModel implements CameraOrthographicModel /** * The magnification in x-direction */ - private Float xmag; + private Double xmag; /** * The magnification in y-direction */ - private Float ymag; + private Double ymag; /** * The clipping plane distance */ - private Float zfar; + private Double zfar; /** * The near clipping plane distance */ - private Float znear; + private Double znear; /** * Set the magnification in x-direction * * @param xmag The magnification */ - public void setXmag(Float xmag) + public void setXmag(Double xmag) { this.xmag = xmag; } @@ -68,7 +68,7 @@ public void setXmag(Float xmag) * * @param ymag The magnification */ - public void setYmag(Float ymag) + public void setYmag(Double ymag) { this.ymag = ymag; } @@ -78,7 +78,7 @@ public void setYmag(Float ymag) * * @param zfar The distance */ - public void setZfar(Float zfar) + public void setZfar(Double zfar) { this.zfar = zfar; } @@ -88,31 +88,31 @@ public void setZfar(Float zfar) * * @param znear The distance */ - public void setZnear(Float znear) + public void setZnear(Double znear) { this.znear = znear; } @Override - public Float getXmag() + public Double getXmag() { return xmag; } @Override - public Float getYmag() + public Double getYmag() { return ymag; } @Override - public Float getZfar() + public Double getZfar() { return zfar; } @Override - public Float getZnear() + public Double getZnear() { return znear; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraPerspectiveModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraPerspectiveModel.java index 1eca0dcb..cd9433d2 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraPerspectiveModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultCameraPerspectiveModel.java @@ -36,29 +36,29 @@ public class DefaultCameraPerspectiveModel implements CameraPerspectiveModel /** * The aspect ratio */ - private Float aspectRatio; + private Double aspectRatio; /** * The FOV */ - private Float yfov; + private Double yfov; /** * The clipping plane distance */ - private Float zfar; + private Double zfar; /** * The near clipping plane distance */ - private Float znear; + private Double znear; /** * Set the aspect ratio * * @param aspectRatio The aspect ratio */ - public void setAspectRatio(Float aspectRatio) + public void setAspectRatio(Double aspectRatio) { this.aspectRatio = aspectRatio; } @@ -68,7 +68,7 @@ public void setAspectRatio(Float aspectRatio) * * @param yfov The FOV */ - public void setYfov(Float yfov) + public void setYfov(Double yfov) { this.yfov = yfov; } @@ -78,7 +78,7 @@ public void setYfov(Float yfov) * * @param zfar The distance */ - public void setZfar(Float zfar) + public void setZfar(Double zfar) { this.zfar = zfar; } @@ -88,31 +88,31 @@ public void setZfar(Float zfar) * * @param znear The distance */ - public void setZnear(Float znear) + public void setZnear(Double znear) { this.znear = znear; } @Override - public Float getAspectRatio() + public Double getAspectRatio() { return aspectRatio; } @Override - public Float getYfov() + public Double getYfov() { return yfov; } @Override - public Float getZfar() + public Double getZfar() { return zfar; } @Override - public Float getZnear() + public Double getZnear() { return znear; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultMeshModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultMeshModel.java index c1c943de..0c7a1c38 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultMeshModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultMeshModel.java @@ -47,7 +47,7 @@ public class DefaultMeshModel extends AbstractNamedModelElement /** * The morph target weights */ - private float weights[]; + private double weights[]; /** * Creates a new instance @@ -73,7 +73,7 @@ public void addMeshPrimitiveModel(MeshPrimitiveModel meshPrimitiveModel) * * @param weights The weights */ - public void setWeights(float[] weights) + public void setWeights(double[] weights) { this.weights = weights; } @@ -85,7 +85,7 @@ public List getMeshPrimitiveModels() } @Override - public float[] getWeights() + public double[] getWeights() { return weights; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultNodeModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultNodeModel.java index afe1b320..435bcb3b 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultNodeModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultNodeModel.java @@ -49,14 +49,14 @@ public class DefaultNodeModel extends AbstractNamedModelElement /** * A thread-local, temporary 16-element matrix */ - private static final ThreadLocal TEMP_MATRIX_4x4_IN_LOCAL = - ThreadLocal.withInitial(() -> new float[16]); + private static final ThreadLocal TEMP_MATRIX_4x4_IN_LOCAL = + ThreadLocal.withInitial(() -> new double[16]); /** * A thread-local, temporary 16-element matrix */ - private static final ThreadLocal TEMP_MATRIX_4x4_IN_GLOBAL = - ThreadLocal.withInitial(() -> new float[16]); + private static final ThreadLocal TEMP_MATRIX_4x4_IN_GLOBAL = + ThreadLocal.withInitial(() -> new double[16]); /** * The parent of this node. This is null for the root node. @@ -86,27 +86,27 @@ public class DefaultNodeModel extends AbstractNamedModelElement /** * The local transform matrix */ - private float matrix[]; + private double matrix[]; /** * The translation */ - private float translation[]; + private double translation[]; /** * The rotation */ - private float rotation[]; + private double rotation[]; /** * The scale */ - private float scale[]; + private double scale[]; /** * The weights */ - private float weights[]; + private double weights[]; /** * Creates a new instance @@ -222,87 +222,87 @@ public CameraModel getCameraModel() } @Override - public void setMatrix(float[] matrix) + public void setMatrix(double[] matrix) { this.matrix = check(matrix, 16); } @Override - public float[] getMatrix() + public double[] getMatrix() { return matrix; } @Override - public void setTranslation(float[] translation) + public void setTranslation(double[] translation) { this.translation = check(translation, 3); } @Override - public float[] getTranslation() + public double[] getTranslation() { return translation; } @Override - public void setRotation(float[] rotation) + public void setRotation(double[] rotation) { this.rotation = check(rotation, 4); } @Override - public float[] getRotation() + public double[] getRotation() { return rotation; } @Override - public void setScale(float[] scale) + public void setScale(double[] scale) { this.scale = check(scale, 3); } @Override - public float[] getScale() + public double[] getScale() { return scale; } @Override - public void setWeights(float[] weights) + public void setWeights(double[] weights) { this.weights = weights; } @Override - public float[] getWeights() + public double[] getWeights() { return weights; } @Override - public float[] computeLocalTransform(float result[]) + public double[] computeLocalTransform(double result[]) { return computeLocalTransform(this, result); } @Override - public float[] computeGlobalTransform(float result[]) + public double[] computeGlobalTransform(double result[]) { return computeGlobalTransform(this, result); } @Override - public Supplier createGlobalTransformSupplier() + public Supplier createGlobalTransformSupplier() { return Suppliers.createTransformSupplier(this, NodeModel::computeGlobalTransform); } @Override - public Supplier createLocalTransformSupplier() + public Supplier createLocalTransformSupplier() { return Suppliers.createTransformSupplier(this, NodeModel::computeLocalTransform); @@ -324,13 +324,13 @@ public Supplier createLocalTransformSupplier() * @param result The result array * @return The result array */ - public static float[] computeLocalTransform( - NodeModel nodeModel, float result[]) + public static double[] computeLocalTransform( + NodeModel nodeModel, double result[]) { - float localResult[] = Utils.validate(result, 16); + double localResult[] = Utils.validate(result, 16); if (nodeModel.getMatrix() != null) { - float m[] = nodeModel.getMatrix(); + double m[] = nodeModel.getMatrix(); System.arraycopy(m, 0, localResult, 0, m.length); return localResult; } @@ -338,22 +338,22 @@ public static float[] computeLocalTransform( MathUtils.setIdentity4x4(localResult); if (nodeModel.getTranslation() != null) { - float t[] = nodeModel.getTranslation(); + double t[] = nodeModel.getTranslation(); localResult[12] = t[0]; localResult[13] = t[1]; localResult[14] = t[2]; } if (nodeModel.getRotation() != null) { - float q[] = nodeModel.getRotation(); - float m[] = TEMP_MATRIX_4x4_IN_LOCAL.get(); + double q[] = nodeModel.getRotation(); + double m[] = TEMP_MATRIX_4x4_IN_LOCAL.get(); MathUtils.quaternionToMatrix4x4(q, m); MathUtils.mul4x4(localResult, m, localResult); } if (nodeModel.getScale() != null) { - float s[] = nodeModel.getScale(); - float m[] = TEMP_MATRIX_4x4_IN_LOCAL.get(); + double s[] = nodeModel.getScale(); + double m[] = TEMP_MATRIX_4x4_IN_LOCAL.get(); MathUtils.setIdentity4x4(m); m[ 0] = s[0]; m[ 5] = s[1]; @@ -374,11 +374,11 @@ public static float[] computeLocalTransform( * @param result The result * @return The result */ - private static float[] computeGlobalTransform( - NodeModel nodeModel, float result[]) + private static double[] computeGlobalTransform( + NodeModel nodeModel, double result[]) { - float localResult[] = Utils.validate(result, 16); - float tempLocalTransform[] = TEMP_MATRIX_4x4_IN_GLOBAL.get(); + double localResult[] = Utils.validate(result, 16); + double tempLocalTransform[] = TEMP_MATRIX_4x4_IN_GLOBAL.get(); NodeModel currentNode = nodeModel; MathUtils.setIdentity4x4(localResult); while (currentNode != null) @@ -404,7 +404,7 @@ private static float[] computeGlobalTransform( * @throws IllegalArgumentException If the given array does not have * the expected length */ - private static float[] check(float array[], int expectedLength) + private static double[] check(double array[], int expectedLength) { if (array == null) { diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultSkinModel.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultSkinModel.java index cd70cda2..90e14144 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultSkinModel.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/impl/DefaultSkinModel.java @@ -48,7 +48,7 @@ public final class DefaultSkinModel extends AbstractNamedModelElement /** * The bind shape matrix */ - private float bindShapeMatrix[]; + private double bindShapeMatrix[]; /** * The joint nodes @@ -81,7 +81,7 @@ public DefaultSkinModel() * will be stored. If it is null, a new array will be * created, which represents the identity matrix. */ - public void setBindShapeMatrix(float[] bindShapeMatrix) + public void setBindShapeMatrix(double[] bindShapeMatrix) { if (bindShapeMatrix == null) { @@ -127,9 +127,9 @@ public void setInverseBindMatrices(AccessorModel inverseBindMatrices) @Override - public float[] getBindShapeMatrix(float[] result) + public double[] getBindShapeMatrix(double[] result) { - float localResult[] = Utils.validate(result, 16); + double localResult[] = Utils.validate(result, 16); System.arraycopy(bindShapeMatrix, 0, localResult, 0, 16); return localResult; } @@ -154,9 +154,9 @@ public AccessorModel getInverseBindMatrices() } @Override - public float[] getInverseBindMatrix(int index, float[] result) + public double[] getInverseBindMatrix(int index, double[] result) { - float localResult[] = Utils.validate(result, 16); + double localResult[] = Utils.validate(result, 16); AccessorFloatData inverseBindMatricesData = AccessorDatas.createFloat(inverseBindMatrices); for (int j = 0; j < 16; j++) diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/structure/GltfModelStructures.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/structure/GltfModelStructures.java index e2e58e17..16e86595 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/structure/GltfModelStructures.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/structure/GltfModelStructures.java @@ -604,7 +604,7 @@ private void initMeshModels() (DefaultMeshPrimitiveModel) sourceMeshPrimitiveModel); targetMeshModel.addMeshPrimitiveModel(targetMeshPrimitiveModel); } - float[] weights = sourceMeshModel.getWeights(); + double[] weights = sourceMeshModel.getWeights(); targetMeshModel.setWeights(Optionals.clone(weights)); } } @@ -706,11 +706,11 @@ private void initNodeModels() DefaultCameraModel targetCamera = cameraModelsMap.get(sourceCamera); targetNodeModel.setCameraModel(targetCamera); - float matrix[] = sourceNodeModel.getMatrix(); - float translation[] = sourceNodeModel.getTranslation(); - float rotation[] = sourceNodeModel.getRotation(); - float scale[] = sourceNodeModel.getScale(); - float weights[] = sourceNodeModel.getWeights(); + double matrix[] = sourceNodeModel.getMatrix(); + double translation[] = sourceNodeModel.getTranslation(); + double rotation[] = sourceNodeModel.getRotation(); + double scale[] = sourceNodeModel.getScale(); + double weights[] = sourceNodeModel.getWeights(); targetNodeModel.setMatrix(Optionals.clone(matrix)); targetNodeModel.setTranslation(Optionals.clone(translation)); @@ -1067,7 +1067,7 @@ private void initMaterialModel( targetMaterialModel.setBaseColorTexcoord( sourceMaterialModel.getBaseColorTexcoord()); - float[] baseColorFactor = sourceMaterialModel.getBaseColorFactor(); + double[] baseColorFactor = sourceMaterialModel.getBaseColorFactor(); targetMaterialModel.setBaseColorFactor( Optionals.clone(baseColorFactor)); @@ -1119,7 +1119,7 @@ private void initMaterialModel( targetMaterialModel.setEmissiveTexcoord( sourceMaterialModel.getEmissiveTexcoord()); - float emissiveFactor[] = sourceMaterialModel.getEmissiveFactor(); + double emissiveFactor[] = sourceMaterialModel.getEmissiveFactor(); targetMaterialModel.setEmissiveFactor( Optionals.clone(emissiveFactor)); } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/v1/GltfModelCreatorV1.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/v1/GltfModelCreatorV1.java index dc9f2eee..cdb465d9 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/v1/GltfModelCreatorV1.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/v1/GltfModelCreatorV1.java @@ -473,7 +473,7 @@ private void createSkinModels() for (Entry entry : skins.entrySet()) { Skin skin = entry.getValue(); - float[] bindShapeMatrix = skin.getBindShapeMatrix(); + double[] bindShapeMatrix = skin.getBindShapeMatrix(); DefaultSkinModel skinModel = new DefaultSkinModel(); skinModel.setBindShapeMatrix(bindShapeMatrix); gltfModel.addSkinModel(skinModel); @@ -1008,10 +1008,10 @@ private void initNodeModels() nodeModel.setCameraModel(cameraModel); } - float matrix[] = node.getMatrix(); - float translation[] = node.getTranslation(); - float rotation[] = node.getRotation(); - float scale[] = node.getScale(); + double matrix[] = node.getMatrix(); + double translation[] = node.getTranslation(); + double rotation[] = node.getRotation(); + double scale[] = node.getScale(); nodeModel.setMatrix(Optionals.clone(matrix)); nodeModel.setTranslation(Optionals.clone(translation)); nodeModel.setRotation(Optionals.clone(rotation)); diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfCreatorV2.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfCreatorV2.java index b3f89564..6fa5be9f 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfCreatorV2.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfCreatorV2.java @@ -1092,16 +1092,16 @@ private static Map computeIndexMap( * @param array The array * @return The list */ - private static List toList(float array[]) + private static List toList(double array[]) { if (array == null) { return null; } - List list = new ArrayList(); - for (float f : array) + List list = new ArrayList(); + for (double d : array) { - list.add(f); + list.add(d); } return list; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfModelCreatorV2.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfModelCreatorV2.java index 6854caa6..b58cf7c2 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfModelCreatorV2.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/GltfModelCreatorV2.java @@ -1012,10 +1012,10 @@ private void initNodeModels() nodeModel.setCameraModel(cameraModel); } - float matrix[] = node.getMatrix(); - float translation[] = node.getTranslation(); - float rotation[] = node.getRotation(); - float scale[] = node.getScale(); + double matrix[] = node.getMatrix(); + double translation[] = node.getTranslation(); + double rotation[] = node.getRotation(); + double scale[] = node.getScale(); nodeModel.setMatrix(Optionals.clone(matrix)); nodeModel.setTranslation(Optionals.clone(translation)); nodeModel.setRotation(Optionals.clone(rotation)); @@ -1186,7 +1186,7 @@ private void initMaterialModel( materialModel.setAlphaMode(AlphaMode.valueOf(alphaModeString)); } materialModel.setAlphaCutoff( - Optionals.of(material.getAlphaCutoff(), 0.5f)); + Optionals.of(material.getAlphaCutoff(), 0.5)); materialModel.setDoubleSided( Boolean.TRUE.equals(material.isDoubleSided())); @@ -1201,7 +1201,7 @@ private void initMaterialModel( materialModel.setBaseColorTexcoord( baseColorTextureInfo.getTexCoord()); } - float[] baseColorFactor = Optionals.of( + double[] baseColorFactor = Optionals.of( pbrMetallicRoughness.getBaseColorFactor(), pbrMetallicRoughness.defaultBaseColorFactor()); materialModel.setBaseColorFactor(baseColorFactor); @@ -1216,12 +1216,12 @@ private void initMaterialModel( materialModel.setMetallicRoughnessTexcoord( metallicRoughnessTextureInfo.getTexCoord()); } - float metallicFactor = Optionals.of( + double metallicFactor = Optionals.of( pbrMetallicRoughness.getMetallicFactor(), pbrMetallicRoughness.defaultMetallicFactor()); materialModel.setMetallicFactor(metallicFactor); - float roughnessFactor = Optionals.of( + double roughnessFactor = Optionals.of( pbrMetallicRoughness.getRoughnessFactor(), pbrMetallicRoughness.defaultRoughnessFactor()); materialModel.setRoughnessFactor(roughnessFactor); @@ -1236,7 +1236,7 @@ private void initMaterialModel( materialModel.setNormalTexcoord( normalTextureInfo.getTexCoord()); - float normalScale = Optionals.of( + double normalScale = Optionals.of( normalTextureInfo.getScale(), normalTextureInfo.defaultScale()); materialModel.setNormalScale(normalScale); @@ -1252,7 +1252,7 @@ private void initMaterialModel( materialModel.setOcclusionTexcoord( occlusionTextureInfo.getTexCoord()); - float occlusionStrength = Optionals.of( + double occlusionStrength = Optionals.of( occlusionTextureInfo.getStrength(), occlusionTextureInfo.defaultStrength()); materialModel.setOcclusionStrength(occlusionStrength); @@ -1269,7 +1269,7 @@ private void initMaterialModel( emissiveTextureInfo.getTexCoord()); } - float[] emissiveFactor = Optionals.of( + double[] emissiveFactor = Optionals.of( material.getEmissiveFactor(), material.defaultEmissiveFactor()); materialModel.setEmissiveFactor(emissiveFactor); @@ -1334,22 +1334,22 @@ private static void transferGltfChildOfRootPropertyElements( } /** - * Returns an array containing the float representations of the given + * Returns an array containing the double representations of the given * numbers, or null if the given list is null. * * @param numbers The numbers * @return The array */ - private static float[] toArray(List numbers) + private static double[] toArray(List numbers) { if (numbers == null) { return null; } - float array[] = new float[numbers.size()]; + double array[] = new double[numbers.size()]; for (int j = 0; j < numbers.size(); j++) { - array[j] = numbers.get(j).floatValue(); + array[j] = numbers.get(j).doubleValue(); } return array; } diff --git a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/MaterialModelV2.java b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/MaterialModelV2.java index 05c86445..e9a480bb 100644 --- a/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/MaterialModelV2.java +++ b/jgltf-model/src/main/java/de/javagl/jgltf/model/v2/MaterialModelV2.java @@ -63,7 +63,7 @@ public static enum AlphaMode /** * The base color factor */ - private float[] baseColorFactor; + private double[] baseColorFactor; /** * The base color texture @@ -78,12 +78,12 @@ public static enum AlphaMode /** * The metallic factor */ - private float metallicFactor; + private double metallicFactor; /** * The roughness factor */ - private float roughnessFactor; + private double roughnessFactor; /** * The metallic-roughness texture @@ -108,7 +108,7 @@ public static enum AlphaMode /** * The normal scale */ - private float normalScale; + private double normalScale; /** * The occlusion texture @@ -123,7 +123,7 @@ public static enum AlphaMode /** * The occlusion strength */ - private float occlusionStrength; + private double occlusionStrength; /** * The emissive texture @@ -138,7 +138,7 @@ public static enum AlphaMode /** * The emissive factor */ - private float[] emissiveFactor; + private double[] emissiveFactor; /** * The alpha mode @@ -148,7 +148,7 @@ public static enum AlphaMode /** * The alpha cutoff */ - private float alphaCutoff; + private double alphaCutoff; /** * Whether the material is double sided @@ -161,29 +161,29 @@ public static enum AlphaMode */ public MaterialModelV2() { - baseColorFactor = new float[]{ 1.0f, 1.0f, 1.0f, 1.0f }; + baseColorFactor = new double[]{ 1.0, 1.0, 1.0, 1.0 }; baseColorTexture = null; baseColorTexcoord = null; - metallicFactor = 1.0f; - roughnessFactor = 1.0f; + metallicFactor = 1.0; + roughnessFactor = 1.0; metallicRoughnessTexture = null; metallicRoughnessTexcoord = null; - normalScale = 1.0f; + normalScale = 1.0; normalTexture = null; normalTexcoord = null; occlusionTexture = null; occlusionTexcoord = null; - occlusionStrength = 1.0f; + occlusionStrength = 1.0; emissiveTexture = null; emissiveTexcoord = null; - emissiveFactor = new float[]{0.0f, 0.0f, 0.0f }; + emissiveFactor = new double[]{0.0, 0.0, 0.0 }; alphaMode = AlphaMode.OPAQUE; - alphaCutoff = 0.5f; + alphaCutoff = 0.5; doubleSided = false; } @@ -193,7 +193,7 @@ public MaterialModelV2() * * @return The base color factor */ - public float[] getBaseColorFactor() + public double[] getBaseColorFactor() { return baseColorFactor; } @@ -203,7 +203,7 @@ public float[] getBaseColorFactor() * * @param baseColorFactor The base color factor */ - public void setBaseColorFactor(float[] baseColorFactor) + public void setBaseColorFactor(double[] baseColorFactor) { this.baseColorFactor = baseColorFactor; } @@ -253,7 +253,7 @@ public void setBaseColorTexcoord(Integer baseColorTexcoord) * * @return The metallic factor */ - public float getMetallicFactor() + public double getMetallicFactor() { return metallicFactor; } @@ -263,7 +263,7 @@ public float getMetallicFactor() * * @param metallicFactor The metallic factor */ - public void setMetallicFactor(float metallicFactor) + public void setMetallicFactor(double metallicFactor) { this.metallicFactor = metallicFactor; } @@ -273,7 +273,7 @@ public void setMetallicFactor(float metallicFactor) * * @return The roughness factor */ - public float getRoughnessFactor() + public double getRoughnessFactor() { return roughnessFactor; } @@ -283,7 +283,7 @@ public float getRoughnessFactor() * * @param roughnessFactor The roughness factor */ - public void setRoughnessFactor(float roughnessFactor) + public void setRoughnessFactor(double roughnessFactor) { this.roughnessFactor = roughnessFactor; } @@ -374,7 +374,7 @@ public void setNormalTexcoord(Integer normalTexcoord) * * @return The normal scale */ - public float getNormalScale() + public double getNormalScale() { return normalScale; } @@ -384,7 +384,7 @@ public float getNormalScale() * * @param normalScale The normal scale */ - public void setNormalScale(float normalScale) + public void setNormalScale(double normalScale) { this.normalScale = normalScale; } @@ -434,7 +434,7 @@ public void setOcclusionTexcoord(Integer occlusionTexcoord) * * @return The occlusion strength */ - public float getOcclusionStrength() + public double getOcclusionStrength() { return occlusionStrength; } @@ -444,7 +444,7 @@ public float getOcclusionStrength() * * @param occlusionStrength The occlusion strength */ - public void setOcclusionStrength(float occlusionStrength) + public void setOcclusionStrength(double occlusionStrength) { this.occlusionStrength = occlusionStrength; } @@ -494,7 +494,7 @@ public void setEmissiveTexcoord(Integer emissiveTexcoord) * * @return The emissive factor */ - public float[] getEmissiveFactor() + public double[] getEmissiveFactor() { return emissiveFactor; } @@ -504,7 +504,7 @@ public float[] getEmissiveFactor() * * @param emissiveFactor The emissive factor */ - public void setEmissiveFactor(float[] emissiveFactor) + public void setEmissiveFactor(double[] emissiveFactor) { this.emissiveFactor = emissiveFactor; } @@ -534,7 +534,7 @@ public void setAlphaMode(AlphaMode alphaMode) * * @return The alpha cutoff */ - public float getAlphaCutoff() + public double getAlphaCutoff() { return alphaCutoff; } @@ -544,7 +544,7 @@ public float getAlphaCutoff() * * @param alphaCutoff The alpha cutoff */ - public void setAlphaCutoff(float alphaCutoff) + public void setAlphaCutoff(double alphaCutoff) { this.alphaCutoff = alphaCutoff; } diff --git a/jgltf-model/src/test/java/de/javagl/jgltf/model/TestSimpleMorph.java b/jgltf-model/src/test/java/de/javagl/jgltf/model/TestSimpleMorph.java index 5a8515c9..56aa9415 100644 --- a/jgltf-model/src/test/java/de/javagl/jgltf/model/TestSimpleMorph.java +++ b/jgltf-model/src/test/java/de/javagl/jgltf/model/TestSimpleMorph.java @@ -36,8 +36,8 @@ public void testReadWeights() throws IOException List meshes = gltfModel.getMeshModels(); MeshModel mesh = meshes.get(0); - float expected[] = new float[] { 0.5f, 0.5f }; - float actual[] = mesh.getWeights(); + double expected[] = new double[] { 0.5, 0.5 }; + double actual[] = mesh.getWeights(); assertArrayEquals(expected, actual, 0.0f); } diff --git a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandler.java b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandler.java index 3b680e59..29775ff6 100644 --- a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandler.java +++ b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandler.java @@ -57,6 +57,6 @@ interface MtlMaterialHandler * @return The {@link MaterialModel} */ MaterialModel createMaterialWithColor( - boolean withNormals, float r, float g, float b); + boolean withNormals, double r, double g, double b); } diff --git a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV1.java b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV1.java index 5d727631..fc47d14d 100644 --- a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV1.java +++ b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV1.java @@ -105,7 +105,7 @@ private MaterialModel createMaterialWithTexture( @Override public MaterialModel createMaterialWithColor(boolean withNormals, - float r, float g, float b) + double r, double g, double b) { MaterialModelV1 materialModelV1 = new MaterialModelV1(); if (withNormals) diff --git a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV2.java b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV2.java index 47665dd3..b2d4e8a6 100644 --- a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV2.java +++ b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialHandlerV2.java @@ -74,7 +74,7 @@ public MaterialModel createMaterial(ReadableObj obj, Mtl mtl) // If there is an MTL, try to translate some of the MTL // information into reasonable PBR information - float baseColorFactor[] = new float[] { 1.0f, 1.0f, 1.0f, 1.0f }; + double baseColorFactor[] = new double[] { 1.0f, 1.0f, 1.0f, 1.0f }; FloatTuple ambientColor = mtl.getKd(); if (ambientColor != null) { @@ -127,12 +127,12 @@ private MaterialModel createMaterialWithTexture(Mtl mtl) @Override public MaterialModelV2 createMaterialWithColor( - boolean withNormals, float r, float g, float b) + boolean withNormals, double r, double g, double b) { MaterialModelV2 material = new MaterialModelV2(); material.setRoughnessFactor(0.0f); material.setMetallicFactor(0.0f); - material.setBaseColorFactor(new float[] { r, g, b, 1.0f }); + material.setBaseColorFactor(new double[] { r, g, b, 1.0f }); material.setDoubleSided(true); return material; } diff --git a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialValues.java b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialValues.java index 8ab21be7..f2b7261e 100644 --- a/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialValues.java +++ b/jgltf-obj/src/main/java/de/javagl/jgltf/obj/model/MtlMaterialValues.java @@ -149,7 +149,7 @@ private static List createMaterialValue(FloatTuple t, float z) * @return The values */ static Map createDefaultMaterialValues( - float r, float g, float b) + double r, double g, double b) { Map materialValues = new LinkedHashMap(); diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/AbstractGltfViewer.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/AbstractGltfViewer.java index f5bb52e0..7cacd0b4 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/AbstractGltfViewer.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/AbstractGltfViewer.java @@ -64,12 +64,12 @@ public abstract class AbstractGltfViewer implements GltfViewer * {@link RenderedGltfModel} constructor, and eventually provide the data * for the uniforms that have the VIEWPORT semantic. */ - private final Supplier viewportSupplier = new Supplier() + private final Supplier viewportSupplier = new Supplier() { - private final float viewport[] = new float[4]; + private final double viewport[] = new double[4]; @Override - public float[] get() + public double[] get() { viewport[0] = 0; viewport[1] = 0; diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/CesiumRtcUtils.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/CesiumRtcUtils.java index 8562a2ab..e9f93e3a 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/CesiumRtcUtils.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/CesiumRtcUtils.java @@ -77,11 +77,11 @@ static boolean isCesiumRtcModelViewSemantic(String semanticString) * @param rtcCenter The RTC center * @return The supplier */ - static Supplier createCesiumRtcModelViewMatrixSupplier( - NodeModel nodeModel, Supplier viewMatrixSupplier, - float rtcCenter[]) + static Supplier createCesiumRtcModelViewMatrixSupplier( + NodeModel nodeModel, Supplier viewMatrixSupplier, + double rtcCenter[]) { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); return MatrixOps .create4x4() @@ -94,7 +94,7 @@ static Supplier createCesiumRtcModelViewMatrixSupplier( } /** - * Extract the 3D float array from the given glTF model that is stored + * Extract the 3D double array from the given glTF model that is stored * as the "center" property in the "CESIUM_RTC" * extension. If no such property is found, then null is * returned. @@ -102,7 +102,7 @@ static Supplier createCesiumRtcModelViewMatrixSupplier( * @param gltfModel The {@link GltfModel} * @return The RTC center */ - static float[] extractRtcCenterFromModel(GltfModel gltfModel) + static double[] extractRtcCenterFromModel(GltfModel gltfModel) { Map extensions = gltfModel.getExtensions(); if (extensions == null) @@ -114,14 +114,14 @@ static float[] extractRtcCenterFromModel(GltfModel gltfModel) } /** - * Extract the 3D float array from the given "CESIUM_RTC" + * Extract the 3D double array from the given "CESIUM_RTC" * extension object. This will be an array containing the numbers that * are stored in the list under the "center" property. * * @param extensionObject The extension object * @return The RTC center */ - private static float[] extractRtcCenterFromExtensionObbject( + private static double[] extractRtcCenterFromExtensionObbject( Object extensionObject) { // NOTE: This is very pragmatic and involves some manual fiddling. @@ -156,7 +156,7 @@ private static float[] extractRtcCenterFromExtensionObbject( + "have size 3, but has " + list.size()); return null; } - float result[] = new float[3]; + double result[] = new double[3]; for (int i = 0; i < list.size(); i++) { Object value = list.get(i); @@ -168,7 +168,7 @@ private static float[] extractRtcCenterFromExtensionObbject( return null; } Number number = (Number) value; - result[i] = number.floatValue(); + result[i] = number.doubleValue(); } return result; } diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedCamera.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedCamera.java index 4721333c..3b54ae37 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedCamera.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedCamera.java @@ -52,12 +52,12 @@ public class DefaultRenderedCamera implements RenderedCamera /** * The view matrix */ - private final float viewMatrix[]; + private final double viewMatrix[]; /** * The projection matrix */ - private final float projectionMatrix[]; + private final double projectionMatrix[]; /** * An optional supplier for the aspect ratio. If this is null, @@ -89,12 +89,12 @@ public class DefaultRenderedCamera implements RenderedCamera cameraModel, "The cameraModel may not be null"); this.aspectRatioSupplier = aspectRatioSupplier; - this.viewMatrix = new float[16]; - this.projectionMatrix = new float[16]; + this.viewMatrix = new double[16]; + this.projectionMatrix = new double[16]; } @Override - public float[] getViewMatrix() + public double[] getViewMatrix() { nodeModel.computeGlobalTransform(viewMatrix); MathUtils.invert4x4(viewMatrix, viewMatrix); @@ -102,12 +102,12 @@ public float[] getViewMatrix() } @Override - public float[] getProjectionMatrix() + public double[] getProjectionMatrix() { - Float aspectRatio = null; + Double aspectRatio = null; if (aspectRatioSupplier != null) { - aspectRatio = (float)aspectRatioSupplier.getAsDouble(); + aspectRatio = aspectRatioSupplier.getAsDouble(); } cameraModel.computeProjectionMatrix(projectionMatrix, aspectRatio); return projectionMatrix; diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedGltfModel.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedGltfModel.java index d7bb90ae..e3efe264 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedGltfModel.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/DefaultRenderedGltfModel.java @@ -147,7 +147,7 @@ public DefaultRenderedGltfModel( Objects.requireNonNull(viewConfiguration, "The viewConfiguration may not be null"); - float rtcCenter[] = CesiumRtcUtils.extractRtcCenterFromModel(gltfModel); + double rtcCenter[] = CesiumRtcUtils.extractRtcCenterFromModel(gltfModel); if (rtcCenter != null) { // NOTE: The RTC center is not really APPLIED here during diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/MatrixOps.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/MatrixOps.java index d7578ac3..9c6d1284 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/MatrixOps.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/MatrixOps.java @@ -37,8 +37,8 @@ import de.javagl.jgltf.model.MathUtils; /** - * A class for building suppliers of float arrays that represent matrices. - * The suppliers MAY always return the same instances of float arrays, + * A class for building suppliers of double arrays that represent matrices. + * The suppliers MAY always return the same instances of double arrays, * so callers MUST NOT store or modify the returned arrays.
*
* This class does not perform validations of the matrix size. The user @@ -56,7 +56,7 @@ class MatrixOps /** * The supplier that provides the input matrix */ - private final Supplier inputSupplier; + private final Supplier inputSupplier; /** * The chain of functions that will be applied. Starting with the @@ -65,7 +65,7 @@ class MatrixOps * The result of the final function will be returned by the * supplier that is created with {@link #build()}. */ - private final List> functions; + private final List> functions; /** * Create a builder for matrix operations that obtains its initial @@ -74,7 +74,7 @@ class MatrixOps * @param inputSupplier The input matrix supplier * @return The builder */ - static MatrixOps create4x4(Supplier inputSupplier) + static MatrixOps create4x4(Supplier inputSupplier) { return new MatrixOps(inputSupplier); } @@ -95,9 +95,9 @@ static MatrixOps create4x4() * * @return The supplier */ - private static Supplier createIdentitySupplier4x4() + private static Supplier createIdentitySupplier4x4() { - float matrix[] = new float[16]; + double matrix[] = new double[16]; return () -> { MathUtils.setIdentity4x4(matrix); @@ -110,10 +110,10 @@ private static Supplier createIdentitySupplier4x4() * * @param inputSupplier The supplier of the input matrix */ - private MatrixOps(Supplier inputSupplier) + private MatrixOps(Supplier inputSupplier) { this.inputSupplier = inputSupplier; - this.functions = new ArrayList>(); + this.functions = new ArrayList>(); } /** @@ -123,9 +123,9 @@ private MatrixOps(Supplier inputSupplier) * @param operandSupplier The supplier of the operand * @return This builder */ - MatrixOps multiply4x4(Supplier operandSupplier) + MatrixOps multiply4x4(Supplier operandSupplier) { - float result[] = new float[16]; + double result[] = new double[16]; functions.add(named("multiply4x4", input -> { MathUtils.mul4x4(input, operandSupplier.get(), result); @@ -141,7 +141,7 @@ MatrixOps multiply4x4(Supplier operandSupplier) */ MatrixOps invert4x4() { - float result[] = new float[16]; + double result[] = new double[16]; functions.add(named("invert4x4", input -> { MathUtils.invert4x4(input, result); @@ -157,7 +157,7 @@ MatrixOps invert4x4() */ MatrixOps invert3x3() { - float result[] = new float[9]; + double result[] = new double[9]; functions.add(named("invert3x4", input -> { MathUtils.invert3x3(input, result); @@ -173,7 +173,7 @@ MatrixOps invert3x3() */ MatrixOps transpose4x4() { - float result[] = new float[16]; + double result[] = new double[16]; functions.add(named("transpose4x4", input -> { MathUtils.transpose4x4(input, result); @@ -190,7 +190,7 @@ MatrixOps transpose4x4() */ MatrixOps getRotationScale() { - float result[] = new float[9]; + double result[] = new double[9]; functions.add(named("getRotationScale", input -> { MathUtils.getRotationScale(input, result); @@ -207,9 +207,9 @@ MatrixOps getRotationScale() * @param z The z-translation * @return This builder */ - MatrixOps translate(float x, float y, float z) + MatrixOps translate(double x, double y, double z) { - float result[] = new float[16]; + double result[] = new double[16]; functions.add(named("translate", input -> { MathUtils.translate(input, x, y, z, result); @@ -275,12 +275,12 @@ public String toString() * * @return The supplier */ - Supplier build() + Supplier build() { return () -> { - float current[] = inputSupplier.get(); - for (Function function : functions) + double current[] = inputSupplier.get(); + for (Function function : functions) { current = function.apply(current); if (logger.isLoggable(Level.FINEST)) diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedCamera.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedCamera.java index f1d030be..20d75bd4 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedCamera.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedCamera.java @@ -32,7 +32,7 @@ public interface RenderedCamera { /** - * The view matrix of this camera, as a float array with 16 elements, + * The view matrix of this camera, as a double array with 16 elements, * representing the 4x4 matrix in column-major order.
*
* The returned matrix will not be stored or modified. So the supplier @@ -40,10 +40,10 @@ public interface RenderedCamera * * @return The view matrix */ - float[] getViewMatrix(); + double[] getViewMatrix(); /** - * The projection matrix of this camera, as a float array with 16 elements, + * The projection matrix of this camera, as a double array with 16 elements, * representing the 4x4 matrix in column-major order.
*
* The returned matrix will not be stored or modified. So the supplier @@ -51,5 +51,5 @@ public interface RenderedCamera * * @return The projection matrix */ - float[] getProjectionMatrix(); + double[] getProjectionMatrix(); } \ No newline at end of file diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedMaterialHandler.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedMaterialHandler.java index 35c2bd22..58d8a76a 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedMaterialHandler.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/RenderedMaterialHandler.java @@ -284,7 +284,7 @@ RenderedMaterial createRenderedMaterial( { values.put("hasBaseColorTexture", 0); } - float[] baseColorFactor = material.getBaseColorFactor(); + double[] baseColorFactor = material.getBaseColorFactor(); values.put("baseColorFactor", baseColorFactor); @@ -301,10 +301,10 @@ RenderedMaterial createRenderedMaterial( { values.put("hasMetallicRoughnessTexture", 0); } - float metallicFactor = material.getMetallicFactor(); + double metallicFactor = material.getMetallicFactor(); values.put("metallicFactor", metallicFactor); - float roughnessFactor = material.getRoughnessFactor(); + double roughnessFactor = material.getRoughnessFactor(); values.put("roughnessFactor", roughnessFactor); @@ -317,7 +317,7 @@ RenderedMaterial createRenderedMaterial( materialStructure.getNormalTexCoordSemantic()); values.put("normalTexture", normalTexture); - float normalScale = material.getNormalScale(); + double normalScale = material.getNormalScale(); values.put("normalScale", normalScale); } else @@ -335,7 +335,7 @@ RenderedMaterial createRenderedMaterial( materialStructure.getOcclusionTexCoordSemantic()); values.put("occlusionTexture", occlusionTexture); - float occlusionStrength = material.getOcclusionStrength(); + double occlusionStrength = material.getOcclusionStrength(); values.put("occlusionStrength", occlusionStrength); } else @@ -360,11 +360,11 @@ RenderedMaterial createRenderedMaterial( values.put("hasEmissiveTexture", 0); } - float[] emissiveFactor = material.getEmissiveFactor(); + double[] emissiveFactor = material.getEmissiveFactor(); values.put("emissiveFactor", emissiveFactor); - float lightPosition[] = { -800,500,500 }; + double lightPosition[] = { -800,500,500 }; values.put("lightPosition", lightPosition); DefaultRenderedMaterial renderedMaterial = diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/TechniqueStatesFunctions.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/TechniqueStatesFunctions.java index 2e8e0472..ebd66e17 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/TechniqueStatesFunctions.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/TechniqueStatesFunctions.java @@ -42,8 +42,8 @@ class TechniqueStatesFunctions /** * The default BlendColor */ - private static final float[] DEFAULT_BLENDCOLOR = - new float[] { 0.0F, 0.0F, 0.0F, 0.0F }; + private static final double[] DEFAULT_BLENDCOLOR = + new double[] { 0.0F, 0.0F, 0.0F, 0.0F }; /** * The default BlendEquationSeparate @@ -84,8 +84,8 @@ class TechniqueStatesFunctions /** * The default DepthRange */ - private static final float[] DEFAULT_DEPTH_RANGE = - new float[] { 0.0F, 1.0F }; + private static final double[] DEFAULT_DEPTH_RANGE = + new double[] { 0.0F, 1.0F }; /** * The default FrontFace @@ -96,14 +96,14 @@ class TechniqueStatesFunctions /** * The default LineWidth */ - private static final float[] DEFAULT_LINE_WIDTH = - new float[] { 1.0F }; + private static final double[] DEFAULT_LINE_WIDTH = + new double[] { 1.0F }; /** * The default PolygonOffset */ - private static final float[] DEFAULT_POLYGON_OFFSET = - new float[] { 0.0F, 0.0F }; + private static final double[] DEFAULT_POLYGON_OFFSET = + new double[] { 0.0F, 0.0F }; /** * Create the functions that, when executed, call the functions @@ -122,14 +122,14 @@ static List createTechniqueStatesFunctionsSettingCommands( { List commands = new ArrayList(); - float[] blendColor = Optionals.of( + double[] blendColor = Optionals.of( techniqueStatesFunctionsModel.getBlendColor(), DEFAULT_BLENDCOLOR); commands.add(() -> { glContext.setBlendColor( - blendColor[0], blendColor[1], - blendColor[2], blendColor[3]); + (float)blendColor[0], (float)blendColor[1], + (float)blendColor[2], (float)blendColor[3]); }); int[] blendEquationSeparate = Optionals.of( @@ -185,12 +185,13 @@ static List createTechniqueStatesFunctionsSettingCommands( glContext.setDepthMask(depthMask[0]); }); - float[] depthRange = Optionals.of( + double[] depthRange = Optionals.of( techniqueStatesFunctionsModel.getDepthRange(), DEFAULT_DEPTH_RANGE); commands.add(() -> { - glContext.setDepthRange(depthRange[0], depthRange[1]); + glContext.setDepthRange( + (float)depthRange[0], (float)depthRange[1]); }); int[] frontFace = Optionals.of( @@ -201,21 +202,21 @@ static List createTechniqueStatesFunctionsSettingCommands( glContext.setFrontFace(frontFace[0]); }); - float[] lineWidth = Optionals.of( + double[] lineWidth = Optionals.of( techniqueStatesFunctionsModel.getLineWidth(), DEFAULT_LINE_WIDTH); commands.add(() -> { - glContext.setLineWidth(lineWidth[0]); + glContext.setLineWidth((float)lineWidth[0]); }); - float[] polygonOffset = Optionals.of( + double[] polygonOffset = Optionals.of( techniqueStatesFunctionsModel.getPolygonOffset(), DEFAULT_POLYGON_OFFSET); commands.add(() -> { glContext.setPolygonOffset( - polygonOffset[0], polygonOffset[1]); + (float)polygonOffset[0], (float)polygonOffset[1]); }); return commands; diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetterFactory.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetterFactory.java index 6fddaef0..e0485e50 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetterFactory.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetterFactory.java @@ -57,18 +57,18 @@ class UniformGetterFactory /** * A supplier for the view matrix. */ - private final Supplier viewMatrixSupplier; + private final Supplier viewMatrixSupplier; /** * A supplier for the projection matrix. */ - private final Supplier projectionMatrixSupplier; + private final Supplier projectionMatrixSupplier; /** - * A supplier that supplies the viewport, as 4 float elements, + * A supplier that supplies the viewport, as 4 double elements, * [x, y, width, height] */ - private final Supplier viewportSupplier; + private final Supplier viewportSupplier; /** * The set of uniform names for which a null value @@ -79,26 +79,26 @@ class UniformGetterFactory /** * The RTC center point for the CESIUM_RTC extension */ - private float rtcCenter[]; + private double rtcCenter[]; /** * Creates a new instance * * @param viewportSupplier A supplier that supplies the viewport, - * as 4 float elements, [x, y, width, height] + * as 4 double elements, [x, y, width, height] * @param viewMatrixSupplier A supplier that supplies the view matrix, - * which is a 4x4 matrix, given as a float array, in column-major order + * which is a 4x4 matrix, given as a double array, in column-major order * @param projectionMatrixSupplier A supplier that supplies the projection - * matrix, which is a 4x4 matrix, given as a float array, in + * matrix, which is a 4x4 matrix, given as a double array, in * column-major order * @param rtcCenter An optional 3D center point for the CESIUM_RTC * extension */ public UniformGetterFactory( - Supplier viewportSupplier, - Supplier viewMatrixSupplier, - Supplier projectionMatrixSupplier, - float rtcCenter[]) + Supplier viewportSupplier, + Supplier viewMatrixSupplier, + Supplier projectionMatrixSupplier, + double rtcCenter[]) { this.viewportSupplier = Objects.requireNonNull(viewportSupplier, "The viewportSupplier may not be null"); @@ -107,7 +107,7 @@ public UniformGetterFactory( this.projectionMatrixSupplier = Objects.requireNonNull(projectionMatrixSupplier, "The projectionMatrixSupplier may not be null"); - this.rtcCenter = rtcCenter == null ? new float[3] : rtcCenter.clone(); + this.rtcCenter = rtcCenter == null ? new double[3] : rtcCenter.clone(); this.reportedNullUniformNames = new LinkedHashSet(); } @@ -233,7 +233,7 @@ private Supplier createNullLoggingSupplier( * * * The actual contents of these joint matrices is computed from the - * {@link SkinModel#getBindShapeMatrix(float[]) bind shape matrix}, the + * {@link SkinModel#getBindShapeMatrix(double[]) bind shape matrix}, the * {@link SkinModel#getInverseBindMatrices() inverse bind matrices} and * the global transform of the given node and the joint node. See the glTF * specification for details.
@@ -288,119 +288,127 @@ private Supplier createSemanticBasedSupplier( { case LOCAL: { - return nodeModel.createLocalTransformSupplier(); + return toFloat(nodeModel.createLocalTransformSupplier()); } case MODEL: { - return nodeModel.createGlobalTransformSupplier(); + return toFloat(nodeModel.createGlobalTransformSupplier()); } case VIEW: { - return viewMatrixSupplier; + return toFloat(viewMatrixSupplier); } case PROJECTION: { - return projectionMatrixSupplier; + return toFloat(projectionMatrixSupplier); } case MODELVIEW: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(viewMatrixSupplier) .multiply4x4(modelMatrixSupplier) .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELVIEWPROJECTION: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(projectionMatrixSupplier) .multiply4x4(viewMatrixSupplier) .multiply4x4(modelMatrixSupplier) .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELINVERSE: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(modelMatrixSupplier) .invert4x4() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case VIEWINVERSE: { - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(viewMatrixSupplier) .invert4x4() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELVIEWINVERSE: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(viewMatrixSupplier) .multiply4x4(modelMatrixSupplier) .invert4x4() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case PROJECTIONINVERSE: { - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(projectionMatrixSupplier) .invert4x4() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELVIEWPROJECTIONINVERSE: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(projectionMatrixSupplier) .multiply4x4(viewMatrixSupplier) .multiply4x4(modelMatrixSupplier) .invert4x4() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELINVERSETRANSPOSE: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(modelMatrixSupplier) .invert4x4() .transpose4x4() .getRotationScale() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case MODELVIEWINVERSETRANSPOSE: { - Supplier modelMatrixSupplier = + Supplier modelMatrixSupplier = nodeModel.createGlobalTransformSupplier(); - return MatrixOps + Supplier doubleResult = MatrixOps .create4x4(viewMatrixSupplier) .multiply4x4(modelMatrixSupplier) .invert4x4() @@ -408,16 +416,17 @@ private Supplier createSemanticBasedSupplier( .getRotationScale() .log(semanticString, Level.FINE) .build(); + return toFloat(doubleResult); } case VIEWPORT: { - return viewportSupplier; + return toFloat(viewportSupplier); } case JOINTMATRIX: { - return createJointMatrixSupplier(currentNodeModel); + return toFloat(createJointMatrixSupplier(currentNodeModel)); } default: @@ -428,6 +437,41 @@ private Supplier createSemanticBasedSupplier( return null; } + /** + * Returns a new supplier that converts the result from the given + * supplier into a float array + * + * @param delegate The delegate + * @return The supplier + */ + private static Supplier toFloat(Supplier delegate) + { + return new Supplier() + { + float result[] = null; + + @Override + public float[] get() + { + double delegateResult[] = delegate.get(); + if (delegateResult == null) + { + return null; + } + if (result == null || result.length != delegateResult.length) + { + result = new float[delegateResult.length]; + } + for (int i=0; i createSemanticBasedSupplier( * @param nodeModel The {@link NodeModel} * @return The supplier */ - private static Supplier createJointMatrixSupplier( + private static Supplier createJointMatrixSupplier( NodeModel nodeModel) { SkinModel skinModel = nodeModel.getSkinModel(); // Create the supplier for the bind shape matrix (or a supplier // of the identity matrix, if the bind shape matrix is null) - float bindShapeMatrix[] = skinModel.getBindShapeMatrix(null); - Supplier bindShapeMatrixSupplier = + double bindShapeMatrix[] = skinModel.getBindShapeMatrix(null); + Supplier bindShapeMatrixSupplier = MatrixOps.create4x4(() -> bindShapeMatrix) .log("bindShapeMatrix", Level.FINE) .build(); @@ -453,19 +497,19 @@ private static Supplier createJointMatrixSupplier( // Create one supplier for each inverse bind matrix. Each of them will // extract one element of the inverse bind matrix accessor data and - // provide it as a single float[16] array, representing a 4x4 matrix - List> inverseBindMatrixSuppliers = - new ArrayList>(); + // provide it as a single double[16] array, representing a 4x4 matrix + List> inverseBindMatrixSuppliers = + new ArrayList>(); for (int i = 0; i < numJoints; i++) { final int currentJointIndex = i; - float inverseBindMatrix[] = new float[16]; - Supplier inverseBindMatrixSupplier = () -> + double inverseBindMatrix[] = new double[16]; + Supplier inverseBindMatrixSupplier = () -> { return skinModel.getInverseBindMatrix( currentJointIndex, inverseBindMatrix); }; - Supplier loggingInverseBindMatrixSupplier = + Supplier loggingInverseBindMatrixSupplier = MatrixOps.create4x4(inverseBindMatrixSupplier) .log("inverseBindMatrix "+i, Level.FINE) .build(); @@ -479,16 +523,16 @@ private static Supplier createJointMatrixSupplier( // [globalTransformOfJointNode] * // [inverseBindMatrix(j)] * // [bindShapeMatrix] - List> jointMatrixSuppliers = - new ArrayList>(); + List> jointMatrixSuppliers = + new ArrayList>(); for (int j = 0; j < numJoints; j++) { NodeModel jointNodeModel = joints.get(j); - Supplier inverseBindMatrixSupplier = + Supplier inverseBindMatrixSupplier = inverseBindMatrixSuppliers.get(j); - Supplier jointMatrixSupplier = MatrixOps + Supplier jointMatrixSupplier = MatrixOps .create4x4(nodeModel.createGlobalTransformSupplier()) .invert4x4() .multiply4x4(jointNodeModel.createGlobalTransformSupplier()) @@ -502,14 +546,14 @@ private static Supplier createJointMatrixSupplier( // Create a supplier for the joint matrices, which combines the // joint matrices of the individual joint matrix suppliers // into one array - float jointMatrices[] = new float[jointMatrixSuppliers.size() * 16]; + double jointMatrices[] = new double[jointMatrixSuppliers.size() * 16]; return () -> { for (int i=0; i jointMatrixSupplier = + Supplier jointMatrixSupplier = jointMatrixSuppliers.get(i); - float[] jointMatrix = jointMatrixSupplier.get(); + double[] jointMatrix = jointMatrixSupplier.get(); System.arraycopy(jointMatrix, 0, jointMatrices, i * 16, 16); } return jointMatrices; diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetters.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetters.java index 32aa3167..acc76bb5 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetters.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/UniformGetters.java @@ -306,6 +306,18 @@ else if (object instanceof float[]) { return (float[])object; } + else if (object instanceof double[]) + { + double d[] = (double[]) object; + if (value == null || value.length != d.length) + { + value = new float[d.length]; + } + for (int i=0; i list = asNumberList(object); diff --git a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/ViewConfiguration.java b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/ViewConfiguration.java index 1f9656b9..42633708 100644 --- a/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/ViewConfiguration.java +++ b/jgltf-viewer/src/main/java/de/javagl/jgltf/viewer/ViewConfiguration.java @@ -47,26 +47,26 @@ final class ViewConfiguration /** * The supplier for the viewport, as an array [x, y, width, height] */ - private final Supplier viewportSupplier; + private final Supplier viewportSupplier; /** * The supplier for the view matrix */ - private final Supplier viewMatrixSupplier; + private final Supplier viewMatrixSupplier; /** * The supplier for the projection matrix */ - private final Supplier projectionMatrixSupplier; + private final Supplier projectionMatrixSupplier; /** * Creates a new view configuration * * @param viewportSupplier A supplier that supplies the viewport, - * as 4 float elements, [x, y, width, height] + * as 4 double elements, [x, y, width, height] */ ViewConfiguration( - Supplier viewportSupplier) + Supplier viewportSupplier) { this.viewportSupplier = Objects.requireNonNull( viewportSupplier, "The viewportSupplier may not be null"); @@ -97,7 +97,7 @@ public RenderedCamera getRenderedCamera() } /** - * Create a supplier for the view matrix, as a float array with 16 + * Create a supplier for the view matrix, as a double array with 16 * elements, containing the view matrix in column-major order.
*
* The resulting supplier will supply a view matrix as follows: @@ -116,9 +116,9 @@ public RenderedCamera getRenderedCamera() * * @return The view matrix supplier */ - private Supplier createViewMatrixSupplier() + private Supplier createViewMatrixSupplier() { - float defaultViewMatrix[] = MathUtils.createIdentity4x4(); + double defaultViewMatrix[] = MathUtils.createIdentity4x4(); return () -> { if (renderedCamera == null) @@ -131,7 +131,7 @@ private Supplier createViewMatrixSupplier() } /** - * Create a supplier for the projection matrix, as a float array with 16 + * Create a supplier for the projection matrix, as a double array with 16 * elements, containing the projection matrix in column-major order.
*
* The resulting supplier will supply a projection matrix as follows: @@ -150,9 +150,9 @@ private Supplier createViewMatrixSupplier() * * @return The projection matrix supplier */ - private Supplier createProjectionMatrixSupplier() + private Supplier createProjectionMatrixSupplier() { - float defaultProjectionMatrix[] = MathUtils.createIdentity4x4(); + double defaultProjectionMatrix[] = MathUtils.createIdentity4x4(); return () -> { if (renderedCamera == null) @@ -170,7 +170,7 @@ private Supplier createProjectionMatrixSupplier() * * @return The viewport */ - public float[] getViewport() + public double[] getViewport() { return viewportSupplier.get(); } @@ -184,7 +184,7 @@ public float[] getViewport() * * @return The view matrix */ - public float[] getViewMatrix() + public double[] getViewMatrix() { return viewMatrixSupplier.get(); } @@ -198,7 +198,7 @@ public float[] getViewMatrix() * * @return The view matrix */ - public float[] getProjectionMatrix() + public double[] getProjectionMatrix() { return projectionMatrixSupplier.get(); }