Giter Site home page Giter Site logo

Comments (4)

sasha240100 avatar sasha240100 commented on June 4, 2024

Hi @antoniocapelo !

Any PRs are welcome! :D
PostProcessorModule creates a new renderTarget. Typically there are only inputBuffer and outputBuffer, but some advanced passes may require more which makes this thing unpredictable.

What you can do is to try to update them manually with this pseudo-code:

// WARNING: Not tested

const {composer} = app.use('postprocessing');

app.use('resize').addCallback((width, height) => {
  // Update buffer sizes
  composer.inputBuffer.setSize(width, height);
  composer.outputBuffer.setSize(width, height);
});

from whs.js.

antoniocapelo avatar antoniocapelo commented on June 4, 2024

Hi @sasha240100, I'm willing to help :D Just point me to the better option, would be it be something inside the codebase? A note on the docs?

What I've done was create a ResponsivePostprocessorModule (ignore the name) that does the following:

class ResponsiveEffectComposerModule {
    manager(manager) {
        manager.define('effectComposerResizeHandler');
        const resizeModule = manager.use('resize');

        this.postprocessorModule = manager.use('postprocessor');

        if (!resizeModule) {
            throw new Error('ResizeModule dependency not met. Make sure that ResizeModule is listed as a dependecy of App.');
        }

        if (!this.postprocessorModule) {
            throw new Error('PostProcessorModule dependency not met. Make sure that PostProcessorModule is listed as a dependecy of App.');
        }

        resizeModule.addCallback(this.updateRendererSize.bind(this));
        this.updateRendererSize(window.innerWidth, window.innerHeight);
    }

    updateRendererSize = (windowWidth, windowHeight) => {
        this.postprocessorModule.composer.setSize(windowWidth, windowHeight);
    }
}

I just add this module to the App's module list (in the correct order) and now when I resize the window everything stays sharp.

Probably what you suggested would be needed if my problem persisted?

from whs.js.

sasha240100 avatar sasha240100 commented on June 4, 2024

Looks nice and useful! @antoniocapelo You may even drop !resizeModule checks as they should be already done by ModuleSystem.

We're now working more on https://github.com/WhitestormJS/nextgl , which should become a Three.js replacement for Whitestorm.js v3.x, so most of out time & skills are going to that project. Contact me if you are willing to contribute to that one! :)

from whs.js.

antoniocapelo avatar antoniocapelo commented on June 4, 2024

@sasha240100 check your twitter DM's (:

from whs.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.