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

@dreamoment/gobble

v0.0.1

Published

<h1 align="center">gobble</h1>

Downloads

3

Readme

Language: English | 中文简体

What is gobble ?

threejs batching tool that integrates multiple batching methods.

Features

  • lightweight and easy to use

  • support static batching and GPU Instancing

  • support typescript

Scenarios

method | material | geometry | transformability | generated time | rendering performance | memory usage :-:|:--------:|:--------:|:----------------:|:--------------:|:---------------------:|:-: Static Batching| single | unlimited | no | slow | better |high GPU Instancing Single| single | single | yes | fast | good |low GPU Instancing Multiple| single | multiple | yes | fast | good |low

Install

npm i @dreamoment/gobble

Examples

// StaticBatching
import * as THREE from 'three'
import { StaticBatching } from '@dreamoment/gobble'

const commonMaterial = new THREE.MeshStandardMaterial()

const staticBatching = new StaticBatching([group1, group2], commonMaterial, total)
const mesh = staticBatching.getMesh()
scene.add(mesh)
import * as THREE from 'three'

const sphereGeometry = new THREE.SphereGeometry(1.0, 16, 8)
const commonMaterial = new THREE.MeshStandardMaterial()

const total = 100
const instancingSingle = new GPUInstancing.Single(sphereGeometry, commonMaterial, total)
// If you take the first child, do the same for the other 99
const object3D = instancingSingle.create()
object3D.setPosition(child.position)
object3D.setRotation(child.rotation)
object3D.setScale(child.scale)
instancingSingle.add(object3D)
import * as THREE from 'three'
import { StaticBatching, GPUInstancing } from '@dreamoment/gobble'

const sphereGeometry = new THREE.SphereGeometry(1.0, 16, 8)
const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 2, 16)
const commonMaterial = new THREE.MeshStandardMaterial()

const total = 100
const instancingMultiple = new GPUInstancing.Multiple([sphereGeometry, c], commonMaterial, total)
// If you take the first child, do the same for the other 99
const object3D = instancingMultiple.create(0)       // base sphereGeometry
// const object3D = instancingMultiple.create(1)    // base cylinderGeometry
object3D.setPosition(child.position)
object3D.setRotation(child.rotation)
object3D.setScale(child.scale)
instancingMultiple.add(object3D)

StaticBatching API

Static batching.

new StaticBatching(object3Ds: THREE.Object3D[], material?: THREE.Material)

getMesh

Get the processed mesh.

getMesh(): THREE.Mesh

GPUInstancing API

GPU Instancing Single.

new GPUInstancing.Single(geometry: THREE.BufferGeometry, material: THREE.Material, total: number)

GPU Instancing Multiple.

new GPUInstancing.Multiple(geometries: THREE.BufferGeometry[], material: THREE.Material, total: number)

getMesh

Get the processed mesh.

getMesh(): THREE.Mesh

create

Generate a child object.

// from GPUInstancing.Single
create(): GPUInstancingObject3D
// from GPUInstancing.Multiple
create(type: number): GPUInstancingObject3D

add

Add a child object.

add(object3D: GPUInstancingObject3D): GPUInstancingMultiple

remove

Remove a child object.

remove(object3D: GPUInstancingObject3D): GPUInstancingMultiple

GPUInstancingObject3D API

The child object that GPUInstancing generates.

getPosition / setPosition

Get/set the position information of the child object.

getPosition(): THREE.Vector3
setPosition(position: THREE.Vector3): void

getRotation / setRotation

Get/set the rotation information of the child object.

getRotation(): THREE.Euler
setRotation(rotation: THREE.Euler): void

getScale / setScale

Get/set the scale information of the child object.

getScale(): THREE.Vector3
setScale(scale: THREE.Vector3): void

getVisible / setVisible

Get/set the visible information of the child object.

getVisible(): boolean
setVisible(visible: boolean): void