ThatOpen / engine_components

MIT License
350 stars 134 forks source link

Cannot set properties of undefined (setting 'enabled') for postProduction #392

Closed danieleCTM closed 6 months ago

danieleCTM commented 6 months ago

Describe the bug πŸ“

Hi everyone, I have a problem with this line of code: components.renderer.postproduction.enabled = true; I'm getting the error: main.js:15 Uncaught TypeError: Cannot set properties of undefined (setting 'enabled') Below is the code preceding that line of code. How do I fix it? I don't think I've done anything wrong?

import './style.css';
import * as THREE from 'three';
import * as OBC from 'openbim-components';

// Ottieni il contenitore per il viewer
const container = document.getElementById('container');

// Crea l'istanza di Components
const components = new OBC.Components();
components.scene = new OBC.SimpleScene(components);
components.renderer = new OBC.SimpleRenderer(components, container);
components.camera = new OBC.SimpleCamera(components);
components.raycaster = new OBC.SimpleRaycaster(components);

components.renderer.postproduction.enabled = true;
components.renderer.postproduction.customEffects.outlineEnabled = true;

Reproduction ▢️

No response

Steps to reproduce πŸ”’

No response

System Info πŸ’»

Google Chrome 124.0.6367.209

  System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 17.22 GB / 31.74 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (124.0.2478.67)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    openbim-components: ^1.5.1 => 1.5.1

Used Package Manager πŸ“¦

npm

Error Trace/Logs πŸ“ƒ

No response

Validations βœ…

danieleCTM commented 6 months ago

solved changing from simplerender to PostproductionRenderer

components.renderer = new OBC.PostproductionRenderer(components, container); It should be clarified in the documentation