Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drei

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drei - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

22

dist/index.cjs.js

@@ -263,3 +263,5 @@ 'use strict';

function StandardEffects(_ref) {
var _ref$ao = _ref.ao,
var _ref$smaa = _ref.smaa,
smaa = _ref$smaa === void 0 ? true : _ref$smaa,
_ref$ao = _ref.ao,
ao = _ref$ao === void 0 ? true : _ref$ao,

@@ -271,3 +273,4 @@ _ref$bloom = _ref.bloom,

_ref$bloomOpacity = _ref.bloomOpacity,
bloomOpacity = _ref$bloomOpacity === void 0 ? 1 : _ref$bloomOpacity;
bloomOpacity = _ref$bloomOpacity === void 0 ? 1 : _ref$bloomOpacity,
effects = _ref.effects;

@@ -280,3 +283,3 @@ var _useThree = reactThreeFiber.useThree(),

var smaa = reactThreeFiber.useLoader(postprocessing.SMAAImageLoader, '');
var smaaProps = reactThreeFiber.useLoader(postprocessing.SMAAImageLoader, '');
var composer = React.useMemo(function () {

@@ -288,3 +291,3 @@ var composer = new postprocessing.EffectComposer(gl, {

var smaaEffect = _construct(postprocessing.SMAAEffect, smaa);
var smaaEffect = _construct(postprocessing.SMAAEffect, smaaProps);

@@ -315,7 +318,10 @@ smaaEffect.colorEdgesMaterial.setEdgeDetectionThreshold(edgeDetection);

bloomEffect.blendMode.opacity.value = bloomOpacity;
var effects = [camera, smaaEffect, ssaoEffect];
if (ao) effects.push(ssaoEffect);
if (bloom) effects.push(bloomEffect);
var effectsArray = [];
if (effects) effectsArray = effects([smaaEffect, ssaoEffect, bloomEffect]);else {
if (smaa) effectsArray.push(smaaEffect);
if (ao) effectsArray.push(ssaoEffect);
if (bloom) effectsArray.push(bloomEffect);
}
var effectPass = _construct(postprocessing.EffectPass, effects);
var effectPass = _construct(postprocessing.EffectPass, [camera].concat(effectsArray));

@@ -322,0 +328,0 @@ effectPass.renderToScreen = true;

@@ -237,6 +237,8 @@ import _extends from '@babel/runtime/helpers/esm/extends';

function StandardEffects({
smaa = true,
ao = true,
bloom = true,
edgeDetection = 0.1,
bloomOpacity = 1
bloomOpacity = 1,
effects
}) {

@@ -249,3 +251,3 @@ const {

} = useThree();
const smaa = useLoader(SMAAImageLoader, '');
const smaaProps = useLoader(SMAAImageLoader, '');
const composer = useMemo(() => {

@@ -256,3 +258,3 @@ const composer = new EffectComposer(gl, {

composer.addPass(new RenderPass(scene, camera));
const smaaEffect = new SMAAEffect(...smaa);
const smaaEffect = new SMAAEffect(...smaaProps);
smaaEffect.colorEdgesMaterial.setEdgeDetectionThreshold(edgeDetection);

@@ -282,6 +284,9 @@ const normalPass = new NormalPass(scene, camera);

bloomEffect.blendMode.opacity.value = bloomOpacity;
const effects = [camera, smaaEffect, ssaoEffect];
if (ao) effects.push(ssaoEffect);
if (bloom) effects.push(bloomEffect);
const effectPass = new EffectPass(...effects);
let effectsArray = [];
if (effects) effectsArray = effects([smaaEffect, ssaoEffect, bloomEffect]);else {
if (smaa) effectsArray.push(smaaEffect);
if (ao) effectsArray.push(ssaoEffect);
if (bloom) effectsArray.push(bloomEffect);
}
const effectPass = new EffectPass(camera, ...effectsArray);
effectPass.renderToScreen = true;

@@ -288,0 +293,0 @@ composer.addPass(normalPass);

declare type Props = {
bloom: boolean | BloomProps;
ao: boolean | AOProps;
smaa: boolean;
edgeDetection: number;
bloomOpacity: number;
effects?: (effects: any[]) => any[];
};

@@ -28,3 +30,3 @@ declare type BloomProps = {

};
export declare function StandardEffects({ ao, bloom, edgeDetection, bloomOpacity }: Props): null;
export declare function StandardEffects({ smaa, ao, bloom, edgeDetection, bloomOpacity, effects, }: Props): null;
export {};
{
"name": "drei",
"version": "0.0.23",
"version": "0.0.24",
"description": "useful add-ons for react-three-fiber",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -108,6 +108,8 @@ [![Build Status](https://travis-ci.org/react-spring/drei.svg?branch=master)](https://travis-ci.org/react-spring/drei) [![npm version](https://badge.fury.io/js/drei.svg)](https://badge.fury.io/js/drei) ![npm](https://img.shields.io/npm/dt/drei.svg)

<StandardEffects
ao // Can be a boolean or all valid postprocessing AO props
bloom // Can be a boolean or all valid postprocessing Bloom props
smaa // Can be a boolean (default=true)
ao // Can be a boolean or all valid postprocessing AO props (default=true)
bloom // Can be a boolean or all valid postprocessing Bloom props (default=true)
edgeDetection = 0.1 // Optional, SMAA precision
bloomOpacity = 1 // Optional, Bloom blendMode opacity
effects // Optional, define your own effect: ([smaa, ao, bloom]) => [...effects]
/>

@@ -114,0 +116,0 @@ ```

@@ -21,4 +21,6 @@ import { HalfFloatType } from 'three'

ao: boolean | AOProps
smaa: boolean
edgeDetection: number
bloomOpacity: number
effects?: (effects: any[]) => any[]
}

@@ -49,9 +51,16 @@

export function StandardEffects({ ao = true, bloom = true, edgeDetection = 0.1, bloomOpacity = 1 }: Props) {
export function StandardEffects({
smaa = true,
ao = true,
bloom = true,
edgeDetection = 0.1,
bloomOpacity = 1,
effects,
}: Props) {
const { gl, scene, camera, size } = useThree()
const smaa: any = useLoader(SMAAImageLoader, '')
const smaaProps: any = useLoader(SMAAImageLoader, '')
const composer = useMemo(() => {
const composer = new EffectComposer(gl, { frameBufferType: HalfFloatType })
composer.addPass(new RenderPass(scene, camera))
const smaaEffect = new SMAAEffect(...smaa)
const smaaEffect = new SMAAEffect(...smaaProps)
smaaEffect.colorEdgesMaterial.setEdgeDetectionThreshold(edgeDetection)

@@ -87,7 +96,11 @@

const effects = [camera, smaaEffect, ssaoEffect]
if (ao) effects.push(ssaoEffect)
if (bloom) effects.push(bloomEffect)
let effectsArray: any[] = []
if (effects) effectsArray = effects([smaaEffect, ssaoEffect, bloomEffect])
else {
if (smaa) effectsArray.push(smaaEffect)
if (ao) effectsArray.push(ssaoEffect)
if (bloom) effectsArray.push(bloomEffect)
}
const effectPass = new EffectPass(...effects)
const effectPass = new EffectPass(camera, ...effectsArray)
effectPass.renderToScreen = true

@@ -94,0 +107,0 @@ composer.addPass(normalPass)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc