-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes in Pass and RenderPass #467
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
import { Scene, Camera, Material, Color } from '../../../src/Three'; | ||
|
||
import { | ||
Scene, | ||
Camera, | ||
Material, | ||
Color, | ||
WebGLMultipleRenderTargets, | ||
WebGLRenderTarget, | ||
WebGLRenderer, | ||
} from '../../../src/Three'; | ||
import { Pass, FullScreenQuad } from './Pass'; | ||
|
||
export class RenderPass extends Pass { | ||
constructor(scene: Scene, camera: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha?: number); | ||
scene: Scene; | ||
camera: Camera; | ||
overrideMaterial: Material; | ||
clearColor: Color; | ||
constructor(scene?: Scene, camera?: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha?: number); | ||
scene?: Scene; | ||
camera?: Camera; | ||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you provide an example or show in the code where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One common way is to pass undefined in the constructor and assign the camera, scene before rendering. This way passes can be initialized before the scene/camera init/load. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just concerned about the properties becoming optional since that would cause any access of those properties to assert that they're not |
||
overrideMaterial?: Material; | ||
clearColor?: Color; | ||
clearAlpha: number; | ||
clearDepth: boolean; | ||
|
||
render( | ||
renderer: WebGLRenderer, | ||
_: WebGLMultipleRenderTargets | WebGLRenderTarget | null, | ||
writeBuffer?: WebGLMultipleRenderTargets | WebGLRenderTarget, | ||
Comment on lines
+23
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the parameters be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In three.js RenderPass.js, the first parameter is ignored and the second parameter is used as writeBuffer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the variables are misnamed in the three.js source code? |
||
deltaTime?: number, | ||
maskActive?: boolean, | ||
): void; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the better fix would be to have
WebGLMultipleRenderTargets
extendWebGLRenderTarget
like it does in the three.js source code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but since the type of texture is an object in
WebGLRenderTarget
and an array inWebGLMultipleRenderTargets
, its not possible to inherit and change type of the property in typescript. This seemed to be the simplest solution for Passes atleast.One way is to make
texture
to beTexture|Texture[]
inWebGLRenderTarget
but that might break a lot of projects and require special type casting at many places.Another way is to make an interface like IWebGLRenderTarget and make both implement it.
I am open to other ideas, would be good to fix type handling of
WebGLMultipleRenderTargets
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I've opened #519 to resolve this.