troika-three-utils
Advanced tools
Comparing version 0.28.1 to 0.29.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.29.0](https://github.com/protectwise/troika/compare/v0.28.1...v0.29.0) (2020-07-06) | ||
### Bug Fixes | ||
* **troika-three-utils:** fix program switching when double-deriving materials ([89ed2f8](https://github.com/protectwise/troika/commit/89ed2f8eab6dfccba3aab95ea667642d13976bfc)) | ||
## [0.28.1](https://github.com/protectwise/troika/compare/v0.28.0...v0.28.1) (2020-06-17) | ||
@@ -8,0 +19,0 @@ |
@@ -244,3 +244,3 @@ import { ShaderChunk, UniformsUtils, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, ShaderLib, DataTexture, Vector3, MeshStandardMaterial, DoubleSide, Mesh, CylinderBufferGeometry, Vector2 } from 'three'; | ||
material.defines = assign({}, baseMaterial.defines, options.defines); | ||
material.defines.TROIKA_DERIVED_MATERIAL = id; //force a program change from the base material | ||
material.defines[`TROIKA_DERIVED_MATERIAL_${id}`] = ''; //force a program change from the base material | ||
material.extensions = assign({}, baseMaterial.extensions, options.extensions); | ||
@@ -247,0 +247,0 @@ |
@@ -254,3 +254,3 @@ (function (global, factory) { | ||
material.defines = assign({}, baseMaterial.defines, options.defines); | ||
material.defines.TROIKA_DERIVED_MATERIAL = id; //force a program change from the base material | ||
material.defines[("TROIKA_DERIVED_MATERIAL_" + id)] = ''; //force a program change from the base material | ||
material.extensions = assign({}, baseMaterial.extensions, options.extensions); | ||
@@ -257,0 +257,0 @@ |
@@ -5,3 +5,3 @@ 'use strict';(function(g,e){"object"===typeof exports&&"undefined"!==typeof module?e(exports,require("three")):"function"===typeof define&&define.amd?define(["exports","three"],e):(g=g||self,e(g.troika_three_utils={},g.THREE))})(this,function(g,e){function u(a){return a.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(a,c){return(c=e.ShaderChunk[c])?u(c):a})}function q(a,b){function c(c){a.onBeforeCompile.call(this,c);var d=this[g]||(this[g]={vertex:{},fragment:{}}),f=d.vertex;d=d.fragment;if(f.source!== | ||
c||(m||(m=q(a.isDerivedMaterial?a.getDepthMaterial():new e.MeshDepthMaterial({depthPacking:e.RGBADepthPacking}),b),m.defines.IS_DEPTH_MATERIAL=""),c=this._depthMaterial=m.clone(),c.uniforms=this.uniforms);return c}},getDistanceMaterial:{value:function(){var c=this._distanceMaterial;c||(h||(h=q(a.isDerivedMaterial?a.getDistanceMaterial():new e.MeshDistanceMaterial,b),h.defines.IS_DISTANCE_MATERIAL=""),c=this._distanceMaterial=h.clone(),c.uniforms=this.uniforms);return c}},dispose:{value:function(){var b= | ||
this._depthMaterial,c=this._distanceMaterial;b&&b.dispose();c&&c.dispose();a.dispose.call(this)}}});var k=new d;k.copy(a);k.uniforms=l(e.UniformsUtils.clone(a.uniforms||{}),b.uniforms);k.defines=l({},a.defines,b.defines);k.defines.TROIKA_DERIVED_MATERIAL=r;k.extensions=l({},a.extensions,b.extensions);t[f]=k;return k.clone()}function C(a,b,c){var d=a.vertexShader,f=a.fragmentShader;a=b.vertexDefs;var e=b.vertexMainIntro,g=b.vertexMainOutro,h=b.vertexTransform,p=b.fragmentDefs,l=b.fragmentMainIntro, | ||
this._depthMaterial,c=this._distanceMaterial;b&&b.dispose();c&&c.dispose();a.dispose.call(this)}}});var k=new d;k.copy(a);k.uniforms=l(e.UniformsUtils.clone(a.uniforms||{}),b.uniforms);k.defines=l({},a.defines,b.defines);k.defines["TROIKA_DERIVED_MATERIAL_"+r]="";k.extensions=l({},a.extensions,b.extensions);t[f]=k;return k.clone()}function C(a,b,c){var d=a.vertexShader,f=a.fragmentShader;a=b.vertexDefs;var e=b.vertexMainIntro,g=b.vertexMainOutro,h=b.vertexTransform,p=b.fragmentDefs,l=b.fragmentMainIntro, | ||
m=b.fragmentMainOutro,k=b.fragmentColorTransform,n=b.customRewriter;b=b.timeUniform;a=a||"";e=e||"";g=g||"";p=p||"";l=l||"";m=m||"";if(h||n)d=u(d);if(k||n)f=f.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"),f=u(f);n&&(f=n({vertexShader:d,fragmentShader:f}),d=f.vertexShader,f=f.fragmentShader);if(k){var q=[];f=f.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,function(a){q.push(a); | ||
@@ -8,0 +8,0 @@ return""});m=k+"\n"+q.join("\n")+"\n"+m}b&&(k="\nuniform float "+b+";\n",a=k+a,p=k+p);h&&(a=a+"\nvec3 troika_position_"+c+";\nvec3 troika_normal_"+c+";\nvec2 troika_uv_"+c+";\nvoid troikaVertexTransform"+c+"(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n "+h+"\n}\n",e="\ntroika_position_"+c+" = vec3(position);\ntroika_normal_"+c+" = vec3(normal);\ntroika_uv_"+c+" = vec2(uv);\ntroikaVertexTransform"+c+"(troika_position_"+c+", troika_normal_"+c+", troika_uv_"+c+");\n"+e+"\n",d=d.replace(/\b(position|normal|uv)\b/g, |
{ | ||
"name": "troika-three-utils", | ||
"version": "0.28.1", | ||
"version": "0.29.0", | ||
"description": "Various utilities related to Three.js", | ||
@@ -17,3 +17,3 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"module:src": "src/index.js", | ||
"gitHead": "96b3c36ff397b784d58a85c3ab29abae0f19bff3" | ||
"gitHead": "839fc0fc5095dcd8dedabee8b3de57521f657a85" | ||
} |
@@ -225,3 +225,3 @@ import { voidMainRegExp } from './voidMainRegExp.js' | ||
material.defines = assign({}, baseMaterial.defines, options.defines) | ||
material.defines.TROIKA_DERIVED_MATERIAL = id //force a program change from the base material | ||
material.defines[`TROIKA_DERIVED_MATERIAL_${id}`] = '' //force a program change from the base material | ||
material.extensions = assign({}, baseMaterial.extensions, options.extensions) | ||
@@ -228,0 +228,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125598