@omerrgocmen/crewctl 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -0
- package/orchestrator/LICENSE +21 -0
- package/orchestrator/README.md +452 -0
- package/orchestrator/config.default.json +65 -0
- package/orchestrator/roles/executor.md +49 -0
- package/orchestrator/roles/operator-chat.md +25 -0
- package/orchestrator/roles/operator.md +75 -0
- package/orchestrator/roles/planner.md +53 -0
- package/orchestrator/roles/reviewer.md +54 -0
- package/orchestrator/skills/acceptance-criteria.md +18 -0
- package/orchestrator/skills/accessibility-audit.md +16 -0
- package/orchestrator/skills/accessible-forms.md +16 -0
- package/orchestrator/skills/api-design.md +27 -0
- package/orchestrator/skills/api-documentation.md +16 -0
- package/orchestrator/skills/architecture-decision-record.md +18 -0
- package/orchestrator/skills/authentication-design.md +16 -0
- package/orchestrator/skills/authorization-review.md +16 -0
- package/orchestrator/skills/backward-compatibility.md +17 -0
- package/orchestrator/skills/changelog-writing.md +16 -0
- package/orchestrator/skills/ci-pipeline-design.md +16 -0
- package/orchestrator/skills/cli-design.md +16 -0
- package/orchestrator/skills/code-review.md +27 -0
- package/orchestrator/skills/configuration-management.md +16 -0
- package/orchestrator/skills/container-review.md +16 -0
- package/orchestrator/skills/contract-testing.md +16 -0
- package/orchestrator/skills/dashboard-design.md +16 -0
- package/orchestrator/skills/database-migration.md +16 -0
- package/orchestrator/skills/database-schema-design.md +16 -0
- package/orchestrator/skills/debugging.md +26 -0
- package/orchestrator/skills/dependency-review.md +16 -0
- package/orchestrator/skills/design-review.md +29 -0
- package/orchestrator/skills/design-system.md +16 -0
- package/orchestrator/skills/docs-api-reference.md +16 -0
- package/orchestrator/skills/docs-troubleshooting.md +16 -0
- package/orchestrator/skills/docs-tutorial.md +16 -0
- package/orchestrator/skills/docs-writing.md +25 -0
- package/orchestrator/skills/empty-error-loading-states.md +16 -0
- package/orchestrator/skills/end-to-end-testing.md +16 -0
- package/orchestrator/skills/error-handling.md +16 -0
- package/orchestrator/skills/frontend-design.md +28 -0
- package/orchestrator/skills/git-commit-writing.md +16 -0
- package/orchestrator/skills/graphql-design.md +16 -0
- package/orchestrator/skills/incident-runbook.md +18 -0
- package/orchestrator/skills/input-validation.md +16 -0
- package/orchestrator/skills/integration-testing.md +16 -0
- package/orchestrator/skills/interaction-design.md +16 -0
- package/orchestrator/skills/landing-page-design.md +16 -0
- package/orchestrator/skills/observability-design.md +16 -0
- package/orchestrator/skills/openapi-contract.md +16 -0
- package/orchestrator/skills/performance-profiling.md +16 -0
- package/orchestrator/skills/privacy-review.md +16 -0
- package/orchestrator/skills/property-based-testing.md +16 -0
- package/orchestrator/skills/pull-request-writing.md +16 -0
- package/orchestrator/skills/refactoring.md +16 -0
- package/orchestrator/skills/release-readiness.md +16 -0
- package/orchestrator/skills/responsive-design.md +16 -0
- package/orchestrator/skills/secrets-management.md +16 -0
- package/orchestrator/skills/secure-file-upload.md +16 -0
- package/orchestrator/skills/security-review.md +26 -0
- package/orchestrator/skills/semantic-versioning.md +17 -0
- package/orchestrator/skills/seo-on-page.md +16 -0
- package/orchestrator/skills/seo-structured-data.md +16 -0
- package/orchestrator/skills/seo-technical-audit.md +16 -0
- package/orchestrator/skills/sql-query-review.md +16 -0
- package/orchestrator/skills/supply-chain-security.md +16 -0
- package/orchestrator/skills/test-strategy.md +16 -0
- package/orchestrator/skills/threat-modeling.md +16 -0
- package/orchestrator/skills/unit-testing.md +16 -0
- package/orchestrator/skills/write-tests.md +28 -0
- package/orchestrator/src/checkpoints.js +187 -0
- package/orchestrator/src/cli-registry.js +579 -0
- package/orchestrator/src/cli.js +135 -0
- package/orchestrator/src/doctor.js +64 -0
- package/orchestrator/src/engine.js +1364 -0
- package/orchestrator/src/schedule.js +126 -0
- package/orchestrator/src/server.js +706 -0
- package/orchestrator/src/skill-registry.js +272 -0
- package/orchestrator/src/store.js +364 -0
- package/orchestrator/web/OrbitControls.js +1417 -0
- package/orchestrator/web/app.css +116 -0
- package/orchestrator/web/app.js +70 -0
- package/orchestrator/web/board.html +141 -0
- package/orchestrator/web/code.html +208 -0
- package/orchestrator/web/flow.html +736 -0
- package/orchestrator/web/index.html +539 -0
- package/orchestrator/web/jsm/postprocessing/EffectComposer.js +231 -0
- package/orchestrator/web/jsm/postprocessing/MaskPass.js +104 -0
- package/orchestrator/web/jsm/postprocessing/Pass.js +95 -0
- package/orchestrator/web/jsm/postprocessing/RenderPass.js +99 -0
- package/orchestrator/web/jsm/postprocessing/ShaderPass.js +77 -0
- package/orchestrator/web/jsm/postprocessing/UnrealBloomPass.js +415 -0
- package/orchestrator/web/jsm/shaders/CopyShader.js +45 -0
- package/orchestrator/web/jsm/shaders/LuminosityHighPassShader.js +66 -0
- package/orchestrator/web/three.module.min.js +6 -0
- package/package.json +51 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Clock,
|
|
3
|
+
HalfFloatType,
|
|
4
|
+
NoBlending,
|
|
5
|
+
Vector2,
|
|
6
|
+
WebGLRenderTarget
|
|
7
|
+
} from 'three';
|
|
8
|
+
import { CopyShader } from '../shaders/CopyShader.js';
|
|
9
|
+
import { ShaderPass } from './ShaderPass.js';
|
|
10
|
+
import { MaskPass } from './MaskPass.js';
|
|
11
|
+
import { ClearMaskPass } from './MaskPass.js';
|
|
12
|
+
|
|
13
|
+
class EffectComposer {
|
|
14
|
+
|
|
15
|
+
constructor( renderer, renderTarget ) {
|
|
16
|
+
|
|
17
|
+
this.renderer = renderer;
|
|
18
|
+
|
|
19
|
+
this._pixelRatio = renderer.getPixelRatio();
|
|
20
|
+
|
|
21
|
+
if ( renderTarget === undefined ) {
|
|
22
|
+
|
|
23
|
+
const size = renderer.getSize( new Vector2() );
|
|
24
|
+
this._width = size.width;
|
|
25
|
+
this._height = size.height;
|
|
26
|
+
|
|
27
|
+
renderTarget = new WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: HalfFloatType } );
|
|
28
|
+
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
29
|
+
|
|
30
|
+
} else {
|
|
31
|
+
|
|
32
|
+
this._width = renderTarget.width;
|
|
33
|
+
this._height = renderTarget.height;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.renderTarget1 = renderTarget;
|
|
38
|
+
this.renderTarget2 = renderTarget.clone();
|
|
39
|
+
this.renderTarget2.texture.name = 'EffectComposer.rt2';
|
|
40
|
+
|
|
41
|
+
this.writeBuffer = this.renderTarget1;
|
|
42
|
+
this.readBuffer = this.renderTarget2;
|
|
43
|
+
|
|
44
|
+
this.renderToScreen = true;
|
|
45
|
+
|
|
46
|
+
this.passes = [];
|
|
47
|
+
|
|
48
|
+
this.copyPass = new ShaderPass( CopyShader );
|
|
49
|
+
this.copyPass.material.blending = NoBlending;
|
|
50
|
+
|
|
51
|
+
this.clock = new Clock();
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
swapBuffers() {
|
|
56
|
+
|
|
57
|
+
const tmp = this.readBuffer;
|
|
58
|
+
this.readBuffer = this.writeBuffer;
|
|
59
|
+
this.writeBuffer = tmp;
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
addPass( pass ) {
|
|
64
|
+
|
|
65
|
+
this.passes.push( pass );
|
|
66
|
+
pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
insertPass( pass, index ) {
|
|
71
|
+
|
|
72
|
+
this.passes.splice( index, 0, pass );
|
|
73
|
+
pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
removePass( pass ) {
|
|
78
|
+
|
|
79
|
+
const index = this.passes.indexOf( pass );
|
|
80
|
+
|
|
81
|
+
if ( index !== - 1 ) {
|
|
82
|
+
|
|
83
|
+
this.passes.splice( index, 1 );
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
isLastEnabledPass( passIndex ) {
|
|
90
|
+
|
|
91
|
+
for ( let i = passIndex + 1; i < this.passes.length; i ++ ) {
|
|
92
|
+
|
|
93
|
+
if ( this.passes[ i ].enabled ) {
|
|
94
|
+
|
|
95
|
+
return false;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return true;
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
render( deltaTime ) {
|
|
106
|
+
|
|
107
|
+
// deltaTime value is in seconds
|
|
108
|
+
|
|
109
|
+
if ( deltaTime === undefined ) {
|
|
110
|
+
|
|
111
|
+
deltaTime = this.clock.getDelta();
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const currentRenderTarget = this.renderer.getRenderTarget();
|
|
116
|
+
|
|
117
|
+
let maskActive = false;
|
|
118
|
+
|
|
119
|
+
for ( let i = 0, il = this.passes.length; i < il; i ++ ) {
|
|
120
|
+
|
|
121
|
+
const pass = this.passes[ i ];
|
|
122
|
+
|
|
123
|
+
if ( pass.enabled === false ) continue;
|
|
124
|
+
|
|
125
|
+
pass.renderToScreen = ( this.renderToScreen && this.isLastEnabledPass( i ) );
|
|
126
|
+
pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive );
|
|
127
|
+
|
|
128
|
+
if ( pass.needsSwap ) {
|
|
129
|
+
|
|
130
|
+
if ( maskActive ) {
|
|
131
|
+
|
|
132
|
+
const context = this.renderer.getContext();
|
|
133
|
+
const stencil = this.renderer.state.buffers.stencil;
|
|
134
|
+
|
|
135
|
+
//context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );
|
|
136
|
+
stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff );
|
|
137
|
+
|
|
138
|
+
this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime );
|
|
139
|
+
|
|
140
|
+
//context.stencilFunc( context.EQUAL, 1, 0xffffffff );
|
|
141
|
+
stencil.setFunc( context.EQUAL, 1, 0xffffffff );
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.swapBuffers();
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if ( MaskPass !== undefined ) {
|
|
150
|
+
|
|
151
|
+
if ( pass instanceof MaskPass ) {
|
|
152
|
+
|
|
153
|
+
maskActive = true;
|
|
154
|
+
|
|
155
|
+
} else if ( pass instanceof ClearMaskPass ) {
|
|
156
|
+
|
|
157
|
+
maskActive = false;
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.renderer.setRenderTarget( currentRenderTarget );
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
reset( renderTarget ) {
|
|
170
|
+
|
|
171
|
+
if ( renderTarget === undefined ) {
|
|
172
|
+
|
|
173
|
+
const size = this.renderer.getSize( new Vector2() );
|
|
174
|
+
this._pixelRatio = this.renderer.getPixelRatio();
|
|
175
|
+
this._width = size.width;
|
|
176
|
+
this._height = size.height;
|
|
177
|
+
|
|
178
|
+
renderTarget = this.renderTarget1.clone();
|
|
179
|
+
renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.renderTarget1.dispose();
|
|
184
|
+
this.renderTarget2.dispose();
|
|
185
|
+
this.renderTarget1 = renderTarget;
|
|
186
|
+
this.renderTarget2 = renderTarget.clone();
|
|
187
|
+
|
|
188
|
+
this.writeBuffer = this.renderTarget1;
|
|
189
|
+
this.readBuffer = this.renderTarget2;
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
setSize( width, height ) {
|
|
194
|
+
|
|
195
|
+
this._width = width;
|
|
196
|
+
this._height = height;
|
|
197
|
+
|
|
198
|
+
const effectiveWidth = this._width * this._pixelRatio;
|
|
199
|
+
const effectiveHeight = this._height * this._pixelRatio;
|
|
200
|
+
|
|
201
|
+
this.renderTarget1.setSize( effectiveWidth, effectiveHeight );
|
|
202
|
+
this.renderTarget2.setSize( effectiveWidth, effectiveHeight );
|
|
203
|
+
|
|
204
|
+
for ( let i = 0; i < this.passes.length; i ++ ) {
|
|
205
|
+
|
|
206
|
+
this.passes[ i ].setSize( effectiveWidth, effectiveHeight );
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
setPixelRatio( pixelRatio ) {
|
|
213
|
+
|
|
214
|
+
this._pixelRatio = pixelRatio;
|
|
215
|
+
|
|
216
|
+
this.setSize( this._width, this._height );
|
|
217
|
+
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
dispose() {
|
|
221
|
+
|
|
222
|
+
this.renderTarget1.dispose();
|
|
223
|
+
this.renderTarget2.dispose();
|
|
224
|
+
|
|
225
|
+
this.copyPass.dispose();
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export { EffectComposer };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Pass } from './Pass.js';
|
|
2
|
+
|
|
3
|
+
class MaskPass extends Pass {
|
|
4
|
+
|
|
5
|
+
constructor( scene, camera ) {
|
|
6
|
+
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this.scene = scene;
|
|
10
|
+
this.camera = camera;
|
|
11
|
+
|
|
12
|
+
this.clear = true;
|
|
13
|
+
this.needsSwap = false;
|
|
14
|
+
|
|
15
|
+
this.inverse = false;
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
|
|
20
|
+
|
|
21
|
+
const context = renderer.getContext();
|
|
22
|
+
const state = renderer.state;
|
|
23
|
+
|
|
24
|
+
// don't update color or depth
|
|
25
|
+
|
|
26
|
+
state.buffers.color.setMask( false );
|
|
27
|
+
state.buffers.depth.setMask( false );
|
|
28
|
+
|
|
29
|
+
// lock buffers
|
|
30
|
+
|
|
31
|
+
state.buffers.color.setLocked( true );
|
|
32
|
+
state.buffers.depth.setLocked( true );
|
|
33
|
+
|
|
34
|
+
// set up stencil
|
|
35
|
+
|
|
36
|
+
let writeValue, clearValue;
|
|
37
|
+
|
|
38
|
+
if ( this.inverse ) {
|
|
39
|
+
|
|
40
|
+
writeValue = 0;
|
|
41
|
+
clearValue = 1;
|
|
42
|
+
|
|
43
|
+
} else {
|
|
44
|
+
|
|
45
|
+
writeValue = 1;
|
|
46
|
+
clearValue = 0;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
state.buffers.stencil.setTest( true );
|
|
51
|
+
state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE );
|
|
52
|
+
state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff );
|
|
53
|
+
state.buffers.stencil.setClear( clearValue );
|
|
54
|
+
state.buffers.stencil.setLocked( true );
|
|
55
|
+
|
|
56
|
+
// draw into the stencil buffer
|
|
57
|
+
|
|
58
|
+
renderer.setRenderTarget( readBuffer );
|
|
59
|
+
if ( this.clear ) renderer.clear();
|
|
60
|
+
renderer.render( this.scene, this.camera );
|
|
61
|
+
|
|
62
|
+
renderer.setRenderTarget( writeBuffer );
|
|
63
|
+
if ( this.clear ) renderer.clear();
|
|
64
|
+
renderer.render( this.scene, this.camera );
|
|
65
|
+
|
|
66
|
+
// unlock color and depth buffer and make them writable for subsequent rendering/clearing
|
|
67
|
+
|
|
68
|
+
state.buffers.color.setLocked( false );
|
|
69
|
+
state.buffers.depth.setLocked( false );
|
|
70
|
+
|
|
71
|
+
state.buffers.color.setMask( true );
|
|
72
|
+
state.buffers.depth.setMask( true );
|
|
73
|
+
|
|
74
|
+
// only render where stencil is set to 1
|
|
75
|
+
|
|
76
|
+
state.buffers.stencil.setLocked( false );
|
|
77
|
+
state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
|
|
78
|
+
state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );
|
|
79
|
+
state.buffers.stencil.setLocked( true );
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class ClearMaskPass extends Pass {
|
|
86
|
+
|
|
87
|
+
constructor() {
|
|
88
|
+
|
|
89
|
+
super();
|
|
90
|
+
|
|
91
|
+
this.needsSwap = false;
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render( renderer /*, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
|
|
96
|
+
|
|
97
|
+
renderer.state.buffers.stencil.setLocked( false );
|
|
98
|
+
renderer.state.buffers.stencil.setTest( false );
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { MaskPass, ClearMaskPass };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BufferGeometry,
|
|
3
|
+
Float32BufferAttribute,
|
|
4
|
+
OrthographicCamera,
|
|
5
|
+
Mesh
|
|
6
|
+
} from 'three';
|
|
7
|
+
|
|
8
|
+
class Pass {
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
|
|
12
|
+
this.isPass = true;
|
|
13
|
+
|
|
14
|
+
// if set to true, the pass is processed by the composer
|
|
15
|
+
this.enabled = true;
|
|
16
|
+
|
|
17
|
+
// if set to true, the pass indicates to swap read and write buffer after rendering
|
|
18
|
+
this.needsSwap = true;
|
|
19
|
+
|
|
20
|
+
// if set to true, the pass clears its buffer before rendering
|
|
21
|
+
this.clear = false;
|
|
22
|
+
|
|
23
|
+
// if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
|
|
24
|
+
this.renderToScreen = false;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setSize( /* width, height */ ) {}
|
|
29
|
+
|
|
30
|
+
render( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
|
|
31
|
+
|
|
32
|
+
console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
dispose() {}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Helper for passes that need to fill the viewport with a single quad.
|
|
41
|
+
|
|
42
|
+
const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
|
|
43
|
+
|
|
44
|
+
// https://github.com/mrdoob/three.js/pull/21358
|
|
45
|
+
|
|
46
|
+
class FullscreenTriangleGeometry extends BufferGeometry {
|
|
47
|
+
|
|
48
|
+
constructor() {
|
|
49
|
+
|
|
50
|
+
super();
|
|
51
|
+
|
|
52
|
+
this.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
|
|
53
|
+
this.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const _geometry = new FullscreenTriangleGeometry();
|
|
60
|
+
|
|
61
|
+
class FullScreenQuad {
|
|
62
|
+
|
|
63
|
+
constructor( material ) {
|
|
64
|
+
|
|
65
|
+
this._mesh = new Mesh( _geometry, material );
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
dispose() {
|
|
70
|
+
|
|
71
|
+
this._mesh.geometry.dispose();
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
render( renderer ) {
|
|
76
|
+
|
|
77
|
+
renderer.render( this._mesh, _camera );
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get material() {
|
|
82
|
+
|
|
83
|
+
return this._mesh.material;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set material( value ) {
|
|
88
|
+
|
|
89
|
+
this._mesh.material = value;
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { Pass, FullScreenQuad };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Color
|
|
3
|
+
} from 'three';
|
|
4
|
+
import { Pass } from './Pass.js';
|
|
5
|
+
|
|
6
|
+
class RenderPass extends Pass {
|
|
7
|
+
|
|
8
|
+
constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
|
|
9
|
+
|
|
10
|
+
super();
|
|
11
|
+
|
|
12
|
+
this.scene = scene;
|
|
13
|
+
this.camera = camera;
|
|
14
|
+
|
|
15
|
+
this.overrideMaterial = overrideMaterial;
|
|
16
|
+
|
|
17
|
+
this.clearColor = clearColor;
|
|
18
|
+
this.clearAlpha = clearAlpha;
|
|
19
|
+
|
|
20
|
+
this.clear = true;
|
|
21
|
+
this.clearDepth = false;
|
|
22
|
+
this.needsSwap = false;
|
|
23
|
+
this._oldClearColor = new Color();
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
|
|
28
|
+
|
|
29
|
+
const oldAutoClear = renderer.autoClear;
|
|
30
|
+
renderer.autoClear = false;
|
|
31
|
+
|
|
32
|
+
let oldClearAlpha, oldOverrideMaterial;
|
|
33
|
+
|
|
34
|
+
if ( this.overrideMaterial !== null ) {
|
|
35
|
+
|
|
36
|
+
oldOverrideMaterial = this.scene.overrideMaterial;
|
|
37
|
+
|
|
38
|
+
this.scene.overrideMaterial = this.overrideMaterial;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if ( this.clearColor !== null ) {
|
|
43
|
+
|
|
44
|
+
renderer.getClearColor( this._oldClearColor );
|
|
45
|
+
renderer.setClearColor( this.clearColor );
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if ( this.clearAlpha !== null ) {
|
|
50
|
+
|
|
51
|
+
oldClearAlpha = renderer.getClearAlpha();
|
|
52
|
+
renderer.setClearAlpha( this.clearAlpha );
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if ( this.clearDepth == true ) {
|
|
57
|
+
|
|
58
|
+
renderer.clearDepth();
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
|
|
63
|
+
|
|
64
|
+
if ( this.clear === true ) {
|
|
65
|
+
|
|
66
|
+
// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
67
|
+
renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
renderer.render( this.scene, this.camera );
|
|
72
|
+
|
|
73
|
+
// restore
|
|
74
|
+
|
|
75
|
+
if ( this.clearColor !== null ) {
|
|
76
|
+
|
|
77
|
+
renderer.setClearColor( this._oldClearColor );
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ( this.clearAlpha !== null ) {
|
|
82
|
+
|
|
83
|
+
renderer.setClearAlpha( oldClearAlpha );
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if ( this.overrideMaterial !== null ) {
|
|
88
|
+
|
|
89
|
+
this.scene.overrideMaterial = oldOverrideMaterial;
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
renderer.autoClear = oldAutoClear;
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { RenderPass };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShaderMaterial,
|
|
3
|
+
UniformsUtils
|
|
4
|
+
} from 'three';
|
|
5
|
+
import { Pass, FullScreenQuad } from './Pass.js';
|
|
6
|
+
|
|
7
|
+
class ShaderPass extends Pass {
|
|
8
|
+
|
|
9
|
+
constructor( shader, textureID ) {
|
|
10
|
+
|
|
11
|
+
super();
|
|
12
|
+
|
|
13
|
+
this.textureID = ( textureID !== undefined ) ? textureID : 'tDiffuse';
|
|
14
|
+
|
|
15
|
+
if ( shader instanceof ShaderMaterial ) {
|
|
16
|
+
|
|
17
|
+
this.uniforms = shader.uniforms;
|
|
18
|
+
|
|
19
|
+
this.material = shader;
|
|
20
|
+
|
|
21
|
+
} else if ( shader ) {
|
|
22
|
+
|
|
23
|
+
this.uniforms = UniformsUtils.clone( shader.uniforms );
|
|
24
|
+
|
|
25
|
+
this.material = new ShaderMaterial( {
|
|
26
|
+
|
|
27
|
+
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
|
|
28
|
+
defines: Object.assign( {}, shader.defines ),
|
|
29
|
+
uniforms: this.uniforms,
|
|
30
|
+
vertexShader: shader.vertexShader,
|
|
31
|
+
fragmentShader: shader.fragmentShader
|
|
32
|
+
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.fsQuad = new FullScreenQuad( this.material );
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
|
|
42
|
+
|
|
43
|
+
if ( this.uniforms[ this.textureID ] ) {
|
|
44
|
+
|
|
45
|
+
this.uniforms[ this.textureID ].value = readBuffer.texture;
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.fsQuad.material = this.material;
|
|
50
|
+
|
|
51
|
+
if ( this.renderToScreen ) {
|
|
52
|
+
|
|
53
|
+
renderer.setRenderTarget( null );
|
|
54
|
+
this.fsQuad.render( renderer );
|
|
55
|
+
|
|
56
|
+
} else {
|
|
57
|
+
|
|
58
|
+
renderer.setRenderTarget( writeBuffer );
|
|
59
|
+
// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
60
|
+
if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
61
|
+
this.fsQuad.render( renderer );
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
dispose() {
|
|
68
|
+
|
|
69
|
+
this.material.dispose();
|
|
70
|
+
|
|
71
|
+
this.fsQuad.dispose();
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { ShaderPass };
|