Skip to content

Commit

Permalink
example of prod rendered and split
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul McKellar committed Nov 19, 2022
1 parent 27fe7c5 commit 602b057
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 57 deletions.
113 changes: 57 additions & 56 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,71 +163,72 @@ let packModelData = () => {
// exports.minifyShaders = minifyShaders;
// exports.packModelData = packModelData;

// let clearHtml = () => {
// fs.mkdirSync('prod/html', { recursive: true });
// fs.readdirSync('prod/html').forEach((file) => {
// fs.unlinkSync(`prod/html/${file}`);
// });
// };

// let clearHtmlDest = () => {
// const dest = '../ticklenft/html';
// fs.mkdirSync(dest, { recursive: true });
// fs.readdirSync(dest).forEach((file) => {
// fs.unlinkSync(`${dest}/${file}`);
// });
// };
let clearHtml = () => {
fs.mkdirSync('prod/html', { recursive: true });
fs.readdirSync('prod/html').forEach((file) => {
fs.unlinkSync(`prod/html/${file}`);
});
};

// const maxSize = 24000;
let clearHtmlDest = () => {
console.log('not implemented yet in public repo');
// const dest = '../ticklenft/html';
// fs.mkdirSync(dest, { recursive: true });
// fs.readdirSync(dest).forEach((file) => {
// fs.unlinkSync(`${dest}/${file}`);
// });
};

// let logic = (cb) => {
// clearHtmlDest();
// clearHtml();
const maxSize = 24000;

// let index = fs.readFileSync('prod/index.html', 'utf8');
// let split = index.split('</script>');
// let back = split.map((s, i) => {
// if (i == split.length - 1) {
// return s;
// }
let logic = (cb) => {
clearHtmlDest();
clearHtml();

// return s + '</script>';
// });
let index = fs.readFileSync('prod/index.html', 'utf8');
let split = index.split('</script>');
let back = split.map((s, i) => {
if (i == split.length - 1) {
return s;
}

// let i = 0;
// for (let s of back) {
// fs.writeFileSync(`prod/html/index.${i}.html`, s);
// i++;
// }
return s + '</script>';
});

// // files too big
// const htmlFile = 1;
// let modelFiles = fs.readFileSync(`prod/html/index.${htmlFile}.html`, 'utf8');
let i = 0;
for (let s of back) {
fs.writeFileSync(`prod/html/index.${i}.html`, s);
i++;
}

// // split models in to chunks the size of maxSize and write them to even/index.1.html
// let location = 0;
// i = 0;
// while (location < modelFiles.length) {
// let part = modelFiles.slice(location, location + maxSize);
// fs.writeFileSync(`prod/html/index.${htmlFile}.${i}.html`, part);
// location += maxSize;
// i++;
// }
// files too big
const htmlFile = 1;
let modelFiles = fs.readFileSync(`prod/html/index.${htmlFile}.html`, 'utf8');

// split models in to chunks the size of maxSize and write them to even/index.1.html
let location = 0;
i = 0;
while (location < modelFiles.length) {
let part = modelFiles.slice(location, location + maxSize);
fs.writeFileSync(`prod/html/index.${htmlFile}.${i}.html`, part);
location += maxSize;
i++;
}

// // delete this file prod/html/index.1.html
// fs.unlinkSync(`prod/html/index.${htmlFile}.html`);
// delete this file prod/html/index.1.html
fs.unlinkSync(`prod/html/index.${htmlFile}.html`);

// // files too small
// // const smallFiles = [2, 3];
// let file2 = fs.readFileSync(`prod/html/index.2.html`, 'utf8');
// let file3 = fs.readFileSync(`prod/html/index.3.html`, 'utf8');
// let newFile = file2 + file3;
// fs.writeFileSync(`prod/html/index.2-3.html`, newFile);
// fs.unlinkSync(`prod/html/index.2.html`);
// fs.unlinkSync(`prod/html/index.3.html`);
// files too small
// const smallFiles = [2, 3];
let file2 = fs.readFileSync(`prod/html/index.2.html`, 'utf8');
let file3 = fs.readFileSync(`prod/html/index.3.html`, 'utf8');
let newFile = file2 + file3;
fs.writeFileSync(`prod/html/index.2-3.html`, newFile);
fs.unlinkSync(`prod/html/index.2.html`);
fs.unlinkSync(`prod/html/index.3.html`);

// cb();
// };
cb();
};

// let even = (cb) => {
// clearHtmlDest();
Expand Down Expand Up @@ -353,7 +354,7 @@ let packModelData = () => {
// cb();
// };

// exports.logic = logic;
exports.logic = logic;
// exports.even = even;
// exports.makeUnrevealed = makeUnrevealed;

Expand Down
1 change: 1 addition & 0 deletions prod/html/index.0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,minimal-ui,viewport-fit=cover,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/><title>Tickle Beach</title><style>:root { overflow: hidden; height: 100% } body { margin: 0 }</style></head><body><script defer="defer">window.seed="42582326515852401476552633600533149901123906319053889057041875860767557842394";</script>
1 change: 1 addition & 0 deletions prod/html/index.1.0.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions prod/html/index.1.1.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions prod/html/index.1.2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iKKsJawWpqq6qaQFscgaozGMa6whsHH1ygyQoMIaAHPmGRw0oJDnqqyIq6qaQFsBjmGasMWaMAL3WILyygyQoMIKW8kKhcdKNMGqqqqrqLjVrhqCHliBj1aGb0GsRLDyOcQ6dMcaFMY6wApqqhqrqBRgKcUaoxyzpJwRt5w1tBX3ygsDHjGVxxoFwCpZwIpqqququ8caoKDlmBbzOADzGcdLDyOcMaEMiawjohqqq6qaQGoMUaoKDlmBbzOADzGcdLDyGcZ6whpBPiG8MqqqqrqBRgyQ5aAqGxGcUbw5sBDkymocYKXpWqKMsMqCyToaw1pBXnmAXpaEjjaELoqqG0BrKMoluCj4aJP3aDfkqBXnGcdah8VaEDXoGAyjpiuaQHsrwIqjqjxFuMqjx1OcQawAuBXnaCXqgspIHqoqynoqxluqG0B6Ych6oqAMiLjaFMoDHkG8Ybw1pmwlKIbKyhWqq8JqGBX6qaQHoCwIqhqWxysiwhtixFpawhoBXnaEXjeFHmODHmKqqMphuqG0BqVsM6oqMsNbKcl7RstDHhGsoMMKasFqgspBwCqxoqynoqxluqG0BqMsN6oKa8lLFsN7kMa6wApscbwjpGxnGDjpicoiqKfiqFX6qaQHooxXqjq3xJuTyosywRqDDkyytBPmaEfaMMmKyhKqq8JqWcprqBdgeHnorBoaILf2GMJLTlyop8RawhpjuSxGqMUaAcd7wQpBT4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ElmKCKCKCqdKhqcKeqR6YqUlGypaAhigShqCgqUlGDqqoRRaEgqRAamqO6ojGCohQaAoKVpagiWnKVpig6JaElKVpVpVpVpyMqUlKxoJoJoJoBRqUlGSohVaYlGWpxEaMhGToCqUpxEaAoGAqBgam6NqFKSacpGIqSVqqKpSVqUlKSphl6U6U6UaEpGRqRkaJqJaMjGnoGqGqROaYoGCpCkagkGDqpopopoxJaUiGFoxJaEjaoakakakGWpBRaAoGQoBEaAhKVphVqGjpxYaMmKVpjpEoBMaAjGwoRUaElGRp5p5p5pIoUqSoBQaAoqxRagkqEqEqEqVo4pHqxlaYkqxgaMmGDphMqUlGWpSVqUjG1oykqOqMpKTqykqN6ZqUlKVpKpRRaUkGFpCcqAnKwpacnOomkSnqRJaUiGloSEqUlGToROakjG5oioFoSVqUlGzonoRNqEiKVpCkaApWpanapehWjWjWjSkSkSkGhqiUqIlqjKVpmaKeKeKeaQhKVpBdaoxpEpBlaIkmkGXqBhaEjmpmpmpKDpRNaKqUlGopxcqUiigigqSVqQmmiipeiigqSVaUoGFqRhqVaQmKAoipxVqApGkoqejGooSVKSaQgGUqGoGoGoacgKQqCkakhqKaaAoSjOgGFpxopS4rSVachKTqSVaAlKgoSVqGooRGaoCqxNapCoIqhGieiGRpSVaMkGJqyEqYKVKmqUaEnGxozopoRI6oWonpCN6pRqChaVaAjqlGgKkpyUqEoKRpRmacoKzpiEakmKVpSg6dqIoGWqkpiYaMgOiGSpFpxVamKRaUlWhm6FqUlGzpEpCFqJqK1oxAqMqQiKkoCJqYqYqYqUiK0oCBqQiKwokKkoBO6pipipipCFagpGnpCFqAoKAqmGjpSkqQiKwokakSpSgakOmKgamanmnGDpRiqMhipGliqIoKTpCJaMkGJqyEqYKVKmP";</script>
1 change: 1 addition & 0 deletions prod/html/index.2-3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script defer="defer">(()=>{"use strict";var n={};function r(n,r,t){return{x:n,y:r,z:t}}function t(n){return r(n("x"),n("y"),n("z"))}function u(n){return n.hasOwnProperty("x")}function e(n){return Array.isArray(n)}function i(n,r){return u(r)?t((t=>n[t]-r[t])):t((t=>n[t]-r))}function o(n){return Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)}function a(n,r){return u(n)?u(r)?t((t=>Math.min(n[t],r[t]))):t((t=>Math.min(n[t],r))):Math.min(n,r)}function c(n,r){return u(n)?u(r)?t((t=>Math.max(n[t],r[t]))):t((t=>Math.max(n[t],r))):Math.max(n,r)}function f(n,r){return t((t=>n[t]/r))}function m(n){return[n.x,n.y,n.z]}n.d=(r,t)=>{for(var u in t)n.o(t,u)&&!n.o(r,u)&&Object.defineProperty(r,u,{enumerable:!0,get:t[u]})},n.o=(n,r)=>Object.prototype.hasOwnProperty.call(n,r);let x=window;x.vec=r,x.sub=i,x.div=f,x.add=function(n,r){return u(r)?t((t=>n[t]+r[t])):t((t=>n[t]+r))},x.mul=function(n,i){if(e(n)){if(e(i)){let r=n[0],t=n[1],u=n[2],e=n[3],o=n[4],a=n[5],c=n[6],f=n[7],m=n[8],x=i[0],y=i[1],s=i[2],h=i[3],d=i[4],b=i[5],l=i[6],M=i[7],z=i[8];return function(...n){return n}(x*r+y*e+s*c,x*t+y*o+s*f,x*u+y*a+s*m,h*r+d*e+b*c,h*t+d*o+b*f,h*u+d*a+b*m,l*r+M*e+z*c,l*t+M*o+z*f,l*u+M*a+z*m)}{let t=i.x,u=i.y,e=i.z;return r(t*n[0]+u*n[3]+e*n[6],t*n[1]+u*n[4]+e*n[7],t*n[2]+u*n[5]+e*n[8])}}if(u(n))return u(i)?t((r=>n[r]*i[r])):t((r=>n[r]*i))},x.vecToArray=m,x.normalize=function(n){const t=o(n);return Math.abs(t)<1e-5?r(0,0,0):f(n,t)},x.min=a,x.max=c,x.boundsFromArray=function(n){return{min:r(...n[0]),max:r(...n[1])}},x.boundsToArray=function(n){return[m(n.min),m(n.max)]},x.boundsIntersection=function(n,r){return{min:c(n.min,r.min),max:a(n.max,r.max)}}})();</script><script defer="defer">(()=>{"use strict";let t=window;const e=["the"],s=["arm","leg","mouth","eyes","body","ground","glasses","tat","shoes","mustache","headtop","hand","floor","neck","hat","shirt"],n=["add","sub","int","rep"];let r=t=>t.string.substring(t.index),o=t=>{const e="+"===r(t)[0];return t.index+=1,e},a=t=>{let e=r(t).match(/^[+-][\d.]*/);if(e){if(e=e[0],1!==e.length)return t.index+=e.length,parseFloat(e);if("+"===e[0])return t.index+=1,0}};const i=["attach","cube","cylinder","bezier","joint","sphere","triangle","polygon"];let p=(t,e)=>{const s=[];for(let n=0;n<e;n++)s.push(a(t));return s};const l=["blend","shell","hole","bevel","round","cone","lineWidth","vertexPosition","torus","mirrorX","material","blink","star","vertexCount","offsX"],d={cube:"bshbrc__tmm___o",cylinder:"bsh_rc__tmm___o",bezier:"bsh_rclvtmm___o",joint:"bs___c__tmm___o",sphere:"bs_______mmb__o",triangle:"bshbrc_vtmm___o",polygon:"bshbrc____m_sn_"},h="nnnnnnnnbbnbnnn";let c,u,m=(t,r)=>{const c=(t=>i[a(t)])(r);let u={primitive:c};return l.forEach(((t,e)=>{u[t]="n"===h[e]&&0})),"attach"===c?u={...u,partName:t,attach:{part:s[a(r)],side:e[a(r)]},position:p(r,3),rotation:[0,0,0],size:[1,1,1],blend:a(r),material:0}:(u={...u,partName:t,mode:n[a(r)],position:p(r,3),rotation:p(r,3),size:p(r,3)},l.forEach(((t,e)=>{"_"!==d[c][e]&&(u[t]=("n"===h[e]?a:o)(r))})),u.material<0&&(u.material=1e4-u.material),u.material+=1),u};function f(t){const n={};return t.split(";").forEach((t=>{const r={string:t,index:0},o=s[a(r)],i=e[a(r)],p=a(r),l=[[a(r),a(r),a(r)],[a(r),a(r),a(r)]],d=(h=o,r.string.substring(r.index).split(",").map((t=>{const e={string:t,index:0},s=[];for(;e.index<e.string.length;)s.push(m(h,e));return{subparts:s}})));var h;n[o]=n[o]||[],n[o][p]=n[o][p]||{},n[o][p][i]={part:o,side:i,index:p,layers:d,bounds:l}})),n}function b(t){const e={string:t,index:0},s=[];for(;e.index<e.string.length;)s.push({roughness:a(e),metalness:a(e)});return s}function _(t){return t.split(";").map((t=>{const e={string:t,index:0},s=[];for(;e.index<e.string.length;)s.push([a(e),a(e),a(e)]);return s}))}function x(t){const e=(t=>{const e=t.split("").map((t=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+=".indexOf(t))),s=[];let n=0;for(;;){const t=e[Math.floor(n/6)];if(n%6==0)s.push(15&t);else if(n%6==2)s.push((60&t)>>2);else{const r=e[Math.floor((n+4)/6)];s.push(((48&t)>>4)+((3&r)<<2))}if(n+=4,Math.floor((n+2)/6)>=e.length)break}return s.map((t=>"0123456789+-.,;/"[t])).join("")})(t),[s,n,r,o]=e.split("/");return{models:f(s),mats:b(n),hardcoded:_(r)[0],randomized:_(o)}}const g=()=>{c=t.models?x(t.models):{},t.repo=c,u=c.models};function y(t){const e=[0,0,106];return t=(t=[(t=t.map(((t,s)=>t-e[s])))[0],t[2],-t[1]]).map((t=>t/150))}g();let M=(t,e)=>t.map(((t,s)=>t+e[s]));const k="floor";const v=[{part:"shoes",side:"the",index:0,coreModels:!0},{part:"body",side:"the",index:3,separate:!0,maxDepth:0,coreModels:!0},{part:"glasses",side:"the",index:0,separate:!1,maxDepth:0,coreModels:!0},{part:"ground",side:"the",index:0,separate:!1,maxDepth:0,coreModels:!0},{part:"hand",side:"the",index:0},{part:"headtop",side:"the",index:0},{part:"neck",side:"the",index:0},{part:"shirt",side:"the",index:0}];t.setupRepoModels=g,t.buildRepo=function(t,e=!0,s=!0){const n=((t,e)=>{if(g(),!t["floor:the"])return;const s=[{part:u.floor[t["floor:the"]].the,pos:y([0,0,0]),_pos:[0,0,0],maxDepth:0}];return v.forEach((({part:n,side:r,separate:o,maxDepth:a})=>{const i=`${n}:${r}`;if(t[i]){let d=!1;for(let h=0;h<s.length;h++){const c=u[n][t[i]][r],m=s[h].part;let f=0,b=0;t:for(;f<m.layers.length;f++){const t=m.layers[f];for(b=0;b<t.subparts.length;b++){const e=t.subparts[b];if("attach"===e.primitive&&e.attach.part===n)break t}}if(f<m.layers.length){d=!0;const t=m.layers[f].subparts[b].position;if(e&&o){const e=s[h]._pos,n=t.map(((t,s)=>t+e[s]));s.push({part:c,pos:y(n),_pos:n,maxDepth:a})}else{const e=c.layers.map((e=>({layer:{...e},subparts:e.subparts.map((e=>({...e,position:M(e.position,t)})))})));m.layers.splice(f,0,...e);const s=y(t);m.bounds=(p=m.bounds,l=[M(c.bounds[0],s),M(c.bounds[1],s)],[[Math.min(p[0][0],l[0][0]),Math.min(p[0][1],l[0][1]),Math.min(p[0][2],l[0][2])],[Math.max(p[1][0],l[1][0]),Math.max(p[1][1],l[1][1]),Math.max(p[1][2],l[1][2])]])}}}}var p,l})),s})(((t,e)=>{const s={};let n=[];n=1==e?[{part:k,side:"the",ci:0},...v]:[{part:k,side:"the",ci:0},...v.filter((t=>1==t.coreModels))];const r=t.split("-");return n.forEach((({part:t,side:e})=>{const n=r.find((s=>s.startsWith(`${t}:${e}:`)));if(!n)return;const[,,o]=n.split(":"),a=parseInt(o),i=`${t}:${e}`,p=u[t];if(p){const t=p[a][e];if(t){const e=t.index;s[i]=e}}})),s})(t,s),e),r=n.map((t=>{return{part:(e=t).part.layers.filter((t=>t.subparts.length>0)).map(((t,e)=>({layerIndex:e,op:t.subparts[0].mode,blend:t.subparts[0].blend,strokes:t.subparts}))),bounds:e.part.bounds,pos:e.pos,maxDepth:e.maxDepth};var e}));return{repo:c,strokes:r}},t.strokesToData=function(t){const e=new Float32Array(1e6);let s=0,r=1;return t.forEach((t=>{t.strokes.forEach(((o,a)=>{const p=32*r;e[p+0]=i.indexOf(o.primitive),e[p+1]=n.indexOf(o.mode),e[p+2]=o.position[0],e[p+3]=o.position[1],e[p+4]=o.position[2],e[p+5]=o.rotation[0],e[p+6]=o.rotation[1],e[p+7]=o.rotation[2],e[p+8]=o.size[0],e[p+9]=o.size[1],e[p+10]=o.size[2],l.forEach(((t,s)=>{e[p+11+s]="n"===h[s]?o[t]:o[t]?1:0}));a===t.strokes.length-1&&(e[p+11+15]=1,e[p+11+16]=n.indexOf(t.strokes[0].mode),e[p+11+17]=t.strokes[0].blend),s+=1,r+=1}))})),e[0]=s,e}})();</script>
1 change: 1 addition & 0 deletions prod/html/index.4.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions prod/html/index.5.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions prod/html/index.6.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script defer="defer">window.renderSelected();</script>
1 change: 1 addition & 0 deletions prod/html/index.7.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
</body></html>
1 change: 1 addition & 0 deletions prod/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webpack.oct.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
title: 'Tickle Beach',
template: 'src/octree/viewer.html',
inject: 'body',
filename: 'viewer.html',
filename: 'index.html',
}),
new HtmlInlineScriptPlugin(),
],
Expand Down

0 comments on commit 602b057

Please sign in to comment.