1.0.3 • Published 4 years ago

magnify-3d-new v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

version

Magnify 3d

Real time optic magnifying glass for three.js. Get a high-res zoomed section of your 3d scene, with a single API.

FORK FROM https://github.com/amitdiamant/magnify-3d

SUPPORT NEW THREE.js VERSION

Demo

Install

$ npm install magnify-3d-new --save

Usage

import Magnify3d from 'magnify-3d-new';

const magnify3d = new Magnify3d();

magnify3d.render({

    renderer: renderer,
    
    pos: { mouse.x, mouse.y },
    
    renderSceneCB: (target) => {
        if (target) {
            renderer.setRenderTarget(target);
        } else {
            renderer.setRenderTarget(null);
        }
        renderer.render(scene, camera);
          
    }
    
});

Options

NameTypeDefaultMandatoryDescription
rendererWebGLRendererVThe renderer used to render the original scene.
renderSceneCBfunctionVA callback function used for rendering the original scene on a zoomed target.
pos{ x, y }VPosition of the magnifying glass in client coordinates.
zoomnumber2.0Zoom factor of the magnifying glass.
expnumber35.0Exponent used to calculate the glass' shape. Higher exp value means flatter glass shape.
radiusnumber100.0Radius of the magnifying glass in pixels.
outlineColorhex0xccccccColor of the glass' outline.
outlineThicknessnumber8.0Thickness of the glass' outline in pixels. Can be set to 0.
antialiasBooleantrueWhether to add an antialiasing pass or not.
inputBufferWebGLRenderTargetBuffer filled with the original scene render. In case inputBuffer is not supplied, the canvas will be the input buffer.
outputBufferWebGLRenderTargetRender target. In case outputBuffer is not supplied, the output will be directly on the screen.

Contribute

If you have a feature request, please add it as an issue or make a pull request.

References

License

MIT