npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

three-addons

v1.2.0

Published

A collection of Three.js addons

Downloads

2,049

Readme

Three Addons

Latest NPM release

A collection of Three.js addons.

Installation

npm install --save three-addons

or

yarn add three-addons

Usage

import { Scene, PerspectiveCamera, WebGLRenderer } from 'three';
import { OBJLoader } from 'three-addons';

const scene = new Scene();
// ...
const loader = new OBJLoader();
loader.load('obj/someObj.obj', (object) => {
  object.position.y = -95;
  scene.add(object);
});

Or if your bundler has Tree Shaking, you can just import everything:

import * as THREE from 'three';
import * as THREE_ADDONS from 'three-addons';

const scene = new THREE.Scene();
// ...
const loader = new THREE_ADDONS.OBJLoader();
loader.load('obj/someObj.obj', (object) => {
  object.position.y = -95;
  scene.add(object);
});

If you don't have a module bundler you can just drop it in the HTML after Three.js and you will be able to use it like this:

<script src="js/three.min.js"></script>
<script src="js/three-addons.min.js"></script>


<script>
  const scene = new THREE.Scene();
  // ...
  const loader = new THREE_ADDONS.OBJLoader();
  loader.load('obj/someObj.obj', (object) => {
    object.position.y = -95;
    scene.add(object);
  });
</script>

Instead, if you want to mindlessly paste the examples of Three.js and its addons you find online, you can just do this:

import * as THREEJS from 'three';
import * as THREE_ADDONS from 'three-addons';
const THREE = { ...THREEJS, ...THREE_ADDONS }; // you can also use Object.assign() or lodash's _.assign()


const scene = new THREE.Scene();
// ...
const loader = new THREE.OBJLoader();
loader.load('obj/someObj.obj', (object) => {
  object.position.y = -95;
  scene.add(object);
});

But this pattern is not recommended, since it doesn't tell you which property belongs to Three.js and which one is an addon.

Addon structure

All the addons are taken from most used examples around the web, and wrapped with those two lines to make it exportable:

import * as THREE from 'three';

// ...addon code

export default THREE.AddonName;

Thanks to npm-three-js for the inspiration of this project and the full list of addons.

Here is the list of the addons present in this package:

AdaptiveToneMappingPass, BasicShader, BleachBypassShader, BlendShader, BloomPass, BokehPass, BokehShader, BokehShader2, BrightnessContrastShader, ~~CanvasRenderer~~, ColorCorrectionShader, ColorifyShader, ConvolutionShader, CopyShader, DDSLoader, DOFMipMapShader, DigitalGlitch, DotScreenPass, DotScreenShader, EdgeShader, EdgeShader2, EffectComposer, FXAAShader, FilmPass, FilmShader, FocusShader, FresnelShader, GammaCorrectionShader, GlitchPass, HorizontalBlurShader, HorizontalTiltShiftShader, HueSaturationShader, KaleidoShader, LuminosityShader, MTLLoader, MarchingCubes, MaskPass, MirrorShader, NormalMapShader, OBJLoader, OceanShaders, OrbitControls, ParallaxShader, ~~Projector~~, RGBShiftShader, RenderPass, SSAOShader, SVGLoader, SavePass, SepiaShader, ShaderPass, ShaderToon, TechnicolorShader, TexturePass, ToneMapShader, TriangleBlurShader, UnpackDepthRGBAShader, VerticalBlurShader, VerticalTiltShiftShader, VignetteShader, SobelOperatorShader.

NOTE: both CanvasRenderer and Projector are not available for now because the go in conflict with their respective deprecated warning exported from the main Three.js repo. Here is the source of that code.