New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/shader-ast-stdlib

Package Overview
Dependencies
Maintainers
0
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/shader-ast-stdlib - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

2

CHANGELOG.md
# Change Log
- **Last updated**: 2025-01-29T16:25:48Z
- **Last updated**: 2025-02-13T16:03:11Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -5,0 +5,0 @@

@@ -5,3 +5,3 @@ import { type FloatTerm, type Vec3Term } from "@thi.ng/shader-ast";

* `a+b*cos(2π*(c*t+d))`, where `a`..`d` are the gradient coefficients and `t`
* the gradient position in the [0,1] interval.
* the gradient position in the `[0,1]` interval.
*

@@ -12,2 +12,3 @@ * @remarks

* References:
*
* - https://iquilezles.org/articles/palettes/

@@ -14,0 +15,0 @@ * - https://github.com/thi-ng/umbrella/tree/develop/packages/color#cosine-gradients

@@ -20,3 +20,3 @@ import type { FloatTerm, Mat3Term, Vec2Term, Vec3Term } from "@thi.ng/shader-ast";

* Applies level remapping from `input` to `output` (each given as
* `vec2(min,max)`) with `gamma` correction. Results will be clamped to [0..1]
* `vec2(min,max)`) with `gamma` correction. Results will be clamped to `[0,1]`
* range.

@@ -23,0 +23,0 @@ */

@@ -9,3 +9,3 @@ import type { Fn2 } from "@thi.ng/api";

*
* @remark
* @remarks
* All built-in PD operators are defined via this HOF. The two given coefficient

@@ -12,0 +12,0 @@ * functions are used to extract blending coefficients for src/dest colors and

import type { FloatTerm, Term, Type } from "@thi.ng/shader-ast";
/**
* Utility function to create an n-ary conditional based on given float value
* `x` in [0,1] range and any number of branch terms (at least 1). Returns a
* `x` in `[0,1]` range and any number of branch terms (at least 1). Returns a
* nested ternary expression.

@@ -6,0 +6,0 @@ *

/**
* Computes exponential fog factor [0..1], based on given fully
* saturated fog distance and density.
* Computes exponential fog factor `[0,1]`, based on given fully saturated fog
* distance and density.
*

@@ -5,0 +5,0 @@ * @param dist - float

/**
* Similar to {@link fogExp}. Computes exponential fog factor [0..1], based on
* Similar to {@link fogExp}. Computes exponential fog factor `[0,1]`, based on
* given fully saturated fog distance and density. Uses
* [`exp2()`](https://docs.thi.ng/umbrella/shader-ast/functions/exp2.html)
* [`exp2`](https://docs.thi.ng/umbrella/shader-ast/functions/exp2.html)
* internally.

@@ -6,0 +6,0 @@ *

/**
* Computes linear fog factor [0..1], based on given fog min/max
* distances.
* Computes linear fog factor `[0,1]`, based on given fog min/max distances.
*

@@ -5,0 +4,0 @@ * @param dist - float

import type { Fn } from "@thi.ng/api";
import type { FloatTerm, Prim, Term } from "@thi.ng/shader-ast";
/**
* Higher order function. Takes an AST type ID, a single-arg scalar
* function `fn`, number of octaves (default: 4) and an optional
* function name. Returns a new function which computes the summed value
* of `fn` over the given number octaves and accepts 3 args:
* Higher order function. Takes an AST type ID, a single-arg scalar function
* `fn`, number of octaves (default: 4) and an optional function name. Returns a
* new function which computes the summed value of `fn` over the given number
* octaves and accepts 3 args:
*

@@ -13,4 +13,3 @@ * - position (float)

*
* For each octave `i` [0..oct), the function is (in principle)
* evaluated as:
* For each octave `i` `[0,oct)`, the function is (in principle) evaluated as:
*

@@ -17,0 +16,0 @@ * n += decay / exp2(i) * fn(pos * exp2(i) + i * shift)

import type { Prim, PrimTerm, Term, TermType } from "@thi.ng/shader-ast";
/**
* Returns normalized value of `x` WRT to interval [a,b]. Returns 0, if
* `a` equals `b`.
* Returns normalized value of `x` WRT to interval `[a,b]`. Returns 0, if `a`
* equals `b`.
*

@@ -13,3 +13,3 @@ * @param x -

* Similar to {@link fitNorm1} but also for vector types and without checking if
* `a == b`. Scales value `x` from closed interval [a,b] to closed [0,1]
* `a == b`. Scales value `x` from closed interval `[a,b]` to closed `[0,1]`
* interval. No clamping performed.

@@ -23,3 +23,3 @@ *

/**
* Fits value `x` from closed interval [a,b] to closed interval [c,d]. No
* Fits value `x` from closed interval `[a,b]` to closed interval `[c,d]`. No
* clamping performed.

@@ -35,3 +35,3 @@ *

/**
* Same as {@link fit}, but first clamps `x` to closed [a,b] interval.
* Same as {@link fit}, but first clamps `x` to closed `[a,b]` interval.
*

@@ -46,4 +46,4 @@ * @param x -

/**
* Inline function. Fits value `a` in [0..1] interval to new interval
* [b..c]. No clamping performed. Same as `mix(b, c, a)`
* Inline function. Fits value `a` in `[0,1]` interval to new interval `[b,c]`.
* No clamping performed. Same as `mix(b, c, a)`
*

@@ -56,4 +56,4 @@ * @param a -

/**
* Inline function. Fits value `x` in [-1..+1] interval to [0..1]
* interval. No clamping performed.
* Inline function. Fits value `x` in `[-1,1]` interval to `[0,1]` interval. No
* clamping performed.
*

@@ -64,4 +64,4 @@ * @param x -

/**
* Inline function. Fits value `x` in [0..1] interval to [-1..+1]
* interval. No clamping performed.
* Inline function. Fits value `x` in `[0,1]` interval to `[-1,1]` interval. No
* clamping performed.
*

@@ -68,0 +68,0 @@ * @param x -

@@ -11,4 +11,6 @@ /**

/**
* Same as thi.ng/math foldback01(). Folds `x` into the closed [0..1] interval,
* using infinite internal reflection on either side of the interval.
* Same as
* [`foldback01`](https://docs.thi.ng/umbrella/math/functions/foldback01.html).
* Folds `x` into the closed `[0,1]` interval, using infinite internal
* reflection on either side of the interval.
*

@@ -15,0 +17,0 @@ * @param x

import type { Vec2Term } from "@thi.ng/shader-ast";
/**
* Inline function. Returns counter-clockwise perpendicular vector (assuming
* Y-up). [-y, x]
* Y-up). `[-y,x]`
*

@@ -11,3 +11,3 @@ * @param v -

* Inline function. Returns clockwise perpendicular vector (assuming Y-up).
* [y,-x]
* `[y,-x]`
*

@@ -14,0 +14,0 @@ * @param v -

/**
* Encodes a float value in [0,1) interval to a vec4 suitable for a 8bit/channel
* render texture. Use {@link unpackFloat} for reverse op.
* Encodes a float value in `[0,1)` interval to a vec4 suitable for a
* 8bit/channel render texture. Use {@link unpackFloat} for reverse op.
*

@@ -5,0 +5,0 @@ * @remarks

import type { TaggedFn1 } from "@thi.ng/shader-ast";
/**
* Specialized version of {@link smootherStep}, assuming edges are 0/1
* respectively and `x` is in [0..1]. No clamping performed.
* respectively and `x` is in `[0,1]`. No clamping performed.
*

@@ -6,0 +6,0 @@ * @param x

@@ -5,6 +5,6 @@ /**

*
* - cell noise (0,0)
* - voronoi (1,0)
* - perlin noise (0,1)
* - voronoise (1,1)
* - cell noise `(0,0)`
* - voronoi `(1,0)`
* - perlin noise `(0,1)`
* - voronoise `(1,1)`
*

@@ -11,0 +11,0 @@ * http://www.iquilezles.org/www/articles/voronoise/voronoise.htm

@@ -7,3 +7,3 @@ import type { Func2 } from "@thi.ng/shader-ast";

* function. The returned function takes 2 args: position and jitter amount, the
* latter in [0..1] interval. Returns noise components as vec2, with the x
* latter in `[0,1]` interval. Returns noise components as vec2, with the x
* component containing the distance from closest simplex center and y the noise

@@ -10,0 +10,0 @@ * value. The vector components can be used individually or combined (e.g.

{
"name": "@thi.ng/shader-ast-stdlib",
"version": "1.0.7",
"version": "1.0.8",
"description": "Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast",

@@ -45,8 +45,8 @@ "type": "module",

"dependencies": {
"@thi.ng/api": "^8.11.19",
"@thi.ng/shader-ast": "^1.0.7"
"@thi.ng/api": "^8.11.20",
"@thi.ng/shader-ast": "^1.0.8"
},
"devDependencies": {
"esbuild": "^0.24.2",
"typedoc": "^0.27.6",
"esbuild": "^0.25.0",
"typedoc": "^0.27.7",
"typescript": "^5.7.3"

@@ -379,3 +379,3 @@ },

},
"gitHead": "dcc1dbfa6eae31ac65e12843987b94d4a7edc144\n"
"gitHead": "9a0b33253fef092aaf301decf6ecd54317874d4c\n"
}
import type { RaymarchScene } from "../api.js";
/**
* Higher order function returning an function to compute the Ambient
* Occlusion term / shadow factor for given SDF scene function. The
* returned function takes 2 arguments: surface pos and normal. It
* returns a float in [0..1] interval (zero = fully occluded).
* Higher order function returning an function to compute the Ambient Occlusion
* term / shadow factor for given SDF scene function. The returned function
* takes 2 arguments: surface pos and normal. It returns a float in `[0,1]`
* interval (zero = fully occluded).
*

@@ -8,0 +8,0 @@ * @param scene -

import type { Vec2Term, Vec4Term } from "@thi.ng/shader-ast";
/**
* Computes UV coord in [0..1] interval from given `fragCoord` and screen `res`.
* Computes UV coord in `[0,1]` interval from given `fragCoord` and screen
* `res`.
*

@@ -11,3 +12,3 @@ * @param fragCoord -

* Takes `pos`, a screen coord (e.g. gl_FragCoord) and viewport resolution
* `res`, returns aspect corrected uv, with uv.y in [-1..1] interval and uv.x
* `res`, returns aspect corrected uv, with uv.y in `[-1,1]` interval and uv.x
* scaled by the aspect ratio `resx / resy`.

@@ -21,3 +22,3 @@ *

* Returns true if at least one coordinate of the given point is within the
* `width` internal border region of UV rect ([0,0] .. [1,1]).
* `width` internal border region of UV rect (`[0,0]`..`[1,1]`).
*

@@ -24,0 +25,0 @@ * ```c

/**
* Returns signed distance from `p` to 2D circular arc with `aperture` (in
* [0..π] interval), radius `ra` and `thickness`.
* `[0,π]` interval), radius `ra` and `thickness`.
*

@@ -5,0 +5,0 @@ * @remarks

@@ -7,3 +7,3 @@ /**

* Ported from original GLSL impl by Inigo Quilez:
* - https://iquilezles.org/articles/distfunctions2d/
* https://iquilezles.org/articles/distfunctions2d/
*

@@ -10,0 +10,0 @@ * @param p - vec2

@@ -6,2 +6,3 @@ /**

* @remarks
*
* - `size` consist of overall width/size (in x) and thickness (in y component)

@@ -11,3 +12,3 @@ * - corner radius can also be negative

* Ported from original GLSL impl by Inigo Quilez:
* - https://iquilezles.org/articles/distfunctions2d/
* https://iquilezles.org/articles/distfunctions2d/
*

@@ -25,3 +26,3 @@ * @param p -

* Ported from original GLSL impl by Inigo Quilez:
* - https://iquilezles.org/articles/distfunctions2d/
* https://iquilezles.org/articles/distfunctions2d/
*

@@ -28,0 +29,0 @@ * @param p -

@@ -6,5 +6,5 @@ /**

* Ported from original GLSL impl by Inigo Quilez:
* - https://iquilezles.org/articles/distfunctions2d/
* https://iquilezles.org/articles/distfunctions2d/
*/
export declare const sdfHexagon2: import("@thi.ng/shader-ast").TaggedFn2<"vec2", "float", "float">;
//# sourceMappingURL=hex.d.ts.map

@@ -7,3 +7,3 @@ /**

* Based on original GLSL impl by Inigo Quilez:
* - https://iquilezles.org/articles/distfunctions2d/
* https://iquilezles.org/articles/distfunctions2d/
*

@@ -10,0 +10,0 @@ * @param N

@@ -27,3 +27,3 @@ import type { Func1, Func2, Vec2Term } from "@thi.ng/shader-ast";

* Min X position (in function domain). The function will only be evaluated
* within the [min..max] domain.
* within the `[min,max]` domain.
*

@@ -35,3 +35,3 @@ * @defaultValue 0

* Max X position (in function domain). The function will only be evaluated
* within the [min..max] domain.
* within the `[min,max]` domain.
*

@@ -38,0 +38,0 @@ * @defaultValue 1

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc