-
-
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
Update Shader and UniformsUtils #719
Merged
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6af4635
feat: Add defines property
vanruesc abb1a31
feat: Specify types of params and return values
vanruesc 55a28ab
feat: Fix type of mergeUniforms param
vanruesc 27ba192
Update types/three/src/renderers/shaders/UniformsUtils.d.ts
vanruesc e0896ec
feat: Create WebGLProgramParameters
vanruesc 97138d9
feat: Let Shader extend WebGLProgramParameters
vanruesc 3b264ef
feat: Use WebGLProgramParameters in WebGLPrograms
vanruesc 11f3620
feat: Specify more types in WebGLPrograms
vanruesc 58cdb3d
formatting
vanruesc 25ba2ba
Update examples testing patch
Methuselah96 949e863
feat: Clearly separate Shader from WebGLProgramParameters
vanruesc 16466ad
feat: Move WebGLProgramParameters to WebGLPrograms
vanruesc 639ed7d
feat: Add WebGLProgramParametersWithUniforms
vanruesc 94269e5
feat: Use WebGLProgramParametersWithUniforms in onBeforeCompile
vanruesc 6d74a6d
PR suggestions
vanruesc cf3a436
Merge branch 'feat/shaders' of https://github.com/vanruesc/three-ts-t…
vanruesc 03bd554
Update examples testing patch
Methuselah96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
199 changes: 199 additions & 0 deletions
199
types/three/src/renderers/webgl/WebGLProgramParameters.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
import { | ||
ColorSpace, | ||
Combine, | ||
DepthPackingStrategies, | ||
GLSLVersion, | ||
ShadowMapType, | ||
ToneMapping, | ||
} from '../../constants.js'; | ||
|
||
export interface WebGLProgramParameters { | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
isWebGL2: boolean; | ||
|
||
shaderID: string; | ||
shaderType: string; | ||
shaderName: string; | ||
|
||
vertexShader: string; | ||
fragmentShader: string; | ||
defines?: { [define: string]: string | number | boolean }; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
customVertexShaderID?: string; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
customFragmentShaderID?: string; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
isRawShaderMaterial: boolean; | ||
glslVersion?: GLSLVersion; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
precision: 'lowp' | 'mediump' | 'highp'; | ||
|
||
batching: boolean; | ||
instancing: boolean; | ||
instancingColor: boolean; | ||
|
||
supportsVertexTextures: boolean; | ||
outputColorSpace: ColorSpace; | ||
|
||
map: boolean; | ||
matcap: boolean; | ||
envMap: boolean; | ||
envMapMode: boolean; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
envMapCubeUVHeight: number | null; | ||
aoMap: boolean; | ||
lightMap: boolean; | ||
bumpMap: boolean; | ||
normalMap: boolean; | ||
displacementMap: boolean; | ||
emissiveMap: boolean; | ||
|
||
normalMapObjectSpace: boolean; | ||
normalMapTangentSpace: boolean; | ||
|
||
metalnessMap: boolean; | ||
roughnessMap: boolean; | ||
|
||
anisotropy: boolean; | ||
anisotropyMap: boolean; | ||
|
||
clearcoat: boolean; | ||
clearcoatMap: boolean; | ||
clearcoatNormalMap: boolean; | ||
clearcoatRoughnessMap: boolean; | ||
|
||
iridescence: boolean; | ||
iridescenceMap: boolean; | ||
iridescenceThicknessMap: boolean; | ||
|
||
sheen: boolean; | ||
sheenColorMap: boolean; | ||
sheenRoughnessMap: boolean; | ||
|
||
specularMap: boolean; | ||
specularColorMap: boolean; | ||
specularIntensityMap: boolean; | ||
|
||
transmission: boolean; | ||
transmissionMap: boolean; | ||
thicknessMap: boolean; | ||
|
||
gradientMap: boolean; | ||
|
||
opaque: boolean; | ||
|
||
alphaMap: boolean; | ||
alphaTest: boolean; | ||
alphaHash: boolean; | ||
|
||
combine: Combine; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// | ||
|
||
mapUv: boolean; | ||
aoMapUv: boolean; | ||
lightMapUv: boolean; | ||
bumpMapUv: boolean; | ||
normalMapUv: boolean; | ||
displacementMapUv: boolean; | ||
emissiveMapUv: boolean; | ||
|
||
metalnessMapUv: boolean; | ||
roughnessMapUv: boolean; | ||
|
||
anisotropyMapUv: boolean; | ||
|
||
clearcoatMapUv: boolean; | ||
clearcoatNormalMapUv: boolean; | ||
clearcoatRoughnessMapUv: boolean; | ||
|
||
iridescenceMapUv: boolean; | ||
iridescenceThicknessMapUv: boolean; | ||
|
||
sheenColorMapUv: boolean; | ||
sheenRoughnessMapUv: boolean; | ||
|
||
specularMapUv: boolean; | ||
specularColorMapUv: boolean; | ||
specularIntensityMapUv: boolean; | ||
|
||
transmissionMapUv: boolean; | ||
thicknessMapUv: boolean; | ||
|
||
alphaMapUv: boolean; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// | ||
|
||
vertexTangents: boolean; | ||
vertexColors: boolean; | ||
vertexAlphas: boolean; | ||
vertexUv1s: boolean; | ||
vertexUv2s: boolean; | ||
vertexUv3s: boolean; | ||
|
||
pointsUvs: boolean; | ||
|
||
fog: boolean; | ||
useFog: boolean; | ||
fogExp2: boolean | null; // null is possible because of a bug: ( fog && fog.isFogExp2 ) | ||
|
||
flatShading: boolean; | ||
|
||
sizeAttenuation: boolean; | ||
logarithmicDepthBuffer: boolean; | ||
|
||
skinning: boolean; | ||
|
||
morphTargets: boolean; | ||
morphNormals: boolean; | ||
morphColors: boolean; | ||
morphTargetsCount: number; | ||
morphTextureStride: number; | ||
|
||
numDirLights: number; | ||
numPointLights: number; | ||
numSpotLights: number; | ||
numSpotLightMaps: number; | ||
numRectAreaLights: number; | ||
numHemiLights: number; | ||
|
||
numDirLightShadows: number; | ||
numPointLightShadows: number; | ||
numSpotLightShadows: number; | ||
numSpotLightShadowsWithMaps: number; | ||
|
||
numLightProbes: number; | ||
|
||
numClippingPlanes: number; | ||
numClipIntersection: number; | ||
|
||
dithering: boolean; | ||
|
||
shadowMapEnabled: boolean; | ||
shadowMapType: ShadowMapType; | ||
|
||
toneMapping: ToneMapping; | ||
useLegacyLights: boolean; | ||
|
||
decodeVideoTexture: boolean; | ||
|
||
premultipliedAlpha: boolean; | ||
|
||
doubleSided: boolean; | ||
flipSided: boolean; | ||
|
||
useDepthPacking: boolean; | ||
depthPacking: DepthPackingStrategies; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
index0AttributeName: string; | ||
vanruesc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
extensionDerivatives: boolean; | ||
extensionFragDepth: boolean; | ||
extensionDrawBuffers: boolean; | ||
extensionShaderTextureLOD: boolean; | ||
extensionClipCullDistance: boolean; | ||
|
||
rendererExtensionFragDepth: boolean; | ||
rendererExtensionDrawBuffers: boolean; | ||
rendererExtensionShaderTextureLod: boolean; | ||
rendererExtensionParallelShaderCompile: boolean; | ||
|
||
customProgramCacheKey: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should I rename
Shader
toWebGLProgramParametersWithUniforms
? I thinkShader
works too as a parameter type.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 was actually thinking we'd keep
Shader
as-is, since it's really just intended to describe the type of shaders inShaderLib
. Maybe it should be renamed toShaderLibShader
to make that more clear? I was thinking we'd export aWebGLProgramParametersWithUniforms
interface fromWebGLRenderer
.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've exported
WebGLProgramParametersWithUniforms
fromWebGLPrograms
since it's used there as a param type foracquireProgram
. Is there a specific reason why it should be inWebGLRenderer
?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.
No, that should be fine, thanks.