Add files using upload-large-folder tool
Browse filesFiles changed (20)
- filestorage/gd/penalty-shooters-3/404.htmlAdded+1
- filestorage/gd/penalty-shooters-3/408.htmlAdded+1
- filestorage/gd/penalty-shooters-3/faktorikosoghica.jsonAdded+108
- filestorage/gd/penalty-shooters-3/frame.htmlAdded+1
- filestorage/gd/penalty-shooters-3/games235.htmlAdded+1
- filestorage/gd/penalty-shooters-3/gametext.jsonAdded+465
- filestorage/gd/penalty-shooters-3/gl-matrix.jsAdded
- filestorage/gd/penalty-shooters-3/gltfdata.jsAdded+412
- filestorage/gd/penalty-shooters-3/gltfmodel.jsAdded+1028
- filestorage/gd/penalty-shooters-3/gltfmodelw.jsAdded+815
- filestorage/gd/penalty-shooters-3/gltfworker.jsAdded
- filestorage/gd/penalty-shooters-3/golv3.glbAdded
- filestorage/gd/penalty-shooters-3/index.htmlAdded+53
- filestorage/gd/penalty-shooters-3/manifest.jsonAdded+3
- filestorage/gd/penalty-shooters-3/min_snaga_i_deltax.jsonAdded+240
- filestorage/gd/penalty-shooters-3/reprezentacije.jsonAdded+378
- filestorage/gd/penalty-shooters-3/style.cssAdded+80
- filestorage/gd/penalty-shooters-3/sw.jsAdded+2
- filestorage/gd/penalty-shooters-3/tiers.jsonAdded+148
- filestorage/gd/penalty-shooters-3/ubg235.htmlAdded+3
1PS 404 Not Found!1PS 408 Request Time Out!123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108{ "c2array": true, "size": [ 7, 4, 1 ], "data": [ [ [ "X" ], [ 7 ], [ 15 ], [ 22 ] ], [ [ 0 ], [ 2 ], [ 2 ], [ 1.95 ] ], [ [ 10 ], [ 1.95 ], [ 1.95 ], [ 1.9 ] ], [ [ 40 ], [ 1.75 ], [ 1.5 ], [ 1.4 ] ], [ [ 80 ], [ 1.6 ], [ 1.35 ], [ 1.2 ] ], [ [ 120 ], [ 1.5 ], [ 1.3 ], [ 1.2 ] ], [ [ 500 ], [ 1.5 ], [ 1.3 ], [ 1.2 ] ] ]}1<iframe width="100%" height="100%" src="index.html"></iframe>1<script src="js/analytics_games235.js"></script>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465{ "c2array": true, "size": [ 91, 1, 1 ], "data": [ [ [ "Goal Getter@Score your first career goal@*@2" ] ], [ [ "Safe Hands@Make your first career save@*@2" ] ], [ [ "Victory Lap@Win your first career match@*@5" ] ], [ [ "Perfect Defense@Save 3+ consecutive\\nshots in one match@@2" ] ], [ [ "Perfect Attendance@Play on 5 consecutive\\ndays@@25" ] ], [ [ "Flawless Victory@Win the match without\\nmissing a single shot@@2" ] ], [ [ "Iron Wall@Don't concede any goals in a \\npenalty shootout@@2" ] ], [ [ "Seasoned Competitor@25 Matches Played@*@25" ] ], [ [ "Marathoner@100 Matches Played@*@50" ] ], [ [ "Legendary Warrior@250 Matches Played@*@150" ] ], [ [ "Penalty Maestro@Score 1,000 goals@*@150" ] ], [ [ "World Cup Champion@Conquer the World Cup@@50" ] ], [ [ "Training Ground Ace@Tier 1 Champion@*@10" ] ], [ [ "Rising Star@Tier 2 Champion@*@15" ] ], [ [ "Spot Kick Savant@Tier 3 Champion@*@50" ] ], [ [ "Penalty Powerhouse@Tier 4 Champion@*@100" ] ], [ [ "Clutch Performer@Tier 5 Champion@*@150" ] ], [ [ "Tier Conqueror@Tier 6 Champion@*@300" ] ], [ [ "FAIL" ] ], [ [ "YOU DID IT!" ] ], [ [ "Not enough coins!##Play World Cup to earn some#(no entry fee there.)" ] ], [ [ "Entry fee:#" ] ], [ [ "There's no entry fee for the World Cup matches!" ] ], [ [ "XX trophies won!" ] ], [ [ "XX trophies lost... " ] ], [ [ "The World Cup mode doesn't affect trophies." ] ], [ [ "Win XX trophies to #unlock this tier" ] ], [ [ "VICTORY!" ] ], [ [ "DEFEAT..." ] ], [ [ "You won XX trophies!" ] ], [ [ "You lost XX trophies." ] ], [ [ "CAREER STATS: GOALS ###, MATCHES %%%, VICTORIES &&&" ] ], [ [ "Currently, you have no trophies." ] ], [ [ "Overall max#trophies reached.#Legendary!" ] ], [ [ "Tier completed!#Play another tier to win more trophies." ] ], [ [ "You don't have enough gems!" ] ], [ [ "CLICK ON THE POWER-UP TO BUY IT" ] ], [ [ "Coins" ] ], [ [ "Gems" ] ], [ [ "Trophies" ] ], [ [ "You need coins to enter matches in the Tier mode ('entry fee').\\n\\nWin matches to earn double\\nentry fee.\\n\\nIn the World Cup mode, no entry fee is needed, so you can play whenever you like (you'll still get the prize when you win)" ] ], [ [ "Gems are a special currency that you can use to purchase power-ups and retry lost matches.\\n\\nYou can earn gems by accomplishing achievements." ] ], [ [ "Trophies are important for unlocking and progressing through tiers.\\n\\nIn the Tier mode, winning matches earns you trophies, while losing matches deducts some. Once you reach the maximum number of trophies for a tier, that tier is completed.\\n\\nThe World Cup mode doesn't affect trophies." ] ], [ [ "Team names, kit designs, and colors used in this game are fictional and any resemblance to real teams is purely coincidental. \\n\\nThis game is not associated with or endorsed by any real team or league." ] ], [ [ "This will delete your game progress and start a new game.\\n\\n Are you sure?" ] ], [ [ "Training Ground Arena" ] ], [ [ "Talent Showcase Ground" ] ], [ [ "Rising Talent Stadium" ] ], [ [ "Skill Showdown Ground" ] ], [ [ "Skillmaster Arena" ] ], [ [ "Epic Thunderdome Stadium" ] ], [ [ "You shoot" ] ], [ [ "Opponent shoots" ] ], [ [ "Goal!" ] ], [ [ "Miss!" ] ], [ [ "Save!" ] ], [ [ "Match over!" ] ], [ [ "You lost but..." ] ], [ [ "You can replay this match for ## gems! " ] ], [ [ "Previous match\\n doesn't count.\\nEntry fee and trophies\\n were refunded." ] ], [ [ "Out of power-ups" ] ], [ [ "How to shoot:" ] ], [ [ "1: PICK A POWER-UP [OPTIONAL]" ] ], [ [ "2: WATCH THE STRENGTH INDICATOR" ] ], [ [ "3: PRESS ANYWHERE AND HOLD TO AIM" ] ], [ [ "4: RELEASE TO KICK" ] ], [ [ "How to save:" ] ], [ [ "2: Watch for the target to appear" ] ], [ [ "3: Tap the target to save" ] ], [ [ "World Cup mode unlocked!" ] ], [ [ "The tension is great before the grand finale!" ] ], [ [ "You're the champion of the world!" ] ], [ [ "You made it to the finals!" ] ], [ [ "How to play?" ] ], [ [ "Shooting:" ] ], [ [ "Defending:" ] ], [ [ "1: CHOOSE A POWERUP (OPTIONAL)" ] ], [ [ "2: WATCH OUT THE SHOT POWER" ] ], [ [ "3: PRESS ANYWHERE AND HOLD " ] ], [ [ "4: RELEASE TO KICK" ] ], [ [ "Tip: Change your ways of shooting, goalkeeper is smart!" ] ], [ [ "Tip: Strong and precise shots .." ] ], [ [ "Tip" ] ], [ [ "Tip" ] ], [ [ "1: CHOOSE A POWERUP (OPTIONAL)" ] ], [ [ "2: WATCH THE SHOT POWER INDICATOR" ] ], [ [ "3: WAIT FOR THE TARGET TO APPEAR" ] ], [ [ "4: TAP THE TARGET TO DIVE" ] ], [ [ "Tip: If the opponent shots\\n a slow shot, tap a bit later." ] ], [ [ "All rights reserved. Unauthorized copying, modification, or distribution of this game's content is strictly prohibited." ] ], [ [ "" ] ] ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412// @ts-check'use strict';
class GltfData{
constructor(runtime, sdkType) { this._runtime = runtime; this._sdkType = sdkType; this.gltf = {}; this.dynamicTexturesLoaded = false; this.imageBitmap = {}; }
/* Requests an url as a json file, then does some processing on that, and finally calls a js or c2 function. Expects an "embeded" gltf file. */ async load(gltfPath, isRuntime, debug) { let runtime = this._runtime; let sdkType = this._sdkType;
let gltfURI; if (isRuntime) { gltfURI = await runtime.GetAssetManager().GetProjectFileUrl(gltfPath); } else { if (gltfPath.includes('http')) { // Can't load from URL in editor alert('Cannot load from URL in editor'); return false } else { // Get iProjectFiles gltfURI = await runtime.GetProjectFileByExportPath(gltfPath); } }
if (gltfURI === null) { alert('gltfPath not found: ' + gltfPath); console.warn('glfPath not found:', gltfPath) return false }
const isBinary = gltfPath.includes(".glb") || gltfPath.includes("ext=glb");
let resultgltf
try { resultgltf = await this.loadGLTF(gltfURI, isRuntime, debug, isBinary); } catch( err ) { console.error('Error loading GLTF:',err) return false }
if (resultgltf) { if (debug) console.info('[3DObject] modelData:', resultgltf); sdkType.dataLoaded = true; } else { console.warn('[3DObject] Unable to load gltf files'); alert('Unable to load gltf files'); return false; }
this.gltf = resultgltf; return true; }
/* Once the gltf file is loaded as a json this does a few things to it to make out lives easier. 1. It converts the buffers from base64 to a typed array. 2. The accessors are then made as typed views of the buffers. 3. All the places where indexes are used are changed to look at those objects themselves. 4. Adds some properties that are optionally in the gltf file. 5. Adds a few properties that are utilized when getting data from skinning.*/ async loadGLTF(uri, isRuntime, debug, isBinary) { let gltf; let binBuffer;
if (isRuntime) { if (isBinary) { let response = await fetch(uri); let buffer = await response.arrayBuffer() const magic = new DataView(buffer.slice(0, 4)).getUint32(0, true); const version = new DataView(buffer.slice(4, 8)).getUint32(0, true); const jsonBufSize = new DataView(buffer.slice(12, 16)).getUint32(0, true);
let utf8decoder = new TextDecoder() let jsonString = utf8decoder.decode(buffer.slice(20, 20 + jsonBufSize)); gltf = JSON.parse(jsonString); binBuffer = buffer.slice(jsonBufSize + 28); } else { try { let response = await fetch(uri); let text = await response.text(); gltf = JSON.parse(text); } catch(err) { console.error('[3DShape], cannot fetch/parse gltf', uri); return false; } } } else { if (isBinary) { try { let projectFile = await uri.GetBlob(); if (!projectFile) return false; let buffer = await projectFile.arrayBuffer(); // if (!buffer) return false; const magic = new DataView(buffer.slice(0, 4)).getUint32(0, true); const version = new DataView(buffer.slice(4, 8)).getUint32(0, true); const jsonBufSize = new DataView(buffer.slice(12, 16)).getUint32(0, true);
let utf8decoder = new TextDecoder() let jsonString = utf8decoder.decode(buffer.slice(20, 20 + jsonBufSize)); gltf = JSON.parse(jsonString); binBuffer = buffer.slice(jsonBufSize + 28); } catch(err) { console.error('[3DShape], cannot fetch/parse gltf blob', err); return false; }
} else { try { let projectFile = await uri.GetBlob(); if (!projectFile) return false; let text = await projectFile.text(); if (!text) return false; gltf = JSON.parse(text); } catch(err) { console.error('[3DShape], cannot fetch/parse gltf blob', uri); return false; } } }
if (!gltf) return false;
//extra variable for a list of skinned meshes. They need to be transformed after the rest. gltf.skinnedNodes = []; // buffers for(let i = 0; i < gltf.buffers.length; i++) // convert to typed arrays. { if (isBinary) { gltf.buffers[i] = new Uint8Array(binBuffer).buffer; } else { let base64 = gltf.buffers[i].uri.slice(37) // @ts-ignore gltf.buffers[i] = Uint8Array.from(atob(base64), c=>c.charCodeAt(0)).buffer; } } // accessors for(let i =0; i < gltf.accessors.length;i++) { let a = gltf.accessors[i]; let buftype = null; switch(a.componentType) { case 5120: buftype=Int8Array; break; case 5121: buftype=Uint8Array; break; case 5122: buftype=Int16Array; break; case 5123: buftype=Uint16Array; break; case 5125: buftype=Uint32Array; break; case 5126: buftype=Float32Array; break; default: console.error("error: gltf, unhandled componentType"); } let compcount = {"SCALAR":1, "VEC2":2, "VEC3":3, "VEC4":4, "MAT2":4, "MAT3":9, "MAT4":16}[a.type]; let bufview = gltf.bufferViews[a.bufferView];
// Check for case where there is no byteOffset prop, which means byteOffset is 0. if (!('byteOffset' in bufview)) bufview.byteOffset = 0;
if ('byteStride' in bufview) { const stride = bufview.byteStride; const offset = a.byteOffset || 0; const view = new DataView(gltf.buffers[bufview.buffer]); // @ts-ignore a.data = new buftype(compcount*a.count); for(let j = 0; j < a.count; j++) { for(let k = 0; k < compcount; k++) { a.data[j*compcount+k] = view.getFloat32(bufview.byteOffset + stride*j + offset + k*4, true); } } } else { // @ts-ignore a.data = new buftype(gltf.buffers[bufview.buffer], bufview.byteOffset, compcount*a.count); } } // scene if (typeof gltf.scene === 'undefined') gltf.scene = 0; gltf.scene = gltf.scenes[gltf.scene]; // scenes for(let i =0; i<gltf.scenes.length; i++) { let s = gltf.scenes[i]; for(let j = 0; j < s.nodes.length; j++) s.nodes[j] = gltf.nodes[s.nodes[j]]; } // nodes for(let i = 0; i < gltf.nodes.length; i++) { let n = gltf.nodes[i]; if(n.translation == undefined) n.translation = [0,0,0]; if(n.scale == undefined) n.scale = [1,1,1]; if(n.rotation == undefined) n.rotation = [0,0,0,1]; if(n.matrix == undefined) n.matrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; if(n.mesh != undefined) n.mesh = gltf.meshes[n.mesh]; if(n.skin != undefined) { n.skin = gltf.skins[n.skin]; n.invMatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; gltf.skinnedNodes.push(n); } if(n.children != undefined) for(let j = 0; j < n.children.length; j++) n.children[j] = gltf.nodes[n.children[j]]; } // animations if (gltf.animations) { for(let i = 0; i < gltf.animations.length; i++) { let a = gltf.animations[i]; for(let j = 0; j < a.channels.length; j++) { let c = a.channels[j]; c.sampler = a.samplers[c.sampler]; c.target.node = gltf.nodes[c.target.node]; } for(let j = 0; j < a.samplers.length; j++) { let s = a.samplers[j]; s.input = gltf.accessors[s.input]; s.output = gltf.accessors[s.output]; } } }
// images if (('images' in gltf) && (gltf.images.length > 0)) { for(let ii=0;ii<gltf.textures.length;ii++) { let t = gltf.textures[ii]; t.wrapS = 'repeat'; t.wrapT = 'repeat'; if (t.source != undefined && gltf.samplers != undefined && t.sampler != undefined) { const sampler = gltf.samplers[t.sampler]; const wrapS = sampler.wrapS; const wrapT = sampler.wrapT; switch (wrapS) { case 33071: t.wrapS = 'clamp-to-edge'; break; case 33648: t.wrapS = 'mirror-repeat'; break; case 10497: t.wrapS = 'repeat'; break; default: t.wrapS = 'repeat'; } switch (wrapT) { case 33071: t.wrapT = 'clamp-to-edge'; break; case 33648: t.wrapT = 'mirror-repeat'; break; case 10497: t.wrapT = 'repeat'; break; default: t.wrapT = 'repeat'; } } } for(let i = 0; i < gltf.images.length; i++) { // If image has no name, set it to the index. if (!('name' in gltf.images[i])) gltf.images[i].name = 'image-index-' + i; const image = gltf.images[i] let blob; if ('bufferView' in image) { const bufview = gltf.bufferViews[image.bufferView] let imageBuffer; if (binBuffer) { imageBuffer = binBuffer.slice(bufview.byteOffset, bufview.byteOffset + bufview.byteLength) } else { imageBuffer = gltf.buffers[0].slice(bufview.byteOffset, bufview.byteOffset + bufview.byteLength) } blob = await new Blob( [ imageBuffer ] ); } else { if (image.uri.startsWith('data:')) { const commaIdx = image.uri.indexOf(','); const base64 = image.uri.substring(commaIdx + 1); const binary = atob(base64); const array = new Uint8Array(binary.length); for(let i = 0; i < binary.length; i++) array[i] = binary.charCodeAt(i); const mime = image.uri.substring(5, commaIdx).split(';')[0]; blob = new Blob([array], {type: mime}); } else { blob = await (await fetch(image.uri)).blob(); } } let imageBitmap; // @ts-ignore if (globalThis.createImageBitmap) { imageBitmap = await createImageBitmap(blob); } else { imageBitmap = await this.createImageBitmap(blob); } // this.imageBitmap.push(imageBitmap) this.imageBitmap[image.name] = imageBitmap; const texture = gltf.textures.find(t => t.source == i); this.imageBitmap[image.name].wrapS = texture.wrapS; this.imageBitmap[image.name].wrapT = texture.wrapT; } }
//meshes for(let i = 0; i < gltf.meshes.length; i++) { let m = gltf.meshes[i]; for(let j = 0; j < m.primitives.length; j++) { let p = m.primitives[j]; p.indices = gltf.accessors[p.indices]; if (typeof(p.material) != 'undefined' && p.material != null) { p.material = gltf.materials[p.material]; // Set material name to image name // Might be redundant, but it's a good idea to have a name for the material const hasTexture = ('baseColorTexture' in p.material.pbrMetallicRoughness) if (hasTexture) { const textureIndex = p.material.pbrMetallicRoughness.baseColorTexture.index const imageIndex = gltf.textures[textureIndex].source p.material.name = gltf.images[imageIndex].name; } } Object.keys(p.attributes).forEach(function(key){ p.attributes[key] = gltf.accessors[p.attributes[key]]; });
// For ease of use point directly to the accessor data if ('targets' in p) { for(let k = 0; k < p.targets.length; k++) { Object.keys(p.targets[k]).forEach(function(key){ p.targets[k][key] = gltf.accessors[p.targets[k][key]]; }); } } } } //skins if (gltf.skins) { for(let i = 0; i < gltf.skins.length; i++) { let s = gltf.skins[i]; s.inverseBindMatrices = gltf.accessors[s.inverseBindMatrices]; // for(let j in s.joints) for(let j=0;j<s.joints.length;j++) { s.joints[j] = gltf.nodes[s.joints[j]]; s.joints[j].invBindMatrix = s.inverseBindMatrices.data.subarray(j*16, j*16+16); s.joints[j].boneMatrix = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; } } } // Create white texture const whitePNGURI ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAFElEQVR42mP8/58BL2AcVTCSFAAA0rYf8R32RV0AAAAASUVORK5CYII="; const whitePNG = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAFElEQVR42mP8/58BL2AcVTCSFAAA0rYf8R32RV0AAAAASUVORK5CYII="; const binary = atob(whitePNG); const array = new Uint8Array(binary.length); for(let i = 0; i < binary.length; i++) array[i] = binary.charCodeAt(i); const blob = new Blob([array], {type: "image/png"}); // @ts-ignore if (globalThis.createImageBitmap) { this.whiteImageBitmap = await createImageBitmap(blob); } else { this.whiteImageBitmap = await this.createImageBitmap(blob); }
return gltf }
/* Safari and Edge polyfill for createImageBitmap * https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap */ async createImageBitmap(blob) { return new Promise((resolve,reject) => { let img = document.createElement('img'); img.addEventListener('load', function() { resolve(this); }); img.src = URL.createObjectURL(blob); }); }}
// @ts-ignoreglobalThis.GltfData = GltfData;12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028// @ts-check'use strict';class GltfModel{ constructor(runtime, sdkType, inst) { const mat4 = globalThis.glMatrix3D.mat4;
this._runtime = runtime; this._sdkType = sdkType; this.inst = inst; this.gltfData = {}; this._blendState = 'init'; this._lastTarget = new Array(2); this._lastTarget[0] = []; this._lastTarget[1] = []; this._lastTargetIndex = 0; this._blendTarget = []; this._blendTime = 0; this._lastIndex = 0; this.drawMeshes = []; this.drawMeshesIndex = 0; this.currentColor = [-1,-1,-1,-1]; this.nodeMeshMap = {}; this.modelRotate = mat4.create(); this.meshNames = new Map() this.viewPos = [0,0,0] }
async init() { // Deep copy // For instance version, may only need points, others remain stable, full copy for now this._sdkType.gltfData.gltf.buffers = null; this.gltfData = await this.structuralClone(this._sdkType.gltfData.gltf) if ('buffers' in this.gltfData) { this.gltfData.buffers = null } if ('imageBitmap' in this.gltfData) { this.gltfData.imageBitmap = null } // Create node mesh map for (let ii=0; ii<this.gltfData.nodes.length; ii++) { let node = this.gltfData.nodes[ii]; if (!node.mesh) continue; this.nodeMeshMap[node.name] = node.mesh.name; } this.getPolygons(); if (!this.inst.isEditor) this.inst.initBoundingBox() }
release() { this._runtime = null; this._sdkType = null; this.inst = null; // @ts-ignore this.gltfData = null; // @ts-ignore this._blendState = null; // @ts-ignore this._lastTarget = null; // @ts-ignore this._blendTarget = null; // @ts-ignore this._blendTime = null; // @ts-ignore this._lastIndex = null; // @ts-ignore this.drawMeshes = null; // @ts-ignore this.drawMeshesIndex = null; // @ts-ignore this.currentColor = null; // @ts-ignore this.nodeMeshMap = null; this.modelRotate = null; // @ts-ignore this.meshNames = null // @ts-ignore this.verts = null; // @ts-ignore this.updateDrawVerts = null; } structuralClone(obj) { return new Promise(resolve => { const {port1, port2} = new MessageChannel(); port2.onmessage = ev => resolve(ev.data); port1.postMessage(obj); }); }
_smoothstep (min, max, value) { var x = Math.max(0, Math.min(1, (value-min)/(max-min))); return x*x*(3 - 2*x); };
render(renderer, x, y, z, tempQuad, whiteTexture, instanceC3Color, textures, instanceTexture) { let totalTriangles = 0; let currentColor = [-1,-1,-1,-1]; let currentTexture = null; const lightEnable = this.inst.lightEnable
const vec4 = globalThis.glMatrix3D.vec4; const vec3 = globalThis.glMatrix3D.vec3; const mat4 = globalThis.glMatrix3D.mat4; const quat = globalThis.glMatrix3D.quat;
let xWireframeWidth, yWireframeWidth, zWireframeWidth;
if (this.inst.wireframe) { const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale);
xWireframeWidth = this.inst.isEditor || this.inst.cpuXform ? this.inst.xWireframeWidth : this.inst.xWireframeWidth/xScale; yWireframeWidth = this.inst.isEditor || this.inst.cpuXform ? this.inst.yWireframeWidth : this.inst.yWireframeWidth/yScale; zWireframeWidth = this.inst.isEditor || this.inst.cpuXform ? this.inst.zWireframeWidth : this.inst.zWireframeWidth/zScale; }
const instanceColor = [instanceC3Color.getR(), instanceC3Color.getG(), instanceC3Color.getB(), instanceC3Color.getA()]; const finalColor = vec4.create();
const tmpModelView = mat4.create(); const modelRotate = mat4.create(); if (!this.inst.isEditor) { mat4.copy(tmpModelView, renderer._matMV); const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale); const rotate = quat.create(); if (this.inst.cannonBody && this.inst.cannonSetRotation) { quat.set(rotate, this.inst.cannonBody.quaternion.x, this.inst.cannonBody.quaternion.y, this.inst.cannonBody.quaternion.z, this.inst.cannonBody.quaternion.w); } else { quat.fromEuler(rotate, xAngle, yAngle, zAngle); } mat4.fromRotationTranslationScale(modelRotate, rotate, [x,y,z], [xScale,-yScale,zScale]); mat4.copy(this.modelRotate, modelRotate); mat4.multiply(modelRotate, tmpModelView, modelRotate); renderer.SetModelViewMatrix(modelRotate); }
// Default color renderer.SetColor(instanceC3Color); vec4.copy(currentColor, instanceColor); let baseColorChanged = false; if (!vec4.equals(currentColor, [1,1,1,1])) baseColorChanged = true;
for (let j=0; j<= this.drawMeshesIndex; j++) { // Skip render if disabled if (this.drawMeshes[j].disabled) continue;
const drawVerts = this.drawMeshes[j].drawVerts; const drawUVs = this.drawMeshes[j].drawUVs; const drawIndices = this.drawMeshes[j].drawIndices; const drawLights = this.drawMeshes[j].drawLights; const material = this.drawMeshes[j].material; const hasTexture = (material && 'pbrMetallicRoughness' in material && 'baseColorTexture' in material.pbrMetallicRoughness); const offsetUV = this.drawMeshes[j].offsetUV; const materialsModify = this.inst.materialsModify; const offsetMaterial = materialsModify.has(material?.name) && materialsModify.get(material?.name)?.offsetUV; const rotateMaterial = materialsModify.has(material?.name) && materialsModify.get(material?.name)?.rotateUV; const lightUpdate = this.inst.lightUpdate || (drawLights.length == 0)
// Check if the map this.inst.materialsModify contains the key material.name // If it does, then we need to offset the UVs
let color; if (material && 'pbrMetallicRoughness' in material && 'baseColorFactor' in material.pbrMetallicRoughness) { color = material.pbrMetallicRoughness.baseColorFactor } else { color = null; } if (color && color.length == 4) { color[3] = 1; vec4.multiply(finalColor, instanceColor, color); if (vec4.equals(finalColor, currentColor) == false) { vec4.copy(currentColor, finalColor); renderer.SetColorRgba(finalColor[0], finalColor[1], finalColor[2], finalColor[3]); baseColorChanged = true } }
if (!instanceTexture) { if (!hasTexture) { if (currentTexture != whiteTexture) { renderer.SetTexture(whiteTexture); currentTexture = whiteTexture; } } else { const texture = textures[material.name]; // If texture is not loaded, skip rendering if (!texture) continue; if (texture != currentTexture) { renderer.SetTexture(texture); currentTexture = texture; } } }
// Create const for mat2 const mat2 = globalThis.glMatrix3D.mat2; const vec2 = globalThis.glMatrix3D.vec2; let rotateMatrix;
if (rotateMaterial) { const rotateUV = materialsModify.get(material.name)?.rotateUV; // Create rotate matrix rotateMatrix = mat2.create(); mat2.fromRotation(rotateMatrix, rotateUV.angle); }
if (lightUpdate) { drawLights.length = 0 } for (let ii=0; ii<drawVerts.length; ii++) { let v = drawVerts[ii]; let uv = drawUVs[ii]; let ind = drawIndices[ii];
let triangleCount = ind.length/3; let center = [0,0,0]; totalTriangles += triangleCount; for(let i = 0; i<triangleCount; i++) { if (hasTexture) { if (offsetMaterial || rotateMaterial) { // create new arrays for the UVs const uvQuad = [ [uv[ind[i*3+0]*2+0], uv[ind[i*3+0]*2+1]], [uv[ind[i*3+1]*2+0], uv[ind[i*3+1]*2+1]], [uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1]] ]; if (rotateMaterial) { // Rotate UVs vec2.sub(uvQuad[0], uvQuad[0], [rotateMaterial.x, rotateMaterial.y]); vec2.sub(uvQuad[1], uvQuad[1], [rotateMaterial.x, rotateMaterial.y]); vec2.sub(uvQuad[2], uvQuad[2], [rotateMaterial.x, rotateMaterial.y]); mat2.multiply(uvQuad[0], rotateMatrix, uvQuad[0]); mat2.multiply(uvQuad[1], rotateMatrix, uvQuad[1]); mat2.multiply(uvQuad[2], rotateMatrix, uvQuad[2]); vec2.add(uvQuad[0], uvQuad[0], [rotateMaterial.x, rotateMaterial.y]); vec2.add(uvQuad[1], uvQuad[1], [rotateMaterial.x, rotateMaterial.y]); vec2.add(uvQuad[2], uvQuad[2], [rotateMaterial.x, rotateMaterial.y]); }
if (offsetMaterial) { const uOffset = offsetMaterial.u; const vOffset = offsetMaterial.v; // Offset UVs in uvQuad uvQuad[0][0] += uOffset; uvQuad[0][1] += vOffset; uvQuad[1][0] += uOffset; uvQuad[1][1] += vOffset; uvQuad[2][0] += uOffset; uvQuad[2][1] += vOffset; } // Set tempquad tempQuad.set( uvQuad[0][0], uvQuad[0][1], uvQuad[1][0], uvQuad[1][1], uvQuad[2][0], uvQuad[2][1], uvQuad[2][0], uvQuad[2][1] ); } else if (offsetUV) { const uOffset = offsetUV.u; const vOffset = offsetUV.v; tempQuad.set( uv[ind[i*3+0]*2+0]+uOffset, uv[ind[i*3+0]*2+1]+vOffset, uv[ind[i*3+1]*2+0]+uOffset, uv[ind[i*3+1]*2+1]+vOffset, uv[ind[i*3+2]*2+0]+uOffset, uv[ind[i*3+2]*2+1]+vOffset, uv[ind[i*3+2]*2+0]+uOffset, uv[ind[i*3+2]*2+1]+vOffset ); } else { tempQuad.set( uv[ind[i*3+0]*2+0], uv[ind[i*3+0]*2+1], uv[ind[i*3+1]*2+0], uv[ind[i*3+1]*2+1], uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1], uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1] ); } } else { // Set face to color if possible tempQuad.set(0,0,1,0,0,1,0,1); } let i3 = i*3; let x0, y0, z0, x1, y1, z1, x2, y2, z2;
x0 = (v[ind[i3+0]*3+0]); y0 = (v[ind[i3+0]*3+1]); z0 = (v[ind[i3+0]*3+2])-z; x1 = (v[ind[i3+1]*3+0]); y1 = (v[ind[i3+1]*3+1]); z1 = (v[ind[i3+1]*3+2])-z; x2 = (v[ind[i3+2]*3+0]); y2 = (v[ind[i3+2]*3+1]); z2 = (v[ind[i3+2]*3+2])-z;
let colorSum if (lightUpdate) colorSum = vec4.create()
if (this.inst.wireframe) { this.drawWireFrame(renderer, whiteTexture, tempQuad, x0, y0, z0, x1, y1, z1, x2, y2, z2, xWireframeWidth, yWireframeWidth, zWireframeWidth); } else { if (lightEnable && lightUpdate) {
const normal = vec3.create() const viewDir = vec3.create() const v0 = vec3.fromValues(x0,y0,z0+z) const v1 = vec3.fromValues(x1,y1,z1+z) const v2 = vec3.fromValues(x2,y2,z2+z)
vec3.transformMat4(v0, v0, this.modelRotate); vec3.transformMat4(v1, v1, this.modelRotate); vec3.transformMat4(v2, v2, this.modelRotate); const c = vec3.clone(v0) vec3.add(c,c,v1) vec3.add(c,c,v2) vec3.div(c,c,[3,3,3])
vec3.cross(normal, [v1[0]-v0[0], v1[1]-v0[1], v1[2]-v0[2]], [v2[0]-v0[0], v2[1]-v0[1], v2[2]-v0[2]]) vec3.normalize(normal, normal)
for (const light of Object.values(this.inst.lights)) { if (!light.enable) continue const l = light.pos const enableSpot = light.enableSpot const enableSpecular = light.enableSpecular const spotDir = light.spotDir const cutoff = light.cutoff const edge = light.edge const color = light.color const lightDir = vec3.fromValues(c[0]-l[0], c[1]-l[1], c[2]-l[2]) const distance = vec3.length(lightDir) const attConstant = light.attConstant const attLinear = light.attLinear const attSquare = light.attSquare vec3.normalize(lightDir, lightDir) let dot = vec3.dot(normal, lightDir) * 0.5 + 0.5 let att = 1.0; let specular = 0.0 if (enableSpot) { const spotDirN = vec3.clone(spotDir) vec3.normalize(spotDirN, spotDir) att = vec3.dot(spotDirN, lightDir); if (att < cutoff) { att = this._smoothstep(cutoff*(1-edge),cutoff, att); } else { att = 1.0; } } if (enableSpecular) { vec3.sub(viewDir, this.inst.viewPos, c) vec3.normalize(viewDir, viewDir) const reflectDir = vec3.create() const dotNI = vec3.create() vec3.dot(dotNI, normal, lightDir) vec3.scale(dotNI, dotNI, 2.0) vec3.mul(dotNI, dotNI, normal) vec3.sub(reflectDir,dotNI,lightDir) // I - 2.0 * dot(N, I) * N. vec3.sub(reflectDir, lightDir, normal) vec3.normalize(reflectDir, reflectDir) const spec = Math.pow(Math.max(vec3.dot(reflectDir, viewDir), 0.0), light.specularPower); specular = light.specularAtt * spec; } att = att / (1.0 * attConstant + distance * attLinear + distance * distance * attSquare); att = att + specular dot = dot * dot * att vec4.add(colorSum, colorSum, [dot*color[0], dot*color[1], dot*color[2], dot*color[3]]) } // Add ambient color to colorSum vec4.add(colorSum, colorSum, this.inst.ambientColor) // Clamp color colorSum[0] = colorSum[0] < 0.0 ? 0.0 : colorSum[0] > 1.0 ? 1.0 : colorSum[0] colorSum[1] = colorSum[1] < 0.0 ? 0.0 : colorSum[1] > 1.0 ? 1.0 : colorSum[1] colorSum[2] = colorSum[2] < 0.0 ? 0.0 : colorSum[2] > 1.0 ? 1.0 : colorSum[2] colorSum[3] = colorSum[3] < 0.0 ? 0.0 : colorSum[3] > 1.0 ? 1.0 : colorSum[3]
drawLights.push(colorSum) } if (lightEnable) { const c = drawLights[i] if (baseColorChanged) vec4.mul(c, c, currentColor) renderer.SetColorRgba(c[0], c[1], c[2], 1) } renderer.Quad3D2( x0, y0, z0, x1, y1, z1, x2, y2, z2, x2, y2, z2, tempQuad, true ); } } } } // Restore modelview matrix if (!(this.inst.isEditor || this.inst.cpuXform)) { renderer.SetModelViewMatrix(tmpModelView); } this.inst.totalTriangles = totalTriangles; }
/* Updates a node's matrix and all it's children nodes. After that it transforms unskinned mesh points and sends them to c2. */ transformNode(node, parentMat, modelScaleRotate) { // @ts-ignore const mat4 = globalThis.glMatrix3D.mat4; // @ts-ignore const quat = globalThis.glMatrix3D.quat; // @ts-ignore const vec3 = globalThis.glMatrix3D.vec3; const gltf = this.gltfData; let dummyMat4Out = mat4.create();
const scale = this.inst.scale; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale);
if(parentMat != undefined) mat4.copy(node.matrix, parentMat); // mat4.set(parentMat, node.matrix); else mat4.identity(node.matrix); mat4.translate(node.matrix, node.matrix, node.translation); // mat4.translate(node.matrix, node.translation); mat4.multiply(node.matrix, node.matrix, mat4.fromQuat(dummyMat4Out, node.rotation)); // mat4.multiply(node.matrix, quat4.toMat4(node.rotation)); mat4.scale(node.matrix, node.matrix, node.scale); // mat4.scale(node.matrix, node.scale); if(node.skin != undefined) mat4.invert(node.invMatrix, node.matrix); // mat4.inverse(node.matrix, node.invMatrix); // unskinned meshes if(node.mesh != undefined && node.skin == undefined) {
for(let i = 0; i < node.mesh.primitives.length; i++) { let transformedVerts = []; transformedVerts.length = 0; let posData = node.mesh.primitives[i].attributes.POSITION.data; const weights = node.mesh.weights
let morphActive = false; let morphTargets = null; let morphWeights = null; if (node.weights || node.morphWeights) { if (!node.weights) node.weights = new Float32Array(node.mesh.primitives[i].targets.length); morphActive = true; morphTargets = node.mesh.primitives[i].targets; morphWeights = [...node.weights]; if(node.morphWeights) { for(let j = 0; j < morphWeights.length; j++) { if (node.morphWeights.has(j)) morphWeights[j] = node.morphWeights.get(j); } } } this.drawMeshesIndex++; if (!this.drawMeshes[this.drawMeshesIndex]) { this.drawMeshes.push( { drawVerts: [], drawUVs: [], drawIndices: [], drawLights: [], disabled: false, morphWeights: null, } ) this.meshNames.set(node.name, this.drawMeshesIndex) }
this.drawMeshes[this.drawMeshesIndex].disabled = node.disabled; if (node.offsetUV) this.drawMeshes[this.drawMeshesIndex].offsetUV = node.offsetUV;
// Update material each time, in case an ACE changes it if ('material' in node.mesh.primitives[i]) { this.drawMeshes[this.drawMeshesIndex].material = node.mesh.primitives[i].material; } else { this.drawMeshes[this.drawMeshesIndex].material = null; }
const drawVerts = this.drawMeshes[this.drawMeshesIndex].drawVerts; const drawUVs = this.drawMeshes[this.drawMeshesIndex].drawUVs; const drawIndices = this.drawMeshes[this.drawMeshesIndex].drawIndices;
// reset draw array for new values drawVerts.length = 0; let v = [0,0,0];
for(let j=0; j<posData.length/3; j++) { let vin = posData.subarray(j*3, j*3+3); if (morphActive) { vin = this.morphTargets(vin, j, morphWeights, morphTargets); } vec3.transformMat4(v, vin, node.matrix);
// vec3.transformMat4(v, vv, node.matrix); // mat4.multiplyVec3(node.matrix, posData.subarray(j*3, j*3+3), v);
if (this.inst.isEditor || this.inst.cpuXform) { vec3.transformMat4(v, v, modelScaleRotate); }
const x = v[0] const y = v[1] const z = v[2]
if (this.inst.minBB[0] > x) this.inst.minBB[0] = x if (this.inst.minBB[1] > y) this.inst.minBB[1] = y if (this.inst.minBB[2] > z) this.inst.minBB[2] = z if (this.inst.maxBB[0] < x) this.inst.maxBB[0] = x if (this.inst.maxBB[1] < y) this.inst.maxBB[1] = y if (this.inst.maxBB[2] < z) this.inst.maxBB[2] = z
transformedVerts.push(x,y,z); }
if(transformedVerts.length > 0) { if(gltf.pointBatch != undefined) for(let ii = 0; ii < transformedVerts.length; ii++) gltf.pointBatch.push(transformedVerts[ii]); else { drawVerts.push(transformedVerts); // Only need to set once if (drawUVs.length === 0 && ('TEXCOORD_0' in node.mesh.primitives[i].attributes)) { drawUVs.push(Array.from(node.mesh.primitives[i].attributes.TEXCOORD_0.data)); } if (drawIndices.length === 0) drawIndices.push(Array.from(node.mesh.primitives[i].indices.data)); } } } } if(node.children != undefined) for(let i = 0; i < node.children.length; i++) this.transformNode(node.children[i], node.matrix, modelScaleRotate); }
morphTargets(vin, index, weights, targets) { const vec3 = globalThis.glMatrix3D.vec3; const vout = vec3.create(); vec3.copy(vout, vin); for (let i = 0; i < targets.length; i++) { const w = weights[i]; if (w == 0) continue; const v = targets[i].POSITION.data.subarray(index * 3, index * 3 + 3); vec3.scaleAndAdd(vout, vout, v, w); } return vout; }
// Updates scene graph, and as a second step sends transformed skinned mesh points to c2. getPolygons() { // @ts-ignore const vec3 = globalThis.glMatrix3D.vec3; // @ts-ignore const mat4 = globalThis.glMatrix3D.mat4; // @ts-ignore const quat = globalThis.glMatrix3D.quat; const gltf = this.gltfData; const scale = this.inst.scale; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale); this.drawMeshesIndex = -1;
const modelScaleRotate = mat4.create();
if (this.inst.isEditor || this.inst.cpuXform) { const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle;
const x = this.inst.isEditor ? this.inst._inst.GetX() : this.inst.GetWorldInfo().GetX() ; const y = this.inst.isEditor ? this.inst._inst.GetY() : this.inst.GetWorldInfo().GetY() ; const z = this.inst.isEditor ? this.inst._inst.GetZElevation() : this.inst.GetWorldInfo().GetZElevation();
const rotate = quat.create(); quat.fromEuler(rotate, xAngle, yAngle, zAngle); mat4.fromRotationTranslationScale(modelScaleRotate, rotate, [x,y,z], [xScale,-yScale,zScale]); } let rotationQuat = quat.create(); let parentMatrix = mat4.create();
quat.fromEuler(rotationQuat, 0, 0, 0);
mat4.fromRotationTranslation(parentMatrix, rotationQuat, [0,0,0])
this.inst.minBB = [Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]; this.inst.maxBB = [Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];
// update all scene matrixes. for(let i = 0; i < gltf.scene.nodes.length; i++) { this.transformNode(gltf.scene.nodes[i], parentMatrix, modelScaleRotate); } quat.fromEuler(rotationQuat, 0, 0, 0);
// Check if the gltf scene root node has a rotation, translation or scale const rootNode = gltf?.scene?.nodes[0] let rootNodeXform = false if (rootNode && (rootNode.rotation || rootNode.translation || rootNode.scale)) { if (!rootNode.rotation) rootNode.rotation = quat.create(); if (!rootNode.translation) rootNode.translation = vec3.create(); if (!rootNode.scale) rootNode.scale = vec3.fromValues(1,1,1);
mat4.fromRotationTranslationScale(parentMatrix, rootNode.rotation, rootNode.translation, rootNode.scale) rootNodeXform = true }
for(let ii = 0; ii < gltf.skinnedNodes.length; ii++) { let node = gltf.skinnedNodes[ii]; //update bone matrixes for(let jj = 0; jj < node.skin.joints.length; jj++) { let joint = node.skin.joints[jj]; mat4.multiply(joint.boneMatrix, node.invMatrix, joint.matrix); // mat4.multiply(node.invMatrix, joint.matrix, joint.boneMatrix); mat4.multiply(joint.boneMatrix, joint.boneMatrix, joint.invBindMatrix); // mat4.multiply(joint.boneMatrix, joint.invBindMatrix); } for(let i = 0; i < node.mesh.primitives.length; i++) { this.drawMeshesIndex++; if (!this.drawMeshes[this.drawMeshesIndex]) { this.drawMeshes.push( { drawVerts: [], drawUVs: [], drawIndices: [], drawLights: [], disabled: true, } ) this.meshNames.set(node.name, this.drawMeshesIndex) }
let morphActive = false; let morphTargets = null; let morphWeights = null;
if (node.weights || node.morphWeights) { if (!node.weights) node.weights = new Float32Array(node.mesh.primitives[i].targets.length); morphActive = true; morphTargets = node.mesh.primitives[i].targets; morphWeights = [...node.weights]; if(node.morphWeights) for(let j = 0; j < morphWeights.length; j++) { if (node.morphWeights.has(j)) morphWeights[j] = node.morphWeights.get(j); } } this.drawMeshes[this.drawMeshesIndex].disabled = node.disabled; if (node.offsetUV) this.drawMeshes[this.drawMeshesIndex].offsetUV = node.offsetUV;
// Update material each time, in case an ACE changes it if ('material' in node.mesh.primitives[i]) { this.drawMeshes[this.drawMeshesIndex].material = node.mesh.primitives[i].material; } else { this.drawMeshes[this.drawMeshesIndex].material = null; }
const drawVerts = this.drawMeshes[this.drawMeshesIndex].drawVerts; const drawUVs = this.drawMeshes[this.drawMeshesIndex].drawUVs; const drawIndices = this.drawMeshes[this.drawMeshesIndex].drawIndices;
// reset draw array for new values drawVerts.length = 0; let transformedVerts = [];
let posData = node.mesh.primitives[i].attributes.POSITION.data; let weights = node.mesh.primitives[i].attributes.WEIGHTS_0.data; let joints = node.mesh.primitives[i].attributes.JOINTS_0.data; for(let j=0; j<posData.length/3; j++) { let w = weights.subarray(j*4, j*4+4); let b = joints.subarray(j*4, j*4+4); let vin = posData.subarray(j*3, j*3+3) let v = [0,0,0], vsum = [0,0,0]; if (morphActive) { vin = this.morphTargets(vin, j, morphWeights, morphTargets); }
for(let i=0; i<4; i++) { vec3.transformMat4(v, vin, node.skin.joints[b[i]].boneMatrix); // mat4.multiplyVec3(node.skin.joints[b[i]].boneMatrix, vin, v); vec3.scale(v, v, w[i]); // vec3.scale(v, w[i]); vec3.add(vsum, vsum, v); // vec3.add(vsum, v); }
if (rootNodeXform) { // vec3.mul(vsum, vsum, rootNode.scale); vec3.transformMat4(vsum, vsum, parentMatrix); if (j==0) { } }
if (this.inst.isEditor || this.inst.cpuXform) { vec3.transformMat4(vsum, vsum, modelScaleRotate ); }
const x = vsum[0] const y = vsum[1] const z = vsum[2]
if (this.inst.minBB[0] > x) this.inst.minBB[0] = x if (this.inst.minBB[1] > y) this.inst.minBB[1] = y if (this.inst.minBB[2] > z) this.inst.minBB[2] = z if (this.inst.maxBB[0] < x) this.inst.maxBB[0] = x if (this.inst.maxBB[1] < y) this.inst.maxBB[1] = y if (this.inst.maxBB[2] < z) this.inst.maxBB[2] = z
transformedVerts.push(x,y,z); } if(transformedVerts.length > 0) { if(gltf.pointBatch != undefined) for(let ii = 0; ii < transformedVerts.length; ii++) gltf.pointBatch.push(transformedVerts[ii]); else { drawVerts.push(transformedVerts); // Only need to set once if (drawUVs.length === 0 && ('TEXCOORD_0' in node.mesh.primitives[i].attributes)) { drawUVs.push(Array.from(node.mesh.primitives[i].attributes.TEXCOORD_0.data)); } if (drawIndices.length === 0) drawIndices.push(Array.from(node.mesh.primitives[i].indices.data)); } } } } }
// sends a list of animation names to c2. getAnimationNames() { const gltf = this.gltfData; let names = []; if (!gltf.animations) return names; for(let i = 0; i <gltf.animations.length; i++) names.push(gltf.animations[i].name);
return names; }
drawWireFrame(renderer, whiteTexture, tempQuad, x0,y0,z0,x1,y1,z1, x2, y2,z2, xWidth, yWidth, zWidth ){ renderer.SetTexture(whiteTexture); tempQuad.set(0,0,1,0,0,1,0,1);
renderer.Quad3D2( x0, y0, z0, x0+xWidth, y0+yWidth, z0+zWidth, x1, y1, z1, x1+xWidth, y1+yWidth, z1+zWidth, tempQuad, true ); renderer.Quad3D2( x1, y1, z1, x1+xWidth, y1+yWidth, z1+zWidth, x2, y2, z2, x2+xWidth, y2+yWidth, z2+zWidth, tempQuad, true ); renderer.Quad3D2( x2, y2, z2, x2+xWidth, y2+yWidth, z2+zWidth, x0, y0, z0, x0+xWidth, y0+yWidth, z0+zWidth, tempQuad, true ); }
updateAnimationPolygons(index, time, onScreen, deltaTime) { this.updateAnimation(index, time, onScreen, deltaTime); if (onScreen) { this.getPolygons(); this.inst.runtime.UpdateRender(); this.inst.updateBbox = true } }
lerp( a, b, alpha ) { const value = a + alpha * (b-a); return value }
updateModelRotate(x,y,z) { // @ts-ignore const vec3 = globalThis.glMatrix3D.vec3; // @ts-ignore const mat4 = globalThis.glMatrix3D.mat4; // @ts-ignore const quat = globalThis.glMatrix3D.quat; const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale); const rotate = quat.create(); if (this.inst.cannonBody && this.inst.cannonSetRotation) { quat.set(rotate, this.inst.cannonBody.quaternion.x, this.inst.cannonBody.quaternion.y, this.inst.cannonBody.quaternion.z, this.inst.cannonBody.quaternion.w); } else { quat.fromEuler(rotate, xAngle, yAngle, zAngle); } mat4.fromRotationTranslationScale(this.modelRotate, rotate, [x,y,z], [xScale,-yScale,zScale]); }
// Updates animation at index to be at time. Is used to play animation. updateAnimation(index, time, onScreen, deltaTime) { // @ts-ignore const vec3 = globalThis.glMatrix3D.vec3; // @ts-ignore const quat = globalThis.glMatrix3D.quat; const gltf = this.gltfData; const animationBlend = this.inst.animationBlend; let anim = gltf.animations[index];
// Blend state machine switch(this._blendState) { case 'init': if (animationBlend != 0 && this._lastIndex != index) { this._blendState = 'blend' this._blendTime = 0; this._blendTarget = this._lastTarget[this._lastTargetIndex]; if (this._lastTargetIndex == 0) { this._lastTargetIndex = 1; } else { this._lastTargetIndex = 0; } this._lastIndex = index; } break; case 'blend': if (this._lastIndex != index) { this._blendState = 'blend' this._blendTime = 0; this._blendTarget = this._lastTarget[this._lastTargetIndex]; if (this._lastTargetIndex == 0) { this._lastTargetIndex = 1; } else { this._lastTargetIndex = 0; } this._lastIndex = index; break; } if (this._blendTime > animationBlend) { this._blendState = 'idle' break } this._blendTime += deltaTime break; case 'idle': if (this._lastIndex != index) { this._blendState = 'blend' this._blendTime = 0; this._blendTarget = this._lastTarget[this._lastTargetIndex]; if (this._lastTargetIndex == 0) { this._lastTargetIndex = 1; } else { this._lastTargetIndex = 0; } this._lastIndex = index; } break; default: console.warn('[3DObject] bad blend state:', this._blendState) }
this._lastTarget[this._lastTargetIndex] = []; for(let i = 0; i < anim.channels.length; i++) { let c = anim.channels[i]; let timeValues = c.sampler.input; let otherValues = c.sampler.output.data; let target = c.target; if (this.inst.animationLoop) { time = (time-timeValues.min[0])%(timeValues.max[0]-timeValues.min[0]) + timeValues.min[0]; // loop } else { if (time > timeValues.max[0]) { time = timeValues.max[0]-0.01; // Stop on max time if (!this.inst.animationFinished) { this.inst.animationFinished = true; this.inst.animationNameFinished = this.inst.animationName; // @ts-ignore this.inst.Trigger(self.C3.Plugins.Mikal_3DObject.Cnds.OnAnimationFinished); // @ts-ignore this.inst.Trigger(self.C3.Plugins.Mikal_3DObject.Cnds.OnAnimationNameFinished); } } } this.inst.currentAnimationTime = time;
// If not on screen no more animation required. if (!onScreen) continue
//time = Math.min(Math.max(time, timeValues.min[0]), timeValues.max[0]); //clamp timeValues = timeValues.data; //find index in timeline let t0, t1; for(t0=0, t1=1; t0<timeValues.length-1; t0++, t1++) if(time >= timeValues[t0] && time <= timeValues[t1]) break;
this.inst.currentAnimationFrame = t0;
let t = (time - timeValues[t0])/(timeValues[t1] - timeValues[t0]);
this.inst.currentAnimationFrame = Math.round(t0+t);
// Check if invalid state, if so, skip animation // TODO: Change how change animation vs tick is handled to make sure this case does not happen if (timeValues[t1] == null) break if(target.path == "translation") vec3.lerp(target.node.translation, otherValues.subarray(t0*3,t0*3+3), otherValues.subarray(t1*3,t1*3+3), t); else if(target.path == "rotation") quat.slerp(target.node.rotation, otherValues.subarray(t0*4,t0*4+4), otherValues.subarray(t1*4,t1*4+4), t); else if(target.path == "scale") vec3.lerp(target.node.scale, otherValues.subarray(t0*3,t0*3+3), otherValues.subarray(t1*3,t1*3+3), t); else if(target.path == "weights") { // Apply gltf morph target weights to node weights using lerp between two targets const node = target.node; node.weights = new Float32Array(node.mesh.primitives[0].targets.length); const weights = node.weights; const stride = weights.length for (let j = 0; j < stride; j++) { weights[j] = this.lerp(otherValues[t0*stride+j], otherValues[t1*stride+j], t); } }
// Blend to last animation if during blend if (this._blendState == 'blend') { const blend = this._blendTime == 0 ? 0 : this._blendTime/animationBlend; const blendTarget = this._blendTarget[i]; if (blendTarget != null) { if(target.path == "translation" && blendTarget.path == "translation") vec3.lerp(target.node.translation, blendTarget.node.translation, target.node.translation, blend); else if(target.path == "rotation" && blendTarget.path == "rotation") quat.slerp(target.node.rotation, blendTarget.node.rotation, target.node.rotation, blend); else if(target.path == "scale" && blendTarget.path == "scale") vec3.lerp(target.node.scale, blendTarget.node.scale, target.node.scale, blend); } }
if (animationBlend != 0) { const lastTarget = {}; lastTarget.node = {} if (target.path == "translation") { lastTarget.path = target.path; lastTarget.node.translation = vec3.clone(target.node.translation); } else if (target.path == "rotation") { lastTarget.path = target.path; lastTarget.node.rotation = quat.clone(target.node.rotation); } else if (target.path == "scale") { lastTarget.path = target.path; lastTarget.node.scale = vec3.clone(target.node.scale); } this._lastTarget[this._lastTargetIndex].push(lastTarget); } } }}
// @ts-ignoreglobalThis.GltfModel = GltfModel;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815// @ts-check'use strict';class GltfModelW{ constructor(runtime, sdkType, inst) { const mat4 = globalThis.glMatrix3D.mat4;
this._runtime = runtime; this._sdkType = sdkType; this.inst = inst; this.gltfData = {}; this._blendState = 'init'; this._lastTarget = []; this._blendTarget = []; this._blendTime = 0; this._lastIndex = 0; this.drawMeshes = []; this.drawMeshesIndex = 0; this.currentColor = [-1,-1,-1,-1]; this.nodeMeshMap = {}; this.modelRotate = mat4.create(); this.meshNames = new Map() this.msgPort = null; this.arrayBufferIndex = 0; this.buff = null; this.verts = new Float32Array(0); this.updateDrawVerts = false; this.activeNodes = []; this.drawLights = new Uint32Array(0); this.drawLightsBufferViews = null this.drawLightsEnable = false this.workerReady = false this.boundingBoxInit = false }
release() { if (this.msgPort) { this.msgPort.postMessage({type: 'release'}); this.msgPort.onmessage = null; this.msgPort.close(); } this._runtime = null; this._sdkType = null; this.inst = null; // @ts-ignore this.gltfData = null; // @ts-ignore this._blendState = null; // @ts-ignore this._lastTarget = null; // @ts-ignore this._blendTarget = null; // @ts-ignore this._blendTime = null; // @ts-ignore this._lastIndex = null; // @ts-ignore this.drawMeshes = null; // @ts-ignore this.drawMeshesIndex = null; // @ts-ignore this.currentColor = null; // @ts-ignore this.nodeMeshMap = null; this.modelRotate = null; // @ts-ignore this.meshNames = null this.msgPort = null; // @ts-ignore this.arrayBufferIndex = null; this.buff = null; // @ts-ignore this.verts = null; // @ts-ignore this.updateDrawVerts = null; // @ts-ignore this.activeNodes = null; }
async init() { // Deep copy // For instance version, may only need points, others remain stable, full copy for now this._sdkType.gltfData.gltf.buffers = null; this.gltfData = await this.structuralClone(this._sdkType.gltfData.gltf) if ('buffers' in this.gltfData) { this.gltfData.buffers = null } if ('imageBitmap' in this.gltfData) { this.gltfData.imageBitmap = null } // Create node mesh map for (let ii=0; ii<this.gltfData.nodes.length; ii++) { let node = this.gltfData.nodes[ii]; if (!node.mesh) continue; this.nodeMeshMap[node.name] = node.mesh.name; } // Create dedicdated web worker for skinned mesh animation this.initDrawMeshes(); this.drawMeshesMin = this.drawMeshes await this.createWorker(this._runtime) this.workerReady = true this.getPolygons() }
initDrawMeshes() { // For each mesh, create a drawMesh and initialize with UV, indices, name and material const gltf = this.gltfData this.drawMeshesIndex = -1; // update all scene meshes, except skinned meshes for(let i = 0; i < gltf.scene.nodes.length; i++) { this.scanNode(gltf.scene.nodes[i], false); } // skinned nodes for(let ii = 0; ii < gltf.skinnedNodes.length; ii++) { this.scanNode(gltf.skinnedNodes[ii], true); } }
scanNode(node, scanSkin) { if(node.mesh != undefined && node.skin == undefined || scanSkin) { for(let i = 0; i < node.mesh.primitives.length; i++) { let posDataLength = node.mesh.primitives[i].attributes.POSITION.data.length; this.drawMeshesIndex++; if (!this.drawMeshes[this.drawMeshesIndex]) { this.drawMeshes.push( { drawVerts: [], bufferViews: [], drawUVs: [], drawIndices: [], disabled: false, } ) } this.drawMeshes[this.drawMeshesIndex].bufferViews.push({start: this.arrayBufferIndex, length: posDataLength}) this.arrayBufferIndex += posDataLength; this.meshNames.set(node.name, this.drawMeshesIndex) this.drawMeshes[this.drawMeshesIndex].disabled = node.disabled; if (node.offsetUV) this.drawMeshes[this.drawMeshesIndex].offsetUV = node.offsetUV; if ('material' in node.mesh.primitives[i]) { this.drawMeshes[this.drawMeshesIndex].material = node.mesh.primitives[i].material; } else { this.drawMeshes[this.drawMeshesIndex].material = null; }
const drawUVs = this.drawMeshes[this.drawMeshesIndex].drawUVs; const drawIndices = this.drawMeshes[this.drawMeshesIndex].drawIndices;
if (drawUVs.length === 0 && ('TEXCOORD_0' in node.mesh.primitives[i].attributes)) { drawUVs.push(Array.from(node.mesh.primitives[i].attributes.TEXCOORD_0.data)); } if (drawIndices.length === 0) { drawIndices.push(Array.from(node.mesh.primitives[i].indices.data)); } } } if (node.children) { for (let ii=0; ii<node.children.length; ii++) { this.scanNode(node.children[ii]); } } }
async createWorker(runtime) { // Create the worker with the runtime.createWorker() method. // This must be awaited and resolves with a messagePort. let path = await runtime.GetAssetManager().GetProjectFileUrl("gltfWorker.js") this.msgPort = await runtime._iRuntime.createWorker(path); // Add an onmessage handler to receive message this.msgPort.onmessage = ((e) => { if (!e.data.type) { this.buff = e.data.buff; this.activeNodes = e.data.activeNodes; this.verts = new Float32Array(this.buff); if (e.data.lightUpdate) { this.buffLights = e.data.buffLights; this.drawLights = new Uint32Array(this.buffLights); this.drawLightsBufferViews = e.data.drawLightsBufferViews; } this.drawLightsEnable = e.data.drawLightsEnable; this.setBBFromVerts(this.verts, this.inst.minBB, this.inst.maxBB); this.inst.updateBbox = true; this.updateDrawVerts = true; this.typedVertsToDrawVerts() this.workerReady = true; if (!this.boundingBoxInit) { this.inst.initBoundingBox() this.boundingBoxInit = true; } } else if (e.data.type === "status") { this.buff = e.data.buff; if (e.data?.status?.workerReady) { this.workerReady = true; } } else { if (this.inst.debug) console.debug('onMsg t:',runtime.GetTickCount(), e.data.type) } }); // Send the gltfModel to the worker const bufferViews = this.drawMeshes[this.drawMeshes.length-1].bufferViews; const buffLength = bufferViews[bufferViews.length-1].start + bufferViews[bufferViews.length-1].length; this.buff = new ArrayBuffer((buffLength+7)*4) this.msgPort.postMessage({type: 'gltf', gltf: this.gltfData, buffLength: buffLength, drawMeshes: this.drawMeshes}); return { msgPort: this.msgPort } }
enableNode(nodeName, enable) { this.msgPort.postMessage({type: 'enableNode', nodeName: nodeName, enable: enable}); }
setNodeMorphWeight(nodeName, index, weight) { this.msgPort.postMessage({type: 'setNodeMorphWeight', nodeName, index, weight}); }
deleteNodeMorphWeight(nodeName, index) { this.msgPort.postMessage({type: 'deleteNodeMorphWeight', nodeName, index}); }
setBBFromVerts(verts, minBBox, maxBBox) { let l = verts.length-2 maxBBox[2] = verts[l--] maxBBox[1] = verts[l--] maxBBox[0] = verts[l--] minBBox[2] = verts[l--] minBBox[1] = verts[l--] minBBox[0] = verts[l--] } structuralClone(obj) { return new Promise(resolve => { const {port1, port2} = new MessageChannel(); port2.onmessage = ev => resolve(ev.data); port1.postMessage(obj); }); }
render(renderer, x, y, z, tempQuad, whiteTexture, instanceC3Color, textures, instanceTexture) { let currentColor = [-1,-1,-1,-1]; let currentTexture = null;
const vec4 = globalThis.glMatrix3D.vec4; const vec2 = globalThis.glMatrix3D.vec2; const mat2 = globalThis.glMatrix3D.mat2; const mat4 = globalThis.glMatrix3D.mat4; const quat = globalThis.glMatrix3D.quat; let totalTriangles = 0; let totalTrianglesCulled = 0
let xWireframeWidth, yWireframeWidth, zWireframeWidth;
if (this.inst.wireframe) { const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale);
xWireframeWidth = this.inst.isEditor ? this.inst.xWireframeWidth : this.inst.xWireframeWidth/xScale; yWireframeWidth = this.inst.isEditor ? this.inst.yWireframeWidth : this.inst.yWireframeWidth/yScale; zWireframeWidth = this.inst.isEditor ? this.inst.zWireframeWidth : this.inst.zWireframeWidth/zScale; }
const instanceColor = [instanceC3Color.getR(), instanceC3Color.getG(), instanceC3Color.getB(), instanceC3Color.getA()]; const finalColor = vec4.create();
const tmpModelView = mat4.create(); const modelRotate = mat4.create(); if (!(this.inst.isEditor || this.inst.cpuXform)) { mat4.copy(tmpModelView, renderer._matMV); const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale); const rotate = quat.create(); if (this.inst.cannonBody && this.inst.cannonSetRotation) { quat.set(rotate, this.inst.cannonBody.quaternion.x, this.inst.cannonBody.quaternion.y, this.inst.cannonBody.quaternion.z, this.inst.cannonBody.quaternion.w); } else { quat.fromEuler(rotate, xAngle, yAngle, zAngle); } mat4.fromRotationTranslationScale(modelRotate, rotate, [x,y,z], [xScale,-yScale,zScale]); mat4.copy(this.modelRotate, modelRotate); mat4.multiply(modelRotate, tmpModelView, modelRotate); renderer.SetModelViewMatrix(modelRotate); }
// Default color vec4.copy(currentColor, instanceColor); let baseColorChanged = false; if (!vec4.equals(currentColor, [1,1,1,1])) baseColorChanged = true;
if (this.updateDrawVerts) { this.updateDrawVerts = false; }
for (let j=0; j<= this.drawMeshesIndex; j++) { let lightIndex, drawLightsBufferView; if (this.drawLightsEnable) { drawLightsBufferView = this.drawLightsBufferViews[j]; lightIndex = drawLightsBufferView.start }
// Skip render if disabled if (this.drawMeshes[j].disabled) continue;
const drawVerts = this.drawMeshes[j].drawVerts; const drawUVs = this.drawMeshes[j].drawUVs; const drawIndices = this.drawMeshes[j].drawIndices; const material = this.drawMeshes[j].material; const hasTexture = (material && 'pbrMetallicRoughness' in material && 'baseColorTexture' in material.pbrMetallicRoughness); const offsetUV = this.drawMeshes[j].offsetUV; const materialsModify = this.inst.materialsModify; const offsetMaterial = materialsModify.has(material?.name) && materialsModify.get(material?.name)?.offsetUV; const rotateMaterial = materialsModify.has(material?.name) && materialsModify.get(material?.name)?.rotateUV;
let color; if (material && 'pbrMetallicRoughness' in material && 'baseColorFactor' in material.pbrMetallicRoughness) { color = material.pbrMetallicRoughness.baseColorFactor } else { color = null; } if (color && color.length == 4) { color[3] = 1; vec4.multiply(finalColor, instanceColor, color); if (vec4.equals(finalColor, currentColor) == false) { vec4.copy(currentColor, finalColor); renderer.SetColorRgba(finalColor[0], finalColor[1], finalColor[2], finalColor[3]); baseColorChanged = true } }
if (!instanceTexture) { if (!hasTexture) { if (currentTexture != whiteTexture) { renderer.SetTexture(whiteTexture); currentTexture = whiteTexture; } } else { const texture = textures[material.name]; // If texture is not loaded, skip rendering if (!texture) continue; if (texture != currentTexture) { renderer.SetTexture(texture); currentTexture = texture; } } }
let rotateMatrix;
if (rotateMaterial) { const rotateUV = materialsModify.get(material.name)?.rotateUV; // Create rotate matrix rotateMatrix = mat2.create(); mat2.fromRotation(rotateMatrix, rotateUV.angle); }
for (let ii=0; ii<drawVerts.length; ii++) { // Convert typed array to regular array // to speed access to data, net win is 10-20% // const v = new Array(bufferView.length); // for (let a=0; a<bufferView.length; a++) { // v[a] = this.verts[buffStart+a]; // } let v = drawVerts[ii]; let uv = drawUVs[ii]; let ind = drawIndices[ii];
let triangleCount = ind.length/3; let center = [0,0,0]; totalTriangles += triangleCount; for(let i = 0; i<triangleCount; i++) { if (this.drawLightsEnable && this.inst.backFaceCull) { const c = this.unpackRGBA(this.drawLights[lightIndex]) if (c[3] == 0) { lightIndex ++ totalTrianglesCulled++ continue } }
if (hasTexture) { if (offsetMaterial || rotateMaterial) { // create new arrays for the UVs const uvQuad = [ [uv[ind[i*3+0]*2+0], uv[ind[i*3+0]*2+1]], [uv[ind[i*3+1]*2+0], uv[ind[i*3+1]*2+1]], [uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1]] ]; if (rotateMaterial) { // Rotate UVs vec2.sub(uvQuad[0], uvQuad[0], [rotateMaterial.x, rotateMaterial.y]); vec2.sub(uvQuad[1], uvQuad[1], [rotateMaterial.x, rotateMaterial.y]); vec2.sub(uvQuad[2], uvQuad[2], [rotateMaterial.x, rotateMaterial.y]); mat2.multiply(uvQuad[0], rotateMatrix, uvQuad[0]); mat2.multiply(uvQuad[1], rotateMatrix, uvQuad[1]); mat2.multiply(uvQuad[2], rotateMatrix, uvQuad[2]); vec2.add(uvQuad[0], uvQuad[0], [rotateMaterial.x, rotateMaterial.y]); vec2.add(uvQuad[1], uvQuad[1], [rotateMaterial.x, rotateMaterial.y]); vec2.add(uvQuad[2], uvQuad[2], [rotateMaterial.x, rotateMaterial.y]); }
if (offsetMaterial) { const uOffset = offsetMaterial.u; const vOffset = offsetMaterial.v; // Offset UVs in uvQuad uvQuad[0][0] += uOffset; uvQuad[0][1] += vOffset; uvQuad[1][0] += uOffset; uvQuad[1][1] += vOffset; uvQuad[2][0] += uOffset; uvQuad[2][1] += vOffset; } // Set tempquad tempQuad.set( uvQuad[0][0], uvQuad[0][1], uvQuad[1][0], uvQuad[1][1], uvQuad[2][0], uvQuad[2][1], uvQuad[2][0], uvQuad[2][1] ); } else if (offsetUV) { const uOffset = offsetUV.u; const vOffset = offsetUV.v; tempQuad.set( uv[ind[i*3+0]*2+0]+uOffset, uv[ind[i*3+0]*2+1]+vOffset, uv[ind[i*3+1]*2+0]+uOffset, uv[ind[i*3+1]*2+1]+vOffset, uv[ind[i*3+2]*2+0]+uOffset, uv[ind[i*3+2]*2+1]+vOffset, uv[ind[i*3+2]*2+0]+uOffset, uv[ind[i*3+2]*2+1]+vOffset ); } else { tempQuad.set( uv[ind[i*3+0]*2+0], uv[ind[i*3+0]*2+1], uv[ind[i*3+1]*2+0], uv[ind[i*3+1]*2+1], uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1], uv[ind[i*3+2]*2+0], uv[ind[i*3+2]*2+1] ); } } else { // Set face to color if possible tempQuad.set(0,0,1,0,0,1,0,1); } let i3 = i*3; let x0, y0, z0, x1, y1, z1, x2, y2, z2;
x0 = (v[ind[i3+0]*3+0]); y0 = (v[ind[i3+0]*3+1]); z0 = (v[ind[i3+0]*3+2])-z; x1 = (v[ind[i3+1]*3+0]); y1 = (v[ind[i3+1]*3+1]); z1 = (v[ind[i3+1]*3+2])-z; x2 = (v[ind[i3+2]*3+0]); y2 = (v[ind[i3+2]*3+1]); z2 = (v[ind[i3+2]*3+2])-z;
if (this.inst.wireframe) { this.drawWireFrame(renderer, whiteTexture, tempQuad, x0, y0, z0, x1, y1, z1, x2, y2, z2, xWireframeWidth, yWireframeWidth, zWireframeWidth); } else { if (this.drawLightsEnable) { const c = this.unpackRGBA(this.drawLights[lightIndex]) lightIndex ++ if (baseColorChanged) vec4.mul(c, c, currentColor) renderer.SetColorRgba(c[0], c[1], c[2], 1) } renderer.Quad3D2( x0, y0, z0, x1, y1, z1, x2, y2, z2, x2, y2, z2, tempQuad ); } } } } // Restore modelview matrix if (!(this.inst.isEditor || this.inst.cpuXform)) { renderer.SetModelViewMatrix(tmpModelView); } // console.info("totalTriangles/totalTrianglesCulled: " + totalTriangles + "/" + totalTrianglesCulled) this.inst.totalTriangles = totalTriangles this.inst.totalTrianglesCulled = totalTrianglesCulled }
typedVertsToDrawVerts() { for (let j=0; j<= this.drawMeshesIndex; j++) { const drawVerts = this.drawMeshes[j].drawVerts; const bufferViews = this.drawMeshes[j].bufferViews; drawVerts.length = 0 if (!this.activeNodes.includes(j)) { drawVerts.push([]); continue; } for (let ii=0; ii<bufferViews.length; ii++) { const bufferView = bufferViews[ii]; let buffStart = bufferView.start; // Convert typed array to regular array // to speed access to data, net win is 10-20% const v = new Array(bufferView.length); for (let a=0; a<bufferView.length; a++) { v[a] = this.verts[buffStart+a]; } drawVerts.push(v); } } }
unpackRGBA(packedRGBA) { // Extract individual RGBA components from the packed value var red = (packedRGBA & 0xff) / 255 var green = ((packedRGBA >> 8) & 0xff) / 255 var blue = ((packedRGBA >> 16) & 0xff) / 255 var alpha = ((packedRGBA >> 24) & 0xff) / 255 const color = [red, green, blue, alpha] return color }
/* Updates a node's matrix and all it's children nodes. After that it transforms unskinned mesh points and sends them to c2. */ transformNode(node) { const gltf = this.gltfData; if(node.mesh != undefined && node.skin == undefined) { for(let i = 0; i < node.mesh.primitives.length; i++) { this.drawMeshesIndex++; this.drawMeshes[this.drawMeshesIndex].disabled = node.disabled; if (node.offsetUV) this.drawMeshes[this.drawMeshesIndex].offsetUV = node.offsetUV; // Update material each time, in case an ACE changes it if ('material' in node.mesh.primitives[i]) { this.drawMeshes[this.drawMeshesIndex].material = node.mesh.primitives[i].material; } else { this.drawMeshes[this.drawMeshesIndex].material = null; } } } if(node.children != undefined) for(let i = 0; i < node.children.length; i++) this.transformNode(node.children[i]); }
getPolygons() { if (!this.workerReady) return; const editorData = this.getPolygonsPrep(); const data = {editorData} this.workerReady = false this.msgPort.postMessage({type: "getPolygons", data: data, buff: this.buff}, [this.buff]); }
getEditorData(isEditor, lightEnable, lightUpdate) { const tick = this._runtime.GetTickCount(); let editorData = {tick: tick, isEditor: isEditor} if (isEditor) { const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle;
const x = this.inst._inst.GetX(); const y = this.inst._inst.GetY(); const z = this.inst._inst.GetZElevation();
const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale);
const cullEnable = this.inst.backFaceCull
// Send to worker with postMessage in case in editor editorData = { xScale, yScale, zScale, xAngle, yAngle, zAngle, x, y, z, tick, isEditor, lightEnable: false, cullEnable } }
if (lightEnable) { const wi = this.inst.GetWorldInfo()
const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle;
const x = wi.GetX(); const y = wi.GetY(); const z = wi.GetZElevation();
const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale);
const lights = this.inst.lights; const ambientColor = this.inst.ambientColor; const viewPos = this.inst.viewPos;
const cullEnable = this.inst.backFaceCull
// Send to worker with postMessage in case in editor editorData = { xScale, yScale, zScale, xAngle, yAngle, zAngle, x, y, z, tick, isEditor, lights, ambientColor, viewPos, lightEnable: true, cullEnable, lightUpdate } } return editorData }
// Updates scene graph, and as a second step sends transformed skinned mesh points to c2. getPolygonsPrep() { const gltf = this.gltfData;
this.drawMeshesIndex = -1;
const editorData = this.getEditorData(this.inst.isEditor, this.inst.lightEnable, this.inst.lightUpdate)
// update all scene matrixes. // only update drawMesh meta data, vertex data will be updated in the worker for(let i = 0; i < gltf.scene.nodes.length; i++) { this.transformNode(gltf.scene.nodes[i]); } for(let ii = 0; ii < gltf.skinnedNodes.length; ii++) { let node = gltf.skinnedNodes[ii]; for(let i = 0; i < node.mesh.primitives.length; i++) { this.drawMeshesIndex++; this.drawMeshes[this.drawMeshesIndex].disabled = node.disabled; if (node.offsetUV) this.drawMeshes[this.drawMeshesIndex].offsetUV = node.offsetUV; // Update material each time, in case an ACE changes it if ('material' in node.mesh.primitives[i]) { this.drawMeshes[this.drawMeshesIndex].material = node.mesh.primitives[i].material; } else { this.drawMeshes[this.drawMeshesIndex].material = null; }
} } return editorData; }
// sends a list of animation names to c2. getAnimationNames() { const gltf = this.gltfData; let names = []; if (!gltf.animations) return names; for(let i = 0; i <gltf.animations.length; i++) names.push(gltf.animations[i].name);
return names; }
drawWireFrame(renderer, whiteTexture, tempQuad, x0,y0,z0,x1,y1,z1, x2, y2,z2, xWidth, yWidth, zWidth ){ renderer.SetTexture(whiteTexture); tempQuad.set(0,0,1,0,0,1,0,1);
renderer.Quad3D2( x0, y0, z0, x0+xWidth, y0+yWidth, z0+zWidth, x1, y1, z1, x1+xWidth, y1+yWidth, z1+zWidth, tempQuad ); renderer.Quad3D2( x1, y1, z1, x1+xWidth, y1+yWidth, z1+zWidth, x2, y2, z2, x2+xWidth, y2+yWidth, z2+zWidth, tempQuad ); renderer.Quad3D2( x2, y2, z2, x2+xWidth, y2+yWidth, z2+zWidth, x0, y0, z0, x0+xWidth, y0+yWidth, z0+zWidth, tempQuad ); }
getLightData() { return this.inst.lights }
updateAnimationPolygons(index, time, onScreen, deltaTime) { if (!this.workerReady) return; this.workerReady = false this.updateAnimation(index, time, onScreen, deltaTime); const animationBlend = this.inst.animationBlend; const animationLoop = this.inst.animationLoop; let lightData let animationData = { index, time, onScreen, deltaTime, animationBlend, animationLoop }; let editorData = {} if (onScreen) { editorData = this.getPolygonsPrep(); this.inst.runtime.UpdateRender(); this.inst.updateBbox = true } const data = {animationData, editorData}; this.msgPort.postMessage({type: "updateAnimationPolygons", data: data, buff: this.buff}, [this.buff]); }
updateModelRotate(x,y,z) { // @ts-ignore const vec3 = globalThis.glMatrix3D.vec3; // @ts-ignore const mat4 = globalThis.glMatrix3D.mat4; // @ts-ignore const quat = globalThis.glMatrix3D.quat; const xAngle = this.inst.xAngle; const yAngle = this.inst.yAngle; const zAngle = this.inst.zAngle; const xScale = this.inst.scale/(this.inst.xScale == 0 ? 1 : this.inst.xScale); const yScale = this.inst.scale/(this.inst.yScale == 0 ? 1 : this.inst.yScale); const zScale = this.inst.scale/(this.inst.zScale == 0 ? 1 : this.inst.zScale); const rotate = quat.create(); if (this.inst.cannonBody && this.inst.cannonSetRotation) { quat.set(rotate, this.inst.cannonBody.quaternion.x, this.inst.cannonBody.quaternion.y, this.inst.cannonBody.quaternion.z, this.inst.cannonBody.quaternion.w); } else { quat.fromEuler(rotate, xAngle, yAngle, zAngle); } mat4.fromRotationTranslationScale(this.modelRotate, rotate, [x,y,z], [xScale,-yScale,zScale]); }
// Updates animation at index to be at time. Is used to play animation. updateAnimation(index, time, onScreen, deltaTime) { const gltf = this.gltfData; let anim = gltf.animations[index]; for(let i = 0; i < anim.channels.length; i++) { let c = anim.channels[i]; let timeValues = c.sampler.input; if (this.inst.animationLoop) { time = (time-timeValues.min[0])%(timeValues.max[0]-timeValues.min[0]) + timeValues.min[0]; // loop } else { if (time > timeValues.max[0]) { time = timeValues.max[0]-0.01; // Stop on max time if (!this.inst.animationFinished) { this.inst.animationFinished = true; this.inst.animationNameFinished = this.inst.animationName; // @ts-ignore this.inst.Trigger(self.C3.Plugins.Mikal_3DObject.Cnds.OnAnimationFinished); // @ts-ignore this.inst.Trigger(self.C3.Plugins.Mikal_3DObject.Cnds.OnAnimationNameFinished);
} } } this.inst.currentAnimationTime = time; } }}
// @ts-ignoreglobalThis.GltfModelW = GltfModelW;1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Penalty Shooters 3 Unblocked - ubg235 GameDistribution</title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="generator" content="Scirra Construct"> <meta name="description" content="Fun and addictive online soccer game that puts your penalty shooting and defending skills to the test."> <link rel="manifest" href="appmanifest.json"> <link rel="apple-touch-icon" sizes="128x128" href="icons/icon-128.png"> <link rel="apple-touch-icon" sizes="256x256" href="icons/icon-256.png"> <link rel="apple-touch-icon" sizes="512x512" href="icons/icon-512.png"> <link rel="icon" type="image/png" href="icons/icon-512.png">
<link rel="stylesheet" href="style.css">
<style>body {-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}</style></head><body style="overflow:hidden;">
<script>if (location.protocol.substr(0, 4) === "file"){ alert("Web exports won't work until you upload them. (When running on the file: protocol, browsers block many features from working for security reasons.)");}</script> <script src="gl-matrix.js"></script> <script src="gltfdata.js"></script> <script src="gltfmodel.js"></script> <script src="gltfmodelw.js"></script> <noscript> <div id="notSupportedWrap"> <h2 id="notSupportedTitle">This content requires JavaScript</h2> <p class="notSupportedMessage">JavaScript appears to be disabled. Please enable it to view this content.</p> </div> </noscript> <script src="scripts/supportcheck.js"></script> <script src="scripts/offlineclient.js" type="module"></script> <script src="scripts/main.js" type="module"></script> <script src="scripts/register-sw.js" type="module"></script>
</body></html>123{ }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240{ "c2array": true, "size": [ 10, 7, 1 ], "data": [ [ [ "Elevacija / deltaX" ], [ 150 ], [ 80 ], [ 60 ], [ 40 ], [ 20 ], [ 0 ] ], [ [ 0 ], [ 1 ], [ 1 ], [ 1.2 ], [ 1.2 ], [ 1.2 ], [ 1.2 ] ], [ [ 20 ], [ 1 ], [ 1 ], [ 1 ], [ 1.2 ], [ 1.2 ], [ 1.2 ] ], [ [ 40 ], [ 1 ], [ 1 ], [ 1.1 ], [ 1.1 ], [ 1.3 ], [ 1.2 ] ], [ [ 60 ], [ 1.05 ], [ 1.05 ], [ 1.1 ], [ 1.1 ], [ 1.2 ], [ 1.2 ] ], [ [ 80 ], [ 1 ], [ 1 ], [ 1 ], [ 1.05 ], [ 1.13 ], [ 1.2 ] ], [ [ 100 ], [ 1 ], [ 1 ], [ 1 ], [ 1.05 ], [ 1 ], [ 1 ] ], [ [ 120 ], [ 0.95 ], [ 0.95 ], [ 0.95 ], [ 0.95 ], [ 1 ], [ 1 ] ], [ [ 140 ], [ 0.9 ], [ 0.9 ], [ 0.95 ], [ 0.95 ], [ 0.95 ], [ 0.95 ] ], [ [ 210 ], [ 0.9 ], [ 0.9 ], [ 0.95 ], [ 0.95 ], [ 0.95 ], [ 0.95 ] ] ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378{ "c2array": true, "size": [ 16, 7, 1 ], "data": [ [ [ "BRA" ], [ 90 ], [ "mix" ], [ "zuto" ], [ "prazno" ], [ "plavo" ], [ "uspravne" ] ], [ [ "GER" ], [ 90 ], [ "white" ], [ "belo" ], [ "prazno" ], [ "crno" ], [ "uspravne" ] ], [ [ "ARG" ], [ 85 ], [ "white" ], [ "belo" ], [ "svetloplavo" ], [ "crno" ], [ "uspravne" ] ], [ [ "ITA" ], [ 85 ], [ "white" ], [ "plavo" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ], [ [ "FRA" ], [ 80 ], [ "skoro_black" ], [ "teget" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ], [ [ "ENG" ], [ 80 ], [ "mix" ], [ "belo" ], [ "prazno" ], [ "teget" ], [ "uspravne" ] ], [ [ "ESP" ], [ 80 ], [ "white" ], [ "crveno" ], [ "prazno" ], [ "teget" ], [ "uspravne" ] ], [ [ "NED" ], [ 75 ], [ "mix" ], [ "narandzasto" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ], [ [ "POR" ], [ 70 ], [ "mix" ], [ "bordo" ], [ "prazno" ], [ "zeleno" ], [ "uspravne" ] ], [ [ "URU" ], [ 70 ], [ "white" ], [ "svetloplavo" ], [ "prazno" ], [ "crno" ], [ "uspravne" ] ], [ [ "BEL" ], [ 65 ], [ "mix" ], [ "crveno" ], [ "prazno" ], [ "crno" ], [ "uspravne" ] ], [ [ "SWE" ], [ 65 ], [ "white" ], [ "zuto" ], [ "prazno" ], [ "teget" ], [ "uspravne" ] ], [ [ "RUS" ], [ 60 ], [ "white" ], [ "crveno" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ], [ [ "MEX" ], [ 60 ], [ "white" ], [ "zeleno" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ], [ [ "POL" ], [ 55 ], [ "white" ], [ "belo" ], [ "prazno" ], [ "crveno" ], [ "uspravne" ] ], [ [ "SUI" ], [ 50 ], [ "white" ], [ "crveno" ], [ "prazno" ], [ "belo" ], [ "uspravne" ] ] ]}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980html, body {
padding: 0;
margin: 0;
overflow: hidden;
background: #000000;
color: white;
}
html, body, canvas {
touch-action: none;
touch-action-delay: none;
}
#notSupportedWrap {
margin: 2em auto 1em auto;
width: 75%;
max-width: 45em;
border: 2px solid #aaa;
border-radius: 1em;
padding: 2em;
background-color: #f0f0f0;
font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
color: black;
}
#notSupportedTitle {
font-size: 1.8em;
}
.notSupportedMessage {
font-size: 1.2em;
}
.notSupportedMessage em {
color: #888;
}
/* bbcode styles */
.bbCodeH1 {
font-size: 2em;
font-weight: bold;
}
.bbCodeH2 {
font-size: 1.5em;
font-weight: bold;
}
.bbCodeH3 {
font-size: 1.25em;
font-weight: bold;
}
.bbCodeH4 {
font-size: 1.1em;
font-weight: bold;
}
.bbCodeItem::before {
content: " • ";
}
/* For text icons converted to HTML: size the height to the line height
preserving the aspect ratio. Also add position: relative as that allows
just adding a 'top' style for the iconoffsety style. */
.c3-text-icon {
height: 1em;
width: auto;
position: relative;
}
/* screen reader text */
.c3-screen-reader-text {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
}12// No Service Workerconsole.log("No Service Worker")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148{ "c2array": true, "size": [ 6, 7, 1 ], "data": [ [ [ "otkljucan" ], [ 100 ], [ 0 ], [ 20 ], [ 5 ], [ 2 ], [ 0 ] ], [ [ "zakljucan" ], [ 300 ], [ 15 ], [ 80 ], [ 7 ], [ 4 ], [ 0 ] ], [ [ "zakljucan" ], [ 1000 ], [ 70 ], [ 120 ], [ 10 ], [ 7 ], [ 0 ] ], [ [ "zakljucan" ], [ 3000 ], [ 170 ], [ 240 ], [ 13 ], [ 10 ], [ 0 ] ], [ [ "zakljucan" ], [ 10000 ], [ 350 ], [ 520 ], [ 17 ], [ 14 ], [ 0 ] ], [ [ "zakljucan" ], [ 20000 ], [ 700 ], [ 1000 ], [ 22 ], [ 19 ], [ 0 ] ] ]}123<script src="js/analytics_ubg_v1_4.js"></script><script src="js/ubg235_client_v1_1.js"></script><script src="js/slopegame-gitlab-io.js"></script>filestorage/gd/penalty-shooters-3/404.htmlAdded+1
filestorage/gd/penalty-shooters-3/408.htmlAdded+1
filestorage/gd/penalty-shooters-3/faktorikosoghica.jsonAdded+108
filestorage/gd/penalty-shooters-3/frame.htmlAdded+1
filestorage/gd/penalty-shooters-3/games235.htmlAdded+1
filestorage/gd/penalty-shooters-3/gametext.jsonAdded+465
filestorage/gd/penalty-shooters-3/gl-matrix.jsAdded
filestorage/gd/penalty-shooters-3/gltfdata.jsAdded+412
filestorage/gd/penalty-shooters-3/gltfmodel.jsAdded+1028
filestorage/gd/penalty-shooters-3/gltfmodelw.jsAdded+815
filestorage/gd/penalty-shooters-3/gltfworker.jsAdded
filestorage/gd/penalty-shooters-3/golv3.glbAdded
filestorage/gd/penalty-shooters-3/index.htmlAdded+53
filestorage/gd/penalty-shooters-3/manifest.jsonAdded+3
filestorage/gd/penalty-shooters-3/min_snaga_i_deltax.jsonAdded+240
filestorage/gd/penalty-shooters-3/reprezentacije.jsonAdded+378
filestorage/gd/penalty-shooters-3/style.cssAdded+80
filestorage/gd/penalty-shooters-3/sw.jsAdded+2
filestorage/gd/penalty-shooters-3/tiers.jsonAdded+148
filestorage/gd/penalty-shooters-3/ubg235.htmlAdded+3