Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

troika-three-utils

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-three-utils - npm Package Compare versions

Comparing version 0.42.0 to 0.43.0

0

__tests__/ShaderFloatArray.test.js

@@ -0,0 +0,0 @@ import { encodeFloatToFourInts, decodeFloatFromFourInts } from '../src/ShaderFloatArray.js'

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

# [0.43.0](https://github.com/protectwise/troika/compare/v0.42.0...v0.43.0) (2021-09-20)
### Bug Fixes
* **InstancedUniformsMesh:** reuse same derived material instance when uniform names change ([bd7cea6](https://github.com/protectwise/troika/commit/bd7cea6116556f9fb4ba3e6710ed07f871739e93)), closes [#154](https://github.com/protectwise/troika/issues/154)
# [0.42.0](https://github.com/protectwise/troika/compare/v0.41.2...v0.42.0) (2021-05-17)

@@ -8,0 +20,0 @@

2

dist/troika-three-utils.esm.js

@@ -165,3 +165,3 @@ import { ShaderChunk, UniformsUtils, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, ShaderLib, Matrix4, Vector3, Mesh, CylinderBufferGeometry, Vector2, MeshStandardMaterial, DoubleSide } from 'three';

// Upgrade the shaders, caching the result by incoming source code
const cacheKey = optionsKey + '|||' + shaderInfo.vertexShader + '|||' + shaderInfo.fragmentShader;
const cacheKey = this.customProgramCacheKey() + '|' + shaderInfo.vertexShader + '|' + shaderInfo.fragmentShader;
let upgradedShaders = SHADER_UPGRADE_CACHE[cacheKey];

@@ -168,0 +168,0 @@ if (!upgradedShaders) {

@@ -11,3 +11,3 @@ (function (global, factory) {

*/
var voidMainRegExp = /\bvoid\s+main\s*\(\s*\)\s*{/g;
const voidMainRegExp = /\bvoid\s+main\s*\(\s*\)\s*{/g;

@@ -22,5 +22,5 @@ /**

function expandShaderIncludes( source ) {
var pattern = /^[ \t]*#include +<([\w\d./]+)>/gm;
const pattern = /^[ \t]*#include +<([\w\d./]+)>/gm;
function replace(match, include) {
var chunk = three.ShaderChunk[include];
let chunk = three.ShaderChunk[include];
return chunk ? expandShaderIncludes(chunk) : match

@@ -37,5 +37,5 @@ }

var _lut = [];
const _lut = [];
for (var i = 0; i < 256; i++) {
for (let i = 0; i < 256; i++) {
_lut[i] = (i < 16 ? '0' : '') + (i).toString(16);

@@ -48,7 +48,7 @@ }

var d0 = Math.random() * 0xffffffff | 0;
var d1 = Math.random() * 0xffffffff | 0;
var d2 = Math.random() * 0xffffffff | 0;
var d3 = Math.random() * 0xffffffff | 0;
var uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' +
const d0 = Math.random() * 0xffffffff | 0;
const d1 = Math.random() * 0xffffffff | 0;
const d2 = Math.random() * 0xffffffff | 0;
const d3 = Math.random() * 0xffffffff | 0;
const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' +
_lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' +

@@ -64,10 +64,8 @@ _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] +

// Local assign polyfill to avoid importing troika-core
var assign = Object.assign || function(/*target, ...sources*/) {
var arguments$1 = arguments;
var target = arguments[0];
for (var i = 1, len = arguments.length; i < len; i++) {
var source = arguments$1[i];
const assign = Object.assign || function(/*target, ...sources*/) {
let target = arguments[0];
for (let i = 1, len = arguments.length; i < len; i++) {
let source = arguments[i];
if (source) {
for (var prop in source) {
for (let prop in source) {
if (source.hasOwnProperty(prop)) {

@@ -83,9 +81,9 @@ target[prop] = source[prop];

var epoch = Date.now();
var CONSTRUCTOR_CACHE = new WeakMap();
var SHADER_UPGRADE_CACHE = new Map();
const epoch = Date.now();
const CONSTRUCTOR_CACHE = new WeakMap();
const SHADER_UPGRADE_CACHE = new Map();
// Material ids must be integers, but we can't access the increment from Three's `Material` module,
// so let's choose a sufficiently large starting value that should theoretically never collide.
var materialInstanceId = 1e10;
let materialInstanceId = 1e10;

@@ -157,7 +155,7 @@ /**

// their GL programs can be shared and cached.
var optionsKey = getKeyForOptions(options);
const optionsKey = getKeyForOptions(options);
// First check to see if we've already derived from this baseMaterial using this
// unique set of options, and if so reuse the constructor to avoid some allocations.
var ctorsByDerivation = CONSTRUCTOR_CACHE.get(baseMaterial);
let ctorsByDerivation = CONSTRUCTOR_CACHE.get(baseMaterial);
if (!ctorsByDerivation) {

@@ -170,14 +168,14 @@ CONSTRUCTOR_CACHE.set(baseMaterial, (ctorsByDerivation = Object.create(null)));

var privateBeforeCompileProp = "_onBeforeCompile" + optionsKey;
const privateBeforeCompileProp = `_onBeforeCompile${optionsKey}`;
// Private onBeforeCompile handler that injects the modified shaders and uniforms when
// the renderer switches to this material's program
var onBeforeCompile = function (shaderInfo) {
const onBeforeCompile = function (shaderInfo) {
baseMaterial.onBeforeCompile.call(this, shaderInfo);
// Upgrade the shaders, caching the result by incoming source code
var cacheKey = optionsKey + '|||' + shaderInfo.vertexShader + '|||' + shaderInfo.fragmentShader;
var upgradedShaders = SHADER_UPGRADE_CACHE[cacheKey];
const cacheKey = this.customProgramCacheKey() + '|' + shaderInfo.vertexShader + '|' + shaderInfo.fragmentShader;
let upgradedShaders = SHADER_UPGRADE_CACHE[cacheKey];
if (!upgradedShaders) {
var upgraded = upgradeShaders(shaderInfo, options, optionsKey);
const upgraded = upgradeShaders(shaderInfo, options, optionsKey);
upgradedShaders = SHADER_UPGRADE_CACHE[cacheKey] = upgraded;

@@ -204,9 +202,9 @@ }

var DerivedMaterial = function DerivedMaterial() {
const DerivedMaterial = function DerivedMaterial() {
return derive(options.chained ? baseMaterial : baseMaterial.clone())
};
var derive = function(base) {
const derive = function(base) {
// Prototype chain to the base material
var derived = Object.create(base, descriptor);
const derived = Object.create(base, descriptor);

@@ -223,3 +221,3 @@ // Store the baseMaterial for reference; this is always the original even when cloning

derived.defines = assign({}, base.defines, options.defines);
derived.defines[("TROIKA_DERIVED_MATERIAL_" + optionsKey)] = ''; //force a program change from the base material
derived.defines[`TROIKA_DERIVED_MATERIAL_${optionsKey}`] = ''; //force a program change from the base material
derived.extensions = assign({}, base.extensions, options.extensions);

@@ -233,3 +231,3 @@

var descriptor = {
const descriptor = {
constructor: {value: DerivedMaterial},

@@ -247,6 +245,6 @@ isDerivedMaterial: {value: true},

onBeforeCompile: {
get: function get() {
get() {
return onBeforeCompile
},
set: function set(fn) {
set(fn) {
this[privateBeforeCompileProp] = fn;

@@ -274,3 +272,3 @@ }

value: function () {
var newBase = new baseMaterial.constructor();
const newBase = new baseMaterial.constructor();
return derive(newBase).copy(this)

@@ -288,3 +286,3 @@ }

value: function() {
var depthMaterial = this._depthMaterial;
let depthMaterial = this._depthMaterial;
if (!depthMaterial) {

@@ -312,3 +310,3 @@ depthMaterial = this._depthMaterial = createDerivedMaterial(

value: function() {
var distanceMaterial = this._distanceMaterial;
let distanceMaterial = this._distanceMaterial;
if (!distanceMaterial) {

@@ -331,8 +329,6 @@ distanceMaterial = this._distanceMaterial = createDerivedMaterial(

configurable: true,
value: function value() {
var ref = this;
var _depthMaterial = ref._depthMaterial;
var _distanceMaterial = ref._distanceMaterial;
if (_depthMaterial) { _depthMaterial.dispose(); }
if (_distanceMaterial) { _distanceMaterial.dispose(); }
value() {
const {_depthMaterial, _distanceMaterial} = this;
if (_depthMaterial) _depthMaterial.dispose();
if (_distanceMaterial) _distanceMaterial.dispose();
baseMaterial.dispose.call(this);

@@ -348,17 +344,16 @@ }

function upgradeShaders(ref, options, key) {
var vertexShader = ref.vertexShader;
var fragmentShader = ref.fragmentShader;
function upgradeShaders({vertexShader, fragmentShader}, options, key) {
let {
vertexDefs,
vertexMainIntro,
vertexMainOutro,
vertexTransform,
fragmentDefs,
fragmentMainIntro,
fragmentMainOutro,
fragmentColorTransform,
customRewriter,
timeUniform
} = options;
var vertexDefs = options.vertexDefs;
var vertexMainIntro = options.vertexMainIntro;
var vertexMainOutro = options.vertexMainOutro;
var vertexTransform = options.vertexTransform;
var fragmentDefs = options.fragmentDefs;
var fragmentMainIntro = options.fragmentMainIntro;
var fragmentMainOutro = options.fragmentMainOutro;
var fragmentColorTransform = options.fragmentColorTransform;
var customRewriter = options.customRewriter;
var timeUniform = options.timeUniform;
vertexDefs = vertexDefs || '';

@@ -389,3 +384,3 @@ vertexMainIntro = vertexMainIntro || '';

if (customRewriter) {
var res = customRewriter({vertexShader: vertexShader, fragmentShader: fragmentShader});
let res = customRewriter({vertexShader, fragmentShader});
vertexShader = res.vertexShader;

@@ -398,6 +393,6 @@ fragmentShader = res.fragmentShader;

if (fragmentColorTransform) {
var postChunks = [];
let postChunks = [];
fragmentShader = fragmentShader.replace(
/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm, // [^]+? = non-greedy match of any chars including newlines
function (match) {
match => {
postChunks.push(match);

@@ -407,3 +402,3 @@ return ''

);
fragmentMainOutro = fragmentColorTransform + "\n" + (postChunks.join('\n')) + "\n" + fragmentMainOutro;
fragmentMainOutro = `${fragmentColorTransform}\n${postChunks.join('\n')}\n${fragmentMainOutro}`;
}

@@ -413,3 +408,3 @@

if (timeUniform) {
var code = "\nuniform float " + timeUniform + ";\n";
const code = `\nuniform float ${timeUniform};\n`;
vertexDefs = code + vertexDefs;

@@ -422,7 +417,21 @@ fragmentDefs = code + fragmentDefs;

// Hoist these defs to the very top so they work in other function defs
vertexShader = "vec3 troika_position_" + key + ";\nvec3 troika_normal_" + key + ";\nvec2 troika_uv_" + key + ";\n" + vertexShader + "\n";
vertexDefs = vertexDefs + "\nvoid troikaVertexTransform" + key + "(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n " + vertexTransform + "\n}\n";
vertexMainIntro = "\ntroika_position_" + key + " = vec3(position);\ntroika_normal_" + key + " = vec3(normal);\ntroika_uv_" + key + " = vec2(uv);\ntroikaVertexTransform" + key + "(troika_position_" + key + ", troika_normal_" + key + ", troika_uv_" + key + ");\n" + vertexMainIntro + "\n";
vertexShader = vertexShader.replace(/\b(position|normal|uv)\b/g, function (match, match1, index, fullStr) {
return /\battribute\s+vec[23]\s+$/.test(fullStr.substr(0, index)) ? match1 : ("troika_" + match1 + "_" + key)
vertexShader = `vec3 troika_position_${key};
vec3 troika_normal_${key};
vec2 troika_uv_${key};
${vertexShader}
`;
vertexDefs = `${vertexDefs}
void troikaVertexTransform${key}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
${vertexTransform}
}
`;
vertexMainIntro = `
troika_position_${key} = vec3(position);
troika_normal_${key} = vec3(normal);
troika_uv_${key} = vec2(uv);
troikaVertexTransform${key}(troika_position_${key}, troika_normal_${key}, troika_uv_${key});
${vertexMainIntro}
`;
vertexShader = vertexShader.replace(/\b(position|normal|uv)\b/g, (match, match1, index, fullStr) => {
return /\battribute\s+vec[23]\s+$/.test(fullStr.substr(0, index)) ? match1 : `troika_${match1}_${key}`
});

@@ -436,4 +445,4 @@ }

return {
vertexShader: vertexShader,
fragmentShader: fragmentShader
vertexShader,
fragmentShader
}

@@ -444,5 +453,12 @@ }

if (intro || outro || defs) {
shaderCode = shaderCode.replace(voidMainRegExp, ("\n" + defs + "\nvoid troikaOrigMain" + id + "() {")
shaderCode = shaderCode.replace(voidMainRegExp, `
${defs}
void troikaOrigMain${id}() {`
);
shaderCode += "\nvoid main() {\n " + intro + "\n troikaOrigMain" + id + "();\n " + outro + "\n}";
shaderCode += `
void main() {
${intro}
troikaOrigMain${id}();
${outro}
}`;
}

@@ -457,7 +473,7 @@ return shaderCode

var _idCtr = 0;
var optionsHashesToIds = new Map();
let _idCtr = 0;
const optionsHashesToIds = new Map();
function getKeyForOptions(options) {
var optionsHash = JSON.stringify(options, optionsJsonReplacer);
var id = optionsHashesToIds.get(optionsHash);
const optionsHash = JSON.stringify(options, optionsJsonReplacer);
let id = optionsHashesToIds.get(optionsHash);
if (id == null) {

@@ -471,3 +487,3 @@ optionsHashesToIds.set(optionsHash, (id = ++_idCtr));

// TODO how can we keep this from getting stale?
var MATERIAL_TYPES_TO_SHADERS = {
const MATERIAL_TYPES_TO_SHADERS = {
MeshDepthMaterial: 'depth',

@@ -498,3 +514,3 @@ MeshDistanceMaterial: 'distanceRGBA',

function getShadersForMaterial(material) {
var builtinType = MATERIAL_TYPES_TO_SHADERS[material.type];
let builtinType = MATERIAL_TYPES_TO_SHADERS[material.type];
return builtinType ? three.ShaderLib[builtinType] : material //TODO fallback for unknown type?

@@ -510,5 +526,5 @@ }

function getShaderUniformTypes(shader) {
var uniformRE = /\buniform\s+(int|float|vec[234])\s+([A-Za-z_][\w]*)/g;
var uniforms = Object.create(null);
var match;
let uniformRE = /\buniform\s+(int|float|vec[234])\s+([A-Za-z_][\w]*)/g;
let uniforms = Object.create(null);
let match;
while ((match = uniformRE.exec(shader)) !== null) {

@@ -526,5 +542,3 @@ uniforms[match[2]] = match[1];

*/
function invertMatrix4(srcMatrix, tgtMatrix) {
if ( tgtMatrix === void 0 ) tgtMatrix = new three.Matrix4();
function invertMatrix4(srcMatrix, tgtMatrix = new three.Matrix4()) {
if (typeof tgtMatrix.invert === 'function') {

@@ -543,10 +557,70 @@ tgtMatrix.copy(srcMatrix).invert();

var vertexDefs = "\nuniform vec3 pointA;\nuniform vec3 controlA;\nuniform vec3 controlB;\nuniform vec3 pointB;\nuniform float radius;\nvarying float bezierT;\n\nvec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n float b0 = t2 * t2 * t2;\n float b1 = 3.0 * t * t2 * t2;\n float b2 = 3.0 * t * t * t2;\n float b3 = t * t * t;\n return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2;\n}\n\nvec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n return -3.0 * p1 * t2 * t2 +\n c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) +\n c2 * (6.0 * t2 * t - 3.0 * t * t) +\n 3.0 * p2 * t * t;\n}\n";
const vertexDefs = `
uniform vec3 pointA;
uniform vec3 controlA;
uniform vec3 controlB;
uniform vec3 pointB;
uniform float radius;
varying float bezierT;
var vertexTransform = "\nfloat t = position.y;\nbezierT = t;\nvec3 bezierCenterPos = cubicBezier(pointA, controlA, controlB, pointB, t);\nvec3 bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t));\n\n// Make \"sideways\" always perpendicular to the camera ray; this ensures that any twists\n// in the cylinder occur where you won't see them: \nvec3 viewDirection = normalMatrix * vec3(0.0, 0.0, 1.0);\nif (bezierDir == viewDirection) {\n bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t == 1.0 ? t - 0.0001 : t + 0.0001));\n}\nvec3 sideways = normalize(cross(bezierDir, viewDirection));\nvec3 upish = normalize(cross(sideways, bezierDir));\n\n// Build a matrix for transforming this disc in the cylinder:\nmat4 discTx;\ndiscTx[0].xyz = sideways * radius;\ndiscTx[1].xyz = bezierDir * radius;\ndiscTx[2].xyz = upish * radius;\ndiscTx[3].xyz = bezierCenterPos;\ndiscTx[3][3] = 1.0;\n\n// Apply transform, ignoring original y\nposition = (discTx * vec4(position.x, 0.0, position.z, 1.0)).xyz;\nnormal = normalize(mat3(discTx) * normal);\n";
vec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {
float t2 = 1.0 - t;
float b0 = t2 * t2 * t2;
float b1 = 3.0 * t * t2 * t2;
float b2 = 3.0 * t * t * t2;
float b3 = t * t * t;
return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2;
}
var fragmentDefs = "\nuniform vec3 dashing;\nvarying float bezierT;\n";
vec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {
float t2 = 1.0 - t;
return -3.0 * p1 * t2 * t2 +
c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) +
c2 * (6.0 * t2 * t - 3.0 * t * t) +
3.0 * p2 * t * t;
}
`;
var fragmentMainIntro = "\nif (dashing.x + dashing.y > 0.0) {\n float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y);\n if (dashFrac > dashing.x) {\n discard;\n }\n}\n";
const vertexTransform = `
float t = position.y;
bezierT = t;
vec3 bezierCenterPos = cubicBezier(pointA, controlA, controlB, pointB, t);
vec3 bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t));
// Make "sideways" always perpendicular to the camera ray; this ensures that any twists
// in the cylinder occur where you won't see them:
vec3 viewDirection = normalMatrix * vec3(0.0, 0.0, 1.0);
if (bezierDir == viewDirection) {
bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t == 1.0 ? t - 0.0001 : t + 0.0001));
}
vec3 sideways = normalize(cross(bezierDir, viewDirection));
vec3 upish = normalize(cross(sideways, bezierDir));
// Build a matrix for transforming this disc in the cylinder:
mat4 discTx;
discTx[0].xyz = sideways * radius;
discTx[1].xyz = bezierDir * radius;
discTx[2].xyz = upish * radius;
discTx[3].xyz = bezierCenterPos;
discTx[3][3] = 1.0;
// Apply transform, ignoring original y
position = (discTx * vec4(position.x, 0.0, position.z, 1.0)).xyz;
normal = normalize(mat3(discTx) * normal);
`;
const fragmentDefs = `
uniform vec3 dashing;
varying float bezierT;
`;
const fragmentMainIntro = `
if (dashing.x + dashing.y > 0.0) {
float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y);
if (dashFrac > dashing.x) {
discard;
}
}
`;
// Debugging: separate color for each of the 6 sides:

@@ -579,6 +653,6 @@ // const fragmentColorTransform = `

},
vertexDefs: vertexDefs,
vertexTransform: vertexTransform,
fragmentDefs: fragmentDefs,
fragmentMainIntro: fragmentMainIntro
vertexDefs,
vertexTransform,
fragmentDefs,
fragmentMainIntro
}

@@ -588,5 +662,5 @@ )

var geometry = null;
let geometry = null;
var defaultBaseMaterial = /*#__PURE__*/new three.MeshStandardMaterial({color: 0xffffff, side: three.DoubleSide});
const defaultBaseMaterial = /*#__PURE__*/new three.MeshStandardMaterial({color: 0xffffff, side: three.DoubleSide});

@@ -621,6 +695,12 @@

*/
var BezierMesh = /*@__PURE__*/(function (Mesh) {
function BezierMesh() {
Mesh.call(
this, BezierMesh.getGeometry(),
class BezierMesh extends three.Mesh {
static getGeometry() {
return geometry || (geometry =
new three.CylinderBufferGeometry(1, 1, 1, 6, 64).translate(0, 0.5, 0)
)
}
constructor() {
super(
BezierMesh.getGeometry(),
defaultBaseMaterial

@@ -642,19 +722,7 @@ );

if ( Mesh ) BezierMesh.__proto__ = Mesh;
BezierMesh.prototype = Object.create( Mesh && Mesh.prototype );
BezierMesh.prototype.constructor = BezierMesh;
var prototypeAccessors = { material: { configurable: true },customDepthMaterial: { configurable: true },customDistanceMaterial: { configurable: true } };
// Handler for automatically wrapping the base material with our upgrades. We do the wrapping
// lazily on _read_ rather than write to avoid unnecessary wrapping on transient values.
BezierMesh.getGeometry = function getGeometry () {
return geometry || (geometry =
new three.CylinderBufferGeometry(1, 1, 1, 6, 64).translate(0, 0.5, 0)
)
};
prototypeAccessors.material.get = function () {
var derivedMaterial = this._derivedMaterial;
var baseMaterial = this._baseMaterial || this._defaultMaterial || (this._defaultMaterial = defaultBaseMaterial.clone());
get material() {
let derivedMaterial = this._derivedMaterial;
const baseMaterial = this._baseMaterial || this._defaultMaterial || (this._defaultMaterial = defaultBaseMaterial.clone());
if (!derivedMaterial || derivedMaterial.baseMaterial !== baseMaterial) {

@@ -669,26 +737,18 @@ derivedMaterial = this._derivedMaterial = createBezierMeshMaterial(baseMaterial);

return derivedMaterial
};
prototypeAccessors.material.set = function (baseMaterial) {
}
set material(baseMaterial) {
this._baseMaterial = baseMaterial;
};
}
// Create and update material for shadows upon request:
prototypeAccessors.customDepthMaterial.get = function () {
get customDepthMaterial() {
return this.material.getDepthMaterial()
};
prototypeAccessors.customDistanceMaterial.get = function () {
}
get customDistanceMaterial() {
return this.material.getDistanceMaterial()
};
}
BezierMesh.prototype.onBeforeRender = function onBeforeRender (shaderInfo) {
var ref = this.material;
var uniforms = ref.uniforms;
var ref$1 = this;
var pointA = ref$1.pointA;
var controlA = ref$1.controlA;
var controlB = ref$1.controlB;
var pointB = ref$1.pointB;
var radius = ref$1.radius;
var dashArray = ref$1.dashArray;
var dashOffset = ref$1.dashOffset;
onBeforeRender(shaderInfo) {
const {uniforms} = this.material;
const {pointA, controlA, controlB, pointB, radius, dashArray, dashOffset} = this;
uniforms.pointA.value.copy(pointA);

@@ -700,13 +760,9 @@ uniforms.controlA.value.copy(controlA);

uniforms.dashing.value.set(dashArray.x, dashArray.y, dashOffset || 0);
};
}
BezierMesh.prototype.raycast = function raycast (raycaster, intersects) {
raycast(raycaster, intersects) {
// TODO - just fail for now
};
}
}
Object.defineProperties( BezierMesh.prototype, prototypeAccessors );
return BezierMesh;
}(three.Mesh));
exports.BezierMesh = BezierMesh;

@@ -713,0 +769,0 @@ exports.createDerivedMaterial = createDerivedMaterial;

@@ -1,17 +0,36 @@

'use strict';(function(f,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports,require("three")):"function"===typeof define&&define.amd?define(["exports","three"],c):(f="undefined"!==typeof globalThis?globalThis:f||self,c(f.troika_three_utils={},f.THREE))})(this,function(f,c){function t(b){return b.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(a,b){return(b=c.ShaderChunk[b])?t(b):a})}function n(b,a){var g=C(a),d=q.get(b);d||q.set(b,d=Object.create(null));if(d[g])return new d[g];
var e="_onBeforeCompile"+g,f=function(h){b.onBeforeCompile.call(this,h);var d=g+"|||"+h.vertexShader+"|||"+h.fragmentShader,c=v[d];c||(c=D(h,a,g),c=v[d]=c);h.vertexShader=c.vertexShader;h.fragmentShader=c.fragmentShader;m(h.uniforms,this.uniforms);a.timeUniform&&(h.uniforms[a.timeUniform]={get value(){return Date.now()-E}});if(this[e])this[e](h)},r=function(){return w(a.chained?b:b.clone())},w=function(d){var h=Object.create(d,p);Object.defineProperty(h,"baseMaterial",{value:b});Object.defineProperty(h,
"id",{value:F++});var e=4294967295*Math.random()|0;var c=4294967295*Math.random()|0,f=4294967295*Math.random()|0,u=4294967295*Math.random()|0;e=(k[e&255]+k[e>>8&255]+k[e>>16&255]+k[e>>24&255]+"-"+k[c&255]+k[c>>8&255]+"-"+k[c>>16&15|64]+k[c>>24&255]+"-"+k[f&63|128]+k[f>>8&255]+"-"+k[f>>16&255]+k[f>>24&255]+k[u&255]+k[u>>8&255]+k[u>>16&255]+k[u>>24&255]).toUpperCase();h.uuid=e;h.uniforms=m({},d.uniforms,a.uniforms);h.defines=m({},d.defines,a.defines);h.defines["TROIKA_DERIVED_MATERIAL_"+g]="";h.extensions=
m({},d.extensions,a.extensions);h._listeners=void 0;return h},p={constructor:{value:r},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return g}},onBeforeCompile:{get:function(){return f},set:function(a){this[e]=a}},copy:{writable:!0,configurable:!0,value:function(a){b.copy.call(this,a);b.isShaderMaterial||b.isDerivedMaterial||(m(this.extensions,a.extensions),m(this.defines,a.defines),m(this.uniforms,c.UniformsUtils.clone(a.uniforms)));return this}},
clone:{writable:!0,configurable:!0,value:function(){var a=new b.constructor;return w(a).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){var d=this._depthMaterial;d||(d=this._depthMaterial=n(b.isDerivedMaterial?b.getDepthMaterial():new c.MeshDepthMaterial({depthPacking:c.RGBADepthPacking}),a),d.defines.IS_DEPTH_MATERIAL="",d.uniforms=this.uniforms);return d}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){var d=this._distanceMaterial;d||(d=this._distanceMaterial=
n(b.isDerivedMaterial?b.getDistanceMaterial():new c.MeshDistanceMaterial,a),d.defines.IS_DISTANCE_MATERIAL="",d.uniforms=this.uniforms);return d}},dispose:{writable:!0,configurable:!0,value:function(){var a=this._depthMaterial,d=this._distanceMaterial;a&&a.dispose();d&&d.dispose();b.dispose.call(this)}}};d[g]=r;return new r}function D(b,a,g){var d=b.vertexShader,e=b.fragmentShader;b=a.vertexDefs;var c=a.vertexMainIntro,f=a.vertexMainOutro,k=a.vertexTransform,p=a.fragmentDefs,h=a.fragmentMainIntro,
m=a.fragmentMainOutro,l=a.fragmentColorTransform,n=a.customRewriter;a=a.timeUniform;b=b||"";c=c||"";f=f||"";p=p||"";h=h||"";m=m||"";if(k||n)d=t(d);if(l||n)e=e.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"),e=t(e);n&&(e=n({vertexShader:d,fragmentShader:e}),d=e.vertexShader,e=e.fragmentShader);if(l){var q=[];e=e.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,function(a){q.push(a);
return""});m=l+"\n"+q.join("\n")+"\n"+m}a&&(l="\nuniform float "+a+";\n",b=l+b,p=l+p);k&&(b=b+"\nvoid troikaVertexTransform"+g+"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n "+k+"\n}\n",c="\ntroika_position_"+g+" = vec3(position);\ntroika_normal_"+g+" = vec3(normal);\ntroika_uv_"+g+" = vec2(uv);\ntroikaVertexTransform"+g+"(troika_position_"+g+", troika_normal_"+g+", troika_uv_"+g+");\n"+c+"\n",d=("vec3 troika_position_"+g+";\nvec3 troika_normal_"+g+";\nvec2 troika_uv_"+g+";\n"+d+"\n").replace(/\b(position|normal|uv)\b/g,
function(a,d,b,c){return/\battribute\s+vec[23]\s+$/.test(c.substr(0,b))?d:"troika_"+d+"_"+g}));d=x(d,g,b,c,f);e=x(e,g,p,h,m);return{vertexShader:d,fragmentShader:e}}function x(b,a,c,d,e){if(d||e||c)b=b.replace(y,"\n"+c+"\nvoid troikaOrigMain"+a+"() {"),b+="\nvoid main() {\n "+d+"\n troikaOrigMain"+a+"();\n "+e+"\n}";return b}function G(b,a){return"uniforms"===b?void 0:"function"===typeof a?a.toString():a}function C(b){b=JSON.stringify(b,G);var a=z.get(b);null==a&&z.set(b,a=++H);return a}for(var y=
/\bvoid\s+main\s*\(\s*\)\s*{/g,k=[],l=0;256>l;l++)k[l]=(16>l?"0":"")+l.toString(16);var m=Object.assign||function(){for(var b=arguments,a=arguments[0],c=1,d=arguments.length;c<d;c++){var e=b[c];if(e)for(var f in e)e.hasOwnProperty(f)&&(a[f]=e[f])}return a},E=Date.now(),q=new WeakMap,v=new Map,F=1E10,H=0,z=new Map,I={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",
MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},A=null,B=new c.MeshStandardMaterial({color:16777215,side:c.DoubleSide});l=function(b){function a(){b.call(this,a.getGeometry(),B);this.pointA=new c.Vector3;this.controlA=new c.Vector3;this.controlB=new c.Vector3;this.pointB=new c.Vector3;this.radius=.01;this.dashArray=new c.Vector2;
this.dashOffset=0;this.frustumCulled=!1}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var g={material:{configurable:!0},customDepthMaterial:{configurable:!0},customDistanceMaterial:{configurable:!0}};a.getGeometry=function(){return A||(A=(new c.CylinderBufferGeometry(1,1,1,6,64)).translate(0,.5,0))};g.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=B.clone());a&&a.baseMaterial===b||(a=
this._derivedMaterial=n(b,{chained:!0,uniforms:{pointA:{value:new c.Vector3},controlA:{value:new c.Vector3},controlB:{value:new c.Vector3},pointB:{value:new c.Vector3},radius:{value:.01},dashing:{value:new c.Vector3}},vertexDefs:"\nuniform vec3 pointA;\nuniform vec3 controlA;\nuniform vec3 controlB;\nuniform vec3 pointB;\nuniform float radius;\nvarying float bezierT;\n\nvec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n float b0 = t2 * t2 * t2;\n float b1 = 3.0 * t * t2 * t2;\n float b2 = 3.0 * t * t * t2;\n float b3 = t * t * t;\n return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2;\n}\n\nvec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n return -3.0 * p1 * t2 * t2 +\n c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) +\n c2 * (6.0 * t2 * t - 3.0 * t * t) +\n 3.0 * p2 * t * t;\n}\n",
'use strict';(function(f,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports,require("three")):"function"===typeof define&&define.amd?define(["exports","three"],d):(f="undefined"!==typeof globalThis?globalThis:f||self,d(f.troika_three_utils={},f.THREE))})(this,function(f,d){function q(a){return a.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(a,g){return(g=d.ShaderChunk[g])?q(g):a})}function l(a,b){let g=C(b),c=n.get(a);c||n.set(a,c=Object.create(null));if(c[g])return new c[g];
let t=`_onBeforeCompile${g}`,f=function(h){a.onBeforeCompile.call(this,h);const c=this.customProgramCacheKey()+"|"+h.vertexShader+"|"+h.fragmentShader;var d=v[c];d||(d=D(h,b,g),d=v[c]=d);h.vertexShader=d.vertexShader;h.fragmentShader=d.fragmentShader;k(h.uniforms,this.uniforms);b.timeUniform&&(h.uniforms[b.timeUniform]={get value(){return Date.now()-E}});if(this[t])this[t](h)},u=function(){return m(b.chained?a:a.clone())},m=function(h){const c=Object.create(h,F);Object.defineProperty(c,"baseMaterial",
{value:a});Object.defineProperty(c,"id",{value:G++});{var d=4294967295*Math.random()|0;let a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0;d=(e[d&255]+e[d>>8&255]+e[d>>16&255]+e[d>>24&255]+"-"+e[a&255]+e[a>>8&255]+"-"+e[a>>16&15|64]+e[a>>24&255]+"-"+e[b&63|128]+e[b>>8&255]+"-"+e[b>>16&255]+e[b>>24&255]+e[c&255]+e[c>>8&255]+e[c>>16&255]+e[c>>24&255]).toUpperCase()}c.uuid=d;c.uniforms=k({},h.uniforms,b.uniforms);c.defines=k({},h.defines,b.defines);c.defines[`TROIKA_DERIVED_MATERIAL_${g}`]=
"";c.extensions=k({},h.extensions,b.extensions);c._listeners=void 0;return c},F={constructor:{value:u},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return g}},onBeforeCompile:{get(){return f},set(a){this[t]=a}},copy:{writable:!0,configurable:!0,value:function(b){a.copy.call(this,b);a.isShaderMaterial||a.isDerivedMaterial||(k(this.extensions,b.extensions),k(this.defines,b.defines),k(this.uniforms,d.UniformsUtils.clone(b.uniforms)));return this}},
clone:{writable:!0,configurable:!0,value:function(){const b=new a.constructor;return m(b).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;c||(c=this._depthMaterial=l(a.isDerivedMaterial?a.getDepthMaterial():new d.MeshDepthMaterial({depthPacking:d.RGBADepthPacking}),b),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms);return c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;c||(c=this._distanceMaterial=
l(a.isDerivedMaterial?a.getDistanceMaterial():new d.MeshDistanceMaterial,b),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms);return c}},dispose:{writable:!0,configurable:!0,value(){const {_depthMaterial:b,_distanceMaterial:c}=this;b&&b.dispose();c&&c.dispose();a.dispose.call(this)}}};c[g]=u;return new u}function D({vertexShader:a,fragmentShader:b},d,c){let {vertexDefs:g,vertexMainIntro:e,vertexMainOutro:f,vertexTransform:m,fragmentDefs:k,fragmentMainIntro:h,fragmentMainOutro:p,fragmentColorTransform:l,
customRewriter:r,timeUniform:n}=d;g=g||"";e=e||"";f=f||"";k=k||"";h=h||"";p=p||"";if(m||r)a=q(a);if(l||r)b=b.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"),b=q(b);r&&(b=r({vertexShader:a,fragmentShader:b}),a=b.vertexShader,b=b.fragmentShader);if(l){let a=[];b=b.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,b=>{a.push(b);return""});p=`${l}\n${a.join("\n")}\n${p}`}n&&(d=`\nuniform float ${n};\n`,
g=d+g,k=d+k);m&&(g=`${g}
void troikaVertexTransform${c}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
${m}
}
`,e=`
troika_position_${c} = vec3(position);
troika_normal_${c} = vec3(normal);
troika_uv_${c} = vec2(uv);
troikaVertexTransform${c}(troika_position_${c}, troika_normal_${c}, troika_uv_${c});
${e}
`,a=`vec3 troika_position_${c};
vec3 troika_normal_${c};
vec2 troika_uv_${c};
${a}
`.replace(/\b(position|normal|uv)\b/g,(a,b,d,g)=>/\battribute\s+vec[23]\s+$/.test(g.substr(0,d))?b:`troika_${b}_${c}`));a=w(a,c,g,e,f);b=w(b,c,k,h,p);return{vertexShader:a,fragmentShader:b}}function w(a,b,d,c,e){if(c||e||d)a=a.replace(x,`
${d}
void troikaOrigMain${b}() {`),a+=`
void main() {
${c}
troikaOrigMain${b}();
${e}
}`;return a}function H(a,b){return"uniforms"===a?void 0:"function"===typeof b?b.toString():b}function C(a){a=JSON.stringify(a,H);let b=y.get(a);null==b&&y.set(a,b=++I);return b}let x=/\bvoid\s+main\s*\(\s*\)\s*{/g,e=[];for(let a=0;256>a;a++)e[a]=(16>a?"0":"")+a.toString(16);let k=Object.assign||function(){let a=arguments[0];for(let b=1,d=arguments.length;b<d;b++){let c=arguments[b];if(c)for(let b in c)c.hasOwnProperty(b)&&(a[b]=c[b])}return a},E=Date.now(),n=new WeakMap,v=new Map,G=1E10,I=0,y=new Map,
J={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},z=null,A=new d.MeshStandardMaterial({color:16777215,side:d.DoubleSide});class B extends d.Mesh{static getGeometry(){return z||
(z=(new d.CylinderBufferGeometry(1,1,1,6,64)).translate(0,.5,0))}constructor(){super(B.getGeometry(),A);this.pointA=new d.Vector3;this.controlA=new d.Vector3;this.controlB=new d.Vector3;this.pointB=new d.Vector3;this.radius=.01;this.dashArray=new d.Vector2;this.dashOffset=0;this.frustumCulled=!1}get material(){let a=this._derivedMaterial,b=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=A.clone());a&&a.baseMaterial===b||(a=this._derivedMaterial=l(b,{chained:!0,uniforms:{pointA:{value:new d.Vector3},
controlA:{value:new d.Vector3},controlB:{value:new d.Vector3},pointB:{value:new d.Vector3},radius:{value:.01},dashing:{value:new d.Vector3}},vertexDefs:"\nuniform vec3 pointA;\nuniform vec3 controlA;\nuniform vec3 controlB;\nuniform vec3 pointB;\nuniform float radius;\nvarying float bezierT;\n\nvec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n float b0 = t2 * t2 * t2;\n float b1 = 3.0 * t * t2 * t2;\n float b2 = 3.0 * t * t * t2;\n float b3 = t * t * t;\n return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2;\n}\n\nvec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) {\n float t2 = 1.0 - t;\n return -3.0 * p1 * t2 * t2 +\n c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) +\n c2 * (6.0 * t2 * t - 3.0 * t * t) +\n 3.0 * p2 * t * t;\n}\n",
vertexTransform:'\nfloat t = position.y;\nbezierT = t;\nvec3 bezierCenterPos = cubicBezier(pointA, controlA, controlB, pointB, t);\nvec3 bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t));\n\n// Make "sideways" always perpendicular to the camera ray; this ensures that any twists\n// in the cylinder occur where you won\'t see them: \nvec3 viewDirection = normalMatrix * vec3(0.0, 0.0, 1.0);\nif (bezierDir == viewDirection) {\n bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t == 1.0 ? t - 0.0001 : t + 0.0001));\n}\nvec3 sideways = normalize(cross(bezierDir, viewDirection));\nvec3 upish = normalize(cross(sideways, bezierDir));\n\n// Build a matrix for transforming this disc in the cylinder:\nmat4 discTx;\ndiscTx[0].xyz = sideways * radius;\ndiscTx[1].xyz = bezierDir * radius;\ndiscTx[2].xyz = upish * radius;\ndiscTx[3].xyz = bezierCenterPos;\ndiscTx[3][3] = 1.0;\n\n// Apply transform, ignoring original y\nposition = (discTx * vec4(position.x, 0.0, position.z, 1.0)).xyz;\nnormal = normalize(mat3(discTx) * normal);\n',
fragmentDefs:"\nuniform vec3 dashing;\nvarying float bezierT;\n",fragmentMainIntro:"\nif (dashing.x + dashing.y > 0.0) {\n float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y);\n if (dashFrac > dashing.x) {\n discard;\n }\n}\n"}),b.addEventListener("dispose",function r(){b.removeEventListener("dispose",r);a.dispose()}));return a};g.material.set=function(a){this._baseMaterial=a};g.customDepthMaterial.get=function(){return this.material.getDepthMaterial()};g.customDistanceMaterial.get=
function(){return this.material.getDistanceMaterial()};a.prototype.onBeforeRender=function(a){a=this.material.uniforms;var b=this.controlA,c=this.controlB,d=this.pointB,g=this.radius,f=this.dashArray,h=this.dashOffset;a.pointA.value.copy(this.pointA);a.controlA.value.copy(b);a.controlB.value.copy(c);a.pointB.value.copy(d);a.radius.value=g;a.dashing.value.set(f.x,f.y,h||0)};a.prototype.raycast=function(a,b){};Object.defineProperties(a.prototype,g);return a}(c.Mesh);f.BezierMesh=l;f.createDerivedMaterial=
n;f.expandShaderIncludes=t;f.getShaderUniformTypes=function(b){for(var a=/\buniform\s+(int|float|vec[234])\s+([A-Za-z_][\w]*)/g,c=Object.create(null),d;null!==(d=a.exec(b));)c[d[2]]=d[1];return c};f.getShadersForMaterial=function(b){var a=I[b.type];return a?c.ShaderLib[a]:b};f.invertMatrix4=function(b,a){void 0===a&&(a=new c.Matrix4);"function"===typeof a.invert?a.copy(b).invert():a.getInverse(b);return a};f.voidMainRegExp=y;Object.defineProperty(f,"__esModule",{value:!0})})
fragmentDefs:"\nuniform vec3 dashing;\nvarying float bezierT;\n",fragmentMainIntro:"\nif (dashing.x + dashing.y > 0.0) {\n float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y);\n if (dashFrac > dashing.x) {\n discard;\n }\n}\n"}),b.addEventListener("dispose",function c(){b.removeEventListener("dispose",c);a.dispose()}));return a}set material(a){this._baseMaterial=a}get customDepthMaterial(){return this.material.getDepthMaterial()}get customDistanceMaterial(){return this.material.getDistanceMaterial()}onBeforeRender(a){({uniforms:a}=
this.material);let {pointA:b,controlA:d,controlB:c,pointB:e,radius:f,dashArray:k,dashOffset:l}=this;a.pointA.value.copy(b);a.controlA.value.copy(d);a.controlB.value.copy(c);a.pointB.value.copy(e);a.radius.value=f;a.dashing.value.set(k.x,k.y,l||0)}raycast(a,b){}}f.BezierMesh=B;f.createDerivedMaterial=l;f.expandShaderIncludes=q;f.getShaderUniformTypes=function(a){let b=/\buniform\s+(int|float|vec[234])\s+([A-Za-z_][\w]*)/g,d=Object.create(null),c;for(;null!==(c=b.exec(a));)d[c[2]]=c[1];return d};f.getShadersForMaterial=
function(a){let b=J[a.type];return b?d.ShaderLib[b]:a};f.invertMatrix4=function(a,b=new d.Matrix4){"function"===typeof b.invert?b.copy(a).invert():b.getInverse(a);return b};f.voidMainRegExp=x;Object.defineProperty(f,"__esModule",{value:!0})})

@@ -0,0 +0,0 @@ # BezierMesh

@@ -0,0 +0,0 @@ # Three.js Derived Materials

{
"name": "troika-three-utils",
"version": "0.42.0",
"version": "0.43.0",
"description": "Various utilities related to Three.js",

@@ -19,3 +19,3 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>",

},
"gitHead": "0f7129cd43fc58f5c6a5f6f20f2d0941f9f36510"
"gitHead": "497fa534d015bc8f746c7d00ec7bfde1df92f491"
}

@@ -0,0 +0,0 @@ # Troika Three.js Utilities

@@ -0,0 +0,0 @@ import { CylinderBufferGeometry, DoubleSide, Mesh, MeshStandardMaterial, Vector2, Vector3 } from 'three'

@@ -0,0 +0,0 @@ import { createDerivedMaterial } from './DerivedMaterial.js'

@@ -116,3 +116,3 @@ import { voidMainRegExp } from './voidMainRegExp.js'

// Upgrade the shaders, caching the result by incoming source code
const cacheKey = optionsKey + '|||' + shaderInfo.vertexShader + '|||' + shaderInfo.fragmentShader
const cacheKey = this.customProgramCacheKey() + '|' + shaderInfo.vertexShader + '|' + shaderInfo.fragmentShader
let upgradedShaders = SHADER_UPGRADE_CACHE[cacheKey]

@@ -119,0 +119,0 @@ if (!upgradedShaders) {

@@ -0,0 +0,0 @@ import { ShaderChunk } from 'three'

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

@@ -0,0 +0,0 @@ import { ShaderLib } from 'three'

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

@@ -0,0 +0,0 @@ // Troika Three.js Utilities exports

@@ -0,0 +0,0 @@ import { Matrix4 } from 'three'

@@ -0,0 +0,0 @@ import {

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

Sorry, the diff of this file is not supported yet

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