Comparing version 0.0.17 to 0.0.18
@@ -19,2 +19,3 @@ 'use strict'; | ||
var postprocessing = require('postprocessing'); | ||
var StatsImpl = _interopDefault(require('stats.js')); | ||
var DRACOLoader = require('three/examples/jsm/loaders/DRACOLoader'); | ||
@@ -327,2 +328,25 @@ var Sky$1 = require('three/examples/jsm/objects/Sky'); | ||
function Stats(_ref) { | ||
var _ref$showPanel = _ref.showPanel, | ||
showPanel = _ref$showPanel === void 0 ? 0 : _ref$showPanel; | ||
var _useState = React.useState(function () { | ||
return new StatsImpl(); | ||
}), | ||
stats = _useState[0]; | ||
React.useEffect(function () { | ||
stats.showPanel(showPanel); | ||
document.body.appendChild(stats.dom); | ||
return function () { | ||
return document.body.removeChild(stats.dom); | ||
}; | ||
}, []); | ||
return reactThreeFiber.useFrame(function (state) { | ||
stats.begin(); | ||
state.gl.render(state.scene, state.camera); | ||
stats.end(); | ||
}, 1); | ||
} | ||
function draco(url) { | ||
@@ -367,4 +391,5 @@ if (url === void 0) { | ||
exports.StandardEffects = StandardEffects; | ||
exports.Stats = Stats; | ||
exports.TrackballControls = TrackballControls; | ||
exports.TransformControls = TransformControls; | ||
exports.draco = draco; |
@@ -11,2 +11,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
import { SMAAImageLoader, EffectComposer, RenderPass, SMAAEffect, NormalPass, SSAOEffect, BlendFunction, BloomEffect, KernelSize, EffectPass } from 'postprocessing'; | ||
import StatsImpl from 'stats.js'; | ||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; | ||
@@ -288,2 +289,18 @@ import { Sky as Sky$1 } from 'three/examples/jsm/objects/Sky'; | ||
function Stats({ | ||
showPanel = 0 | ||
}) { | ||
const [stats] = useState(() => new StatsImpl()); | ||
useEffect(() => { | ||
stats.showPanel(showPanel); | ||
document.body.appendChild(stats.dom); | ||
return () => document.body.removeChild(stats.dom); | ||
}, []); | ||
return useFrame(state => { | ||
stats.begin(); | ||
state.gl.render(state.scene, state.camera); | ||
stats.end(); | ||
}, 1); | ||
} | ||
function draco(url = '/draco-gltf/') { | ||
@@ -315,2 +332,2 @@ return loader => { | ||
export { Detailed, MapControls, OrbitControls, PerspectiveCamera, PositionalAudio, Sky, StandardEffects, TrackballControls, TransformControls, draco }; | ||
export { Detailed, MapControls, OrbitControls, PerspectiveCamera, PositionalAudio, Sky, StandardEffects, Stats, TrackballControls, TransformControls, draco }; |
@@ -1,3 +0,3 @@ | ||
export default function Stats({ showPanel }: { | ||
export declare function Stats({ showPanel }: { | ||
showPanel?: number | undefined; | ||
}): null; |
{ | ||
"name": "drei", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "useful add-ons for react-three-fiber", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62933
1279