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.15.6 to 0.15.7

4

dist/troika-three-utils.esm.js

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

if (!baseMaterial.isShaderMaterial && !baseMaterial.isDerivedMaterial) {
this.extensions = source.extensions;
this.extensions = assign({}, source.extensions);
this.defines = assign({}, source.defines);

@@ -272,3 +272,3 @@ this.uniforms = UniformsUtils.clone(source.uniforms);

vertexShader = vertexShader.replace(/\b(position|normal|uv)\b/g, function (match, match1, index, fullStr) {
return /\battribute\s+vec3\s+$/.test(fullStr.substr(0, index)) ? match1 : ("troika_" + match1 + "_" + id)
return /\battribute\s+vec[23]\s+$/.test(fullStr.substr(0, index)) ? match1 : ("troika_" + match1 + "_" + id)
});

@@ -275,0 +275,0 @@ vertexMainIntro = "\nvec3 troika_position_" + id + " = vec3(position);\nvec3 troika_normal_" + id + " = vec3(normal);\nvec2 troika_uv_" + id + " = vec2(uv);\ntroikaVertexTransform" + id + "(troika_position_" + id + ", troika_normal_" + id + ", troika_uv_" + id + ");\n" + (vertexMainIntro || '') + "\n";

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

if (!baseMaterial.isShaderMaterial && !baseMaterial.isDerivedMaterial) {
this.extensions = source.extensions;
this.extensions = assign({}, source.extensions);
this.defines = assign({}, source.defines);

@@ -276,3 +276,3 @@ this.uniforms = three.UniformsUtils.clone(source.uniforms);

vertexShader = vertexShader.replace(/\b(position|normal|uv)\b/g, function (match, match1, index, fullStr) {
return /\battribute\s+vec3\s+$/.test(fullStr.substr(0, index)) ? match1 : ("troika_" + match1 + "_" + id)
return /\battribute\s+vec[23]\s+$/.test(fullStr.substr(0, index)) ? match1 : ("troika_" + match1 + "_" + id)
});

@@ -279,0 +279,0 @@ vertexMainIntro = "\nvec3 troika_position_" + id + " = vec3(position);\nvec3 troika_normal_" + id + " = vec3(normal);\nvec2 troika_uv_" + id + " = vec2(uv);\ntroikaVertexTransform" + id + "(troika_position_" + id + ", troika_normal_" + id + ", troika_uv_" + id + ");\n" + (vertexMainIntro || '') + "\n";

'use strict';(function(h,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports,require("three")):"function"===typeof define&&define.amd?define(["exports","three"],d):(h=h||self,d(h.troika_three_utils={},h.THREE))})(this,function(h,d){function r(a){return a.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(a,c){return(c=d.ShaderChunk[c])?r(c):a})}function t(a,b){function c(c){a.onBeforeCompile.call(this,c);var e=this[h]||(this[h]={vertex:{},fragment:{}}),f=e.vertex;e=e.fragment;if(f.source!==
c.vertexShader||e.source!==c.fragmentShader){var d=A(c,b,n);f.source=c.vertexShader;f.result=d.vertexShader;e.source=c.fragmentShader;e.result=d.fragmentShader}c.vertexShader=f.result;c.fragmentShader=e.result;k(c.uniforms,this.uniforms);b.timeUniform&&(c.uniforms[b.timeUniform]={get value(){return Date.now()-B}});if(this[g])this[g](c)}function e(){a.constructor.apply(this,arguments);this._listeners=void 0}var f=JSON.stringify(b,C),p=w.get(a);p||(p=Object.create(null),w.set(a,p));if(p[f])return p[f].clone();
var n=++D,h="_derivedShaders"+n,g="_onBeforeCompile"+n,l,u;e.prototype=Object.create(a,{constructor:{value:e},isDerivedMaterial:{value:!0},baseMaterial:{value:a},onBeforeCompile:{get:function(){return c},set:function(a){this[g]=a}},copy:{value:function(b){a.copy.call(this,b);a.isShaderMaterial||a.isDerivedMaterial||(this.extensions=b.extensions,this.defines=k({},b.defines),this.uniforms=d.UniformsUtils.clone(b.uniforms));return this}},getDepthMaterial:{value:function(){var c=this._depthMaterial;c||
(u||(u=t(a.isDerivedMaterial?a.getDepthMaterial():new d.MeshDepthMaterial({depthPacking:d.RGBADepthPacking}),b),u.defines.IS_DEPTH_MATERIAL=""),c=this._depthMaterial=u.clone());return c}},getDistanceMaterial:{value:function(){var c=this._distanceMaterial;c||(l||(l=t(a.isDerivedMaterial?a.getDistanceMaterial():new d.MeshDistanceMaterial,b),l.defines.IS_DISTANCE_MATERIAL=""),c=this._distanceMaterial=l.clone());return c}},dispose:{value:function(){var b=this._depthMaterial,c=this._distanceMaterial;b&&
b.dispose();c&&c.dispose();a.dispose.call(this)}}});var m=new e;m.copy(a);m.uniforms=k(d.UniformsUtils.clone(a.uniforms||{}),b.uniforms);m.defines=k({},a.defines,b.defines);m.defines.TROIKA_DERIVED_MATERIAL=n;m.extensions=k({},a.extensions,b.extensions);p[f]=m;return m.clone()}function A(a,b,c){var e=a.vertexShader;a=a.fragmentShader;var f=b.vertexDefs,d=b.vertexMainIntro,h=b.vertexTransform,g=b.fragmentDefs,k=b.fragmentMainIntro,l=b.fragmentColorTransform;if(b=b.timeUniform)b="\nuniform float "+
b+";\n",f=(f||"")+b,g=(g||"")+b;if(f||d||h)h&&(e=r(e),f=(f||"")+"\nvoid troikaVertexTransform"+c+"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n "+h+"\n}\n",e=e.replace(/\b(position|normal|uv)\b/g,function(a,b,e,f){return/\battribute\s+vec3\s+$/.test(f.substr(0,e))?b:"troika_"+b+"_"+c}),d="\nvec3 troika_position_"+c+" = vec3(position);\nvec3 troika_normal_"+c+" = vec3(normal);\nvec2 troika_uv_"+c+" = vec2(uv);\ntroikaVertexTransform"+c+"(troika_position_"+c+", troika_normal_"+c+", troika_uv_"+
var n=++D,h="_derivedShaders"+n,g="_onBeforeCompile"+n,l,u;e.prototype=Object.create(a,{constructor:{value:e},isDerivedMaterial:{value:!0},baseMaterial:{value:a},onBeforeCompile:{get:function(){return c},set:function(a){this[g]=a}},copy:{value:function(b){a.copy.call(this,b);a.isShaderMaterial||a.isDerivedMaterial||(this.extensions=k({},b.extensions),this.defines=k({},b.defines),this.uniforms=d.UniformsUtils.clone(b.uniforms));return this}},getDepthMaterial:{value:function(){var c=this._depthMaterial;
c||(u||(u=t(a.isDerivedMaterial?a.getDepthMaterial():new d.MeshDepthMaterial({depthPacking:d.RGBADepthPacking}),b),u.defines.IS_DEPTH_MATERIAL=""),c=this._depthMaterial=u.clone());return c}},getDistanceMaterial:{value:function(){var c=this._distanceMaterial;c||(l||(l=t(a.isDerivedMaterial?a.getDistanceMaterial():new d.MeshDistanceMaterial,b),l.defines.IS_DISTANCE_MATERIAL=""),c=this._distanceMaterial=l.clone());return c}},dispose:{value:function(){var b=this._depthMaterial,c=this._distanceMaterial;
b&&b.dispose();c&&c.dispose();a.dispose.call(this)}}});var m=new e;m.copy(a);m.uniforms=k(d.UniformsUtils.clone(a.uniforms||{}),b.uniforms);m.defines=k({},a.defines,b.defines);m.defines.TROIKA_DERIVED_MATERIAL=n;m.extensions=k({},a.extensions,b.extensions);p[f]=m;return m.clone()}function A(a,b,c){var e=a.vertexShader;a=a.fragmentShader;var f=b.vertexDefs,d=b.vertexMainIntro,h=b.vertexTransform,g=b.fragmentDefs,k=b.fragmentMainIntro,l=b.fragmentColorTransform;if(b=b.timeUniform)b="\nuniform float "+
b+";\n",f=(f||"")+b,g=(g||"")+b;if(f||d||h)h&&(e=r(e),f=(f||"")+"\nvoid troikaVertexTransform"+c+"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n "+h+"\n}\n",e=e.replace(/\b(position|normal|uv)\b/g,function(a,b,e,f){return/\battribute\s+vec[23]\s+$/.test(f.substr(0,e))?b:"troika_"+b+"_"+c}),d="\nvec3 troika_position_"+c+" = vec3(position);\nvec3 troika_normal_"+c+" = vec3(normal);\nvec2 troika_uv_"+c+" = vec2(uv);\ntroikaVertexTransform"+c+"(troika_position_"+c+", troika_normal_"+c+", troika_uv_"+
c+");\n"+(d||"")+"\n"),e=e.replace(v,(f||"")+"\n\n$&\n\n"+(d||""));if(g||k||l)a=r(a),a=a.replace(v,"\n"+(g||"")+"\nvoid troikaOrigMain"+c+"() {\n"+(k||"")+"\n"),a+="\nvoid main() {\n troikaOrigMain"+c+"();\n "+(l||"")+"\n}";return{vertexShader:e,fragmentShader:a}}function C(a,b){return"uniforms"===a?void 0:b}function x(a,b,c){a*=255;var e=a%1*255,f=e%1*255;var d=Math.round(f%1*255)&255;b[c]=a&255;b[c+1]=e&255;b[c+2]=f&255;b[c+3]=d;return b}var v=/\bvoid\s+main\s*\(\s*\)\s*{/g,k=Object.assign||function(){for(var a=

@@ -8,0 +8,0 @@ arguments,b=arguments[0],c=1,e=arguments.length;c<e;c++){var f=a[c];if(f)for(var d in f)f.hasOwnProperty(d)&&(b[d]=f[d])}return b},D=0,B=Date.now(),w=new WeakMap,E={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",

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

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

"module:es2015": "src/index.js",
"gitHead": "13acfe60f037e5156d7b29940ea87c66b3e71ead"
"gitHead": "603e2abc9959e173ebdd9224999384f89ce22e15"
}

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

if (!baseMaterial.isShaderMaterial && !baseMaterial.isDerivedMaterial) {
this.extensions = source.extensions
this.extensions = assign({}, source.extensions)
this.defines = assign({}, source.defines)

@@ -250,3 +250,3 @@ this.uniforms = UniformsUtils.clone(source.uniforms)

vertexShader = vertexShader.replace(/\b(position|normal|uv)\b/g, (match, match1, index, fullStr) => {
return /\battribute\s+vec3\s+$/.test(fullStr.substr(0, index)) ? match1 : `troika_${match1}_${id}`
return /\battribute\s+vec[23]\s+$/.test(fullStr.substr(0, index)) ? match1 : `troika_${match1}_${id}`
})

@@ -253,0 +253,0 @@ vertexMainIntro = `

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