MCPcopy Create free account
hub / github.com/Twinklebear/webgpu-gltf / constructor

Method constructor

src/glb_import.js:511–549  ·  view source on GitHub ↗
(sampler, device)

Source from the content-addressed store, hash-verified

509
510export class GLTFSampler {
511 constructor(sampler, device) {
512 var magFilter = sampler['magFilter'] === undefined ||
513 sampler['magFilter'] == GLTFTextureFilter.LINEAR
514 ? 'linear'
515 : 'nearest';
516 var minFilter = sampler['minFilter'] === undefined ||
517 sampler['minFilter'] == GLTFTextureFilter.LINEAR
518 ? 'linear'
519 : 'nearest';
520
521 var wrapS = 'repeat';
522 if (sampler['wrapS'] !== undefined) {
523 if (sampler['wrapS'] == GLTFTextureFilter.REPEAT) {
524 wrapS = 'repeat';
525 } else if (sampler['wrapS'] == GLTFTextureFilter.CLAMP_TO_EDGE) {
526 wrapS = 'clamp-to-edge';
527 } else {
528 wrapS = 'mirror-repeat';
529 }
530 }
531
532 var wrapT = 'repeat';
533 if (sampler['wrapT'] !== undefined) {
534 if (sampler['wrapT'] == GLTFTextureFilter.REPEAT) {
535 wrapT = 'repeat';
536 } else if (sampler['wrapT'] == GLTFTextureFilter.CLAMP_TO_EDGE) {
537 wrapT = 'clamp-to-edge';
538 } else {
539 wrapT = 'mirror-repeat';
540 }
541 }
542
543 this.sampler = device.createSampler({
544 magFilter: magFilter,
545 minFilter: minFilter,
546 addressModeU: wrapS,
547 addressModeV: wrapT,
548 });
549 }
550}
551
552export class GLTFTexture {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected