MCPcopy Create free account
hub / github.com/pmndrs/postprocessing / initialize

Method initialize

demo/src/demos/PatternDemo.js:102–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 }
101
102 initialize() {
103
104 const scene = this.scene;
105 const assets = this.assets;
106 const composer = this.composer;
107 const renderer = composer.getRenderer();
108 const domElement = renderer.domElement;
109
110 // Camera
111
112 const aspect = window.innerWidth / window.innerHeight;
113 const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9));
114 const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000);
115 this.camera = camera;
116
117 // Controls
118
119 const { position, quaternion } = camera;
120 const controls = new SpatialControls(position, quaternion, domElement);
121 const settings = controls.settings;
122 settings.rotation.sensitivity = 2.2;
123 settings.rotation.damping = 0.05;
124 settings.translation.sensitivity = 3.0;
125 settings.translation.damping = 0.1;
126 controls.position.set(-9, 0.5, 0);
127 controls.lookAt(0, 3, -3.5);
128 this.controls = controls;
129
130 // Sky
131
132 scene.background = new Color(0xeeeeee);
133
134 // Lights
135
136 scene.add(...Sponza.createLights());
137
138 // Objects
139
140 scene.add(assets.get(Sponza.tag));
141
142 // Passes
143
144 const smaaEffect = new SMAAEffect(
145 assets.get("smaa-search"),
146 assets.get("smaa-area"),
147 SMAAPreset.HIGH,
148 EdgeDetectionMode.DEPTH
149 );
150
151 smaaEffect.edgeDetectionMaterial.setEdgeDetectionThreshold(0.01);
152
153 const dotScreenEffect = new DotScreenEffect({
154 blendFunction: BlendFunction.LIGHTEN,
155 scale: 0.24,
156 angle: Math.PI * 0.58
157 });
158
159 const gridEffect = new GridEffect({

Callers

nothing calls this directly

Calls 6

calculateVerticalFoVFunction · 0.85
getRendererMethod · 0.80
setMethod · 0.80
addMethod · 0.80
addPassMethod · 0.80

Tested by

no test coverage detected