1.0.3 • Published 7 months ago

lesca-glb-loader v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

NPM React React React React React NPM

Why use it?

load glb file simplified.

Live Demo

Installation

npm install lesca-glb-loader --save

Usage

import GlbLoader from 'lesca-glb-loader';
import Avatar from './Athlete.glb';

GlbLoader(Avatar).then((e) => {
  const { model, mixer, gltf } = e;

  const scale = 80;
  model.scale.set(scale, scale, scale);
  scene.add(model);

  // animation clip update
  enterframe.add(() => {
    // =>  same requestAnimationFrame
    const delta = clock.getDelta();
    mixer[0].update(delta);
  });
});

Development

Parameters

GlbLoader(url, options).then((e) => {
  // get module here
});
Parametersdescriptiondefault
url:stringglb file url
options:objectoptions for loaderoptions

Options

keydescriptiondefault
onProcess:functionon process handler
loop:booleananimation clip loop?true
castShadow:booleanmodel cast shadow?true
receiveShadow:booleanmodel receive shadow?false
material:objectMaterialsMaterial
material
keydescriptiondefault
metalness:numberMaterials0
roughness:numberMaterials1
clearcoat:numberMaterials0
clearcoatRoughness:numberMaterials0.5

Features

  • Code Linting (eslint)
  • maintain if necessary
1.0.2

8 months ago

1.0.3

7 months ago

1.0.1

10 months ago

1.0.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago