laymur 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PlaneGeometry, Color, Scene, OrthographicCamera, ShaderMaterial, Vector4, Mesh, Texture, Vector2, Vector3, Matrix2, Matrix3, Matrix4, MathUtils, Quaternion, CanvasTexture, LinearFilter, WebGLRenderTarget, UnsignedByteType, RGBAFormat, PerspectiveCamera, InstancedBufferGeometry, InstancedBufferAttribute } from 'three';
1
+ import { Color, PlaneGeometry, Scene, OrthographicCamera, ShaderMaterial, Vector4, Mesh, Texture, Vector2, Vector3, Matrix2, Matrix3, Matrix4, MathUtils, Quaternion, CanvasTexture, LinearFilter, WebGLRenderTarget, UnsignedByteType, RGBAFormat, PerspectiveCamera, InstancedBufferGeometry, InstancedBufferAttribute } from 'three';
2
2
 
3
3
  /**
4
4
  * Mathematical expression builder for constraint equations in the UI layout system.
@@ -2169,6 +2169,7 @@ var fragmentShader = "in vec2 io_UV;\n\nuniform float alphaTest;\n\n#include <co
2169
2169
  var vertexShader = "out vec2 io_UV;\n#include <common>\n\nvoid main() {\n #include <begin_vertex>\n io_UV = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
2170
2170
 
2171
2171
  const DEFAULT_ALPHA_TEST = 0.25;
2172
+ const COLOR = new Color();
2172
2173
  const UNIFROM_TYPE_MAP = new Map([
2173
2174
  [UIColor, "vec4"],
2174
2175
  [Color, "vec3"],
@@ -2258,7 +2259,9 @@ class UISceneWrapper {
2258
2259
  throw new Error(`Uniform ${uniform} not found in material`);
2259
2260
  }
2260
2261
  if (value instanceof UIColor) {
2261
- descriptor.material.uniforms[uniform].value.set(value.r, value.g, value.b, value.a);
2262
+ const linear = COLOR.set(value.r, value.g, value.b);
2263
+ linear.convertSRGBToLinear();
2264
+ descriptor.material.uniforms[uniform].value.set(linear.r, linear.g, linear.b, value.a);
2262
2265
  }
2263
2266
  else {
2264
2267
  descriptor.material.uniforms[uniform].value = value;
@@ -6787,7 +6790,7 @@ class UIFullscreenLayer extends UILayer {
6787
6790
  *
6788
6791
  * @param position - 2D position in layer space
6789
6792
  * @param camera - Camera for unprojection
6790
- * @param z - Z depth in camera space (defaults to 1)
6793
+ * @param z - z in NDC space (defaults to -1)
6791
6794
  * @returns 3D position in world space
6792
6795
  */
6793
6796
  projectLayerPosition(position, camera, z = -1) {