troika-3d-text
Advanced tools
Comparing version 0.20.0 to 0.21.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.21.0](https://github.com/protectwise/troika/compare/v0.20.0...v0.21.0) (2020-03-27) | ||
### Features | ||
* **troika-three-utils:** derived shadow material uniforms are now synced automatically ([7843f23](https://github.com/protectwise/troika/commit/7843f2314caf9463262a16b15de948931b4b6511)) | ||
# [0.20.0](https://github.com/protectwise/troika/compare/v0.19.0...v0.20.0) (2020-03-16) | ||
@@ -8,0 +19,0 @@ |
@@ -113,6 +113,6 @@ 'use strict';(function(D,z){"object"===typeof exports&&"undefined"!==typeof module?z(exports,require("three"),require("troika-worker-utils"),require("troika-three-utils")):"function"===typeof define&&define.amd?define(["exports","three","troika-worker-utils","troika-three-utils"],z):(D=D||self,z(D.troika_3d_text={},D.THREE,D.troika_worker_utils,D.troika_three_utils))})(this,function(D,z,M,Y){function Z(m,g){m=R({},m);S.href=m.font||K.defaultFontURL;m.font=S.href;m.text=""+m.text;var b=K.sdfGlyphSize, | ||
"normal",maxWidth:this.maxWidth,textAlign:this.textAlign,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchor:this.anchor,includeCaretPositions:!0},function(c){b._isSyncing=!1;b._textRenderInfo=c;b.geometry.updateGlyphs(c.glyphBounds,c.glyphAtlasIndices,c.totalBounds);var d=b._queuedSyncs;d&&(b._queuedSyncs=null,b._needsSync=!0,b.sync(function(){d.forEach(function(a){return a&&a()})}));a&&a()})))};g.prototype.onBeforeRender=function(){this.sync();this._prepareMaterial()};g.prototype.dispose= | ||
function(){this.geometry.dispose()};b.textRenderInfo.get=function(){return this._textRenderInfo||null};b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||V;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=ba(b),b.addEventListener("dispose",function e(){b.removeEventListener("dispose",e);a.dispose()}));return a};b.material.set=function(a){this._baseMaterial=a};b.customDepthMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDepthMaterial())}; | ||
b.customDistanceMaterial.get=function(){return this._updateLayoutUniforms(this.material.getDistanceMaterial())};g.prototype._prepareMaterial=function(){var a=this._derivedMaterial;this._updateLayoutUniforms(a);a.uniforms.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;var b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};g.prototype._updateLayoutUniforms=function(a){var b= | ||
this.textRenderInfo,d=a.uniforms;if(b){var e=b.sdfTexture,f=b.totalBounds;d.uTroikaSDFTexture.value=e;d.uTroikaSDFTextureSize.value.set(e.image.width,e.image.height);d.uTroikaSDFGlyphSize.value=b.sdfGlyphSize;d.uTroikaSDFMinDistancePct.value=b.sdfMinDistancePercent;d.uTroikaTotalBounds.value.fromArray(f);(b=this.clipRect)&&Array.isArray(b)&&4===b.length?d.uTroikaClipRect.value.set(Math.max(f[0],b[0]),Math.max(f[1],b[1]),Math.min(f[2],b[2]),Math.min(f[3],b[3])):d.uTroikaClipRect.value.fromArray(f)}return a}; | ||
g.prototype.raycast=function(a,b){var c=this.textRenderInfo;c&&(c=c.totalBounds,W.matrixWorld.multiplyMatrices(this.matrixWorld,ea.set(c[2]-c[0],0,0,c[0],0,c[3]-c[1],0,c[1],0,0,1,0,0,0,0,1)),W.raycast(a,b))};Object.defineProperties(g.prototype,b);return g}(z.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(m){var g="_private_"+m;Object.defineProperty(X.prototype,m,{get:function(){return this[g]},set:"anchor"===m?function(b){JSON.stringify(b)!== | ||
JSON.stringify(this[g])&&(this[g]=b,this._needsSync=!0)}:function(b){b!==this[g]&&(this[g]=b,this._needsSync=!0)}})});D.GlyphsGeometry=L;D.TextMesh=X;D.configureTextBuilder=function(m){R(K,m)};D.fontProcessorWorkerModule=G;Object.defineProperty(D,"__esModule",{value:!0})}); | ||
function(){this.geometry.dispose()};b.textRenderInfo.get=function(){return this._textRenderInfo||null};b.material.get=function(){var a=this._derivedMaterial,b=this._baseMaterial||V;a&&a.baseMaterial===b||(a&&a.dispose(),a=this._derivedMaterial=ba(b),b.addEventListener("dispose",function e(){b.removeEventListener("dispose",e);a.dispose()}));return a};b.material.set=function(a){this._baseMaterial=a};b.customDepthMaterial.get=function(){return this.material.getDepthMaterial()};b.customDistanceMaterial.get= | ||
function(){return this.material.getDistanceMaterial()};g.prototype._prepareMaterial=function(){var a=this._derivedMaterial,b=a.uniforms,d=this.textRenderInfo;if(d){var e=d.sdfTexture,f=d.totalBounds;b.uTroikaSDFTexture.value=e;b.uTroikaSDFTextureSize.value.set(e.image.width,e.image.height);b.uTroikaSDFGlyphSize.value=d.sdfGlyphSize;b.uTroikaSDFMinDistancePct.value=d.sdfMinDistancePercent;b.uTroikaTotalBounds.value.fromArray(f);(d=this.clipRect)&&Array.isArray(d)&&4===d.length?b.uTroikaClipRect.value.set(Math.max(f[0], | ||
d[0]),Math.max(f[1],d[1]),Math.min(f[2],d[2]),Math.min(f[3],d[3])):b.uTroikaClipRect.value.fromArray(f)}b.uTroikaSDFDebug.value=!!this.debugSDF;a.polygonOffset=!!this.depthOffset;a.polygonOffsetFactor=a.polygonOffsetUnits=this.depthOffset||0;b=this.color;null!=b&&a.color&&a.color.isColor&&b!==a._troikaColor&&a.color.set(a._troikaColor=b)};g.prototype.raycast=function(a,b){var c=this.textRenderInfo;c&&(c=c.totalBounds,W.matrixWorld.multiplyMatrices(this.matrixWorld,ea.set(c[2]-c[0],0,0,c[0],0,c[3]- | ||
c[1],0,c[1],0,0,1,0,0,0,0,1)),W.raycast(a,b))};Object.defineProperties(g.prototype,b);return g}(z.Mesh);"font fontSize letterSpacing lineHeight maxWidth overflowWrap text textAlign whiteSpace anchor".split(" ").forEach(function(m){var g="_private_"+m;Object.defineProperty(X.prototype,m,{get:function(){return this[g]},set:"anchor"===m?function(b){JSON.stringify(b)!==JSON.stringify(this[g])&&(this[g]=b,this._needsSync=!0)}:function(b){b!==this[g]&&(this[g]=b,this._needsSync=!0)}})});D.GlyphsGeometry= | ||
L;D.TextMesh=X;D.configureTextBuilder=function(m){R(K,m)};D.fontProcessorWorkerModule=G;Object.defineProperty(D,"__esModule",{value:!0})}) |
{ | ||
"name": "troika-3d-text", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"description": "Troika 3D Text", | ||
@@ -18,5 +18,5 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"dependencies": { | ||
"troika-3d": "^0.20.0", | ||
"troika-three-utils": "^0.20.0", | ||
"troika-worker-utils": "^0.20.0" | ||
"troika-3d": "^0.21.0", | ||
"troika-three-utils": "^0.21.0", | ||
"troika-worker-utils": "^0.21.0" | ||
}, | ||
@@ -31,3 +31,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "c97a9f97c30cd4ddfba068430d02d7c0a73c2e08" | ||
"gitHead": "0a7527c90b55f0cd09192ad2f71c62f287702186" | ||
} |
@@ -269,6 +269,6 @@ import { | ||
get customDepthMaterial() { | ||
return this._updateLayoutUniforms(this.material.getDepthMaterial()) | ||
return this.material.getDepthMaterial() | ||
} | ||
get customDistanceMaterial() { | ||
return this._updateLayoutUniforms(this.material.getDistanceMaterial()) | ||
return this.material.getDistanceMaterial() | ||
} | ||
@@ -278,20 +278,4 @@ | ||
const material = this._derivedMaterial | ||
this._updateLayoutUniforms(material) | ||
// presentation uniforms: | ||
const uniforms = material.uniforms | ||
uniforms.uTroikaSDFDebug.value = !!this.debugSDF | ||
material.polygonOffset = !!this.depthOffset | ||
material.polygonOffsetFactor = material.polygonOffsetUnits = this.depthOffset || 0 | ||
// shortcut for setting material color via facade prop: | ||
const color = this.color | ||
if (color != null && material.color && material.color.isColor && color !== material._troikaColor) { | ||
material.color.set(material._troikaColor = color) | ||
} | ||
} | ||
_updateLayoutUniforms(material) { | ||
const textInfo = this.textRenderInfo | ||
const uniforms = material.uniforms | ||
if (textInfo) { | ||
@@ -317,3 +301,11 @@ const {sdfTexture, totalBounds} = textInfo | ||
} | ||
return material | ||
uniforms.uTroikaSDFDebug.value = !!this.debugSDF | ||
material.polygonOffset = !!this.depthOffset | ||
material.polygonOffsetFactor = material.polygonOffsetUnits = this.depthOffset || 0 | ||
// shortcut for setting material color via facade prop: | ||
const color = this.color | ||
if (color != null && material.color && material.color.isColor && color !== material._troikaColor) { | ||
material.color.set(material._troikaColor = color) | ||
} | ||
} | ||
@@ -320,0 +312,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
90
3
8
1
11
1898857
33475
+ Addedthree@0.115.0(transitive)
+ Addedtroika-3d@0.21.0(transitive)
+ Addedtroika-animation@0.21.0(transitive)
+ Addedtroika-core@0.21.0(transitive)
+ Addedtroika-three-utils@0.21.0(transitive)
+ Addedtroika-worker-utils@0.21.0(transitive)
- Removedthree@0.112.1(transitive)
- Removedtroika-3d@0.20.0(transitive)
- Removedtroika-animation@0.20.0(transitive)
- Removedtroika-core@0.20.0(transitive)
- Removedtroika-three-utils@0.20.0(transitive)
- Removedtroika-worker-utils@0.20.0(transitive)
Updatedtroika-3d@^0.21.0
Updatedtroika-three-utils@^0.21.0
Updatedtroika-worker-utils@^0.21.0