-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ae77969
Showing
21 changed files
with
1,620 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Faraz Shaikh | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,12 @@ | ||
import { CustomShaderMaterialProps } from './types'; | ||
import { default as CustomShaderMaterialImpl, MaterialConstructor } from '../index'; | ||
import { Material } from 'three'; | ||
import { AttachType } from '@react-three/fiber/dist/declarations/src/core/renderer'; | ||
|
||
import * as React from "react"; | ||
declare const _default: <T extends MaterialConstructor = typeof Material>(props: CustomShaderMaterialProps<T> & { | ||
ref?: React.Ref<CustomShaderMaterialImpl<T>>; | ||
attach?: AttachType; | ||
}) => React.ReactElement; | ||
export default _default; | ||
export { type CustomShaderMaterialProps } from './types'; |
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,3 @@ | ||
import { CustomShaderMaterialParameters, MaterialConstructor } from '../types'; | ||
|
||
export type CustomShaderMaterialProps<T extends MaterialConstructor> = CustomShaderMaterialParameters<T> & {}; |
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,6 @@ | ||
export declare const defaultCsmDefinitions = "\n \n#ifdef IS_VERTEX\n vec3 csm_Position;\n vec4 csm_PositionRaw;\n vec3 csm_Normal;\n\n // csm_PointSize\n #ifdef IS_POINTSMATERIAL\n float csm_PointSize;\n #endif\n#else\n vec4 csm_DiffuseColor;\n vec4 csm_FragColor;\n float csm_FragColorInfluence;\n\n // csm_Emissive, csm_Roughness, csm_Metalness\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL\n vec3 csm_Emissive;\n float csm_Roughness;\n float csm_Metalness;\n float csm_Iridescence;\n \n #if defined IS_MESHPHYSICALMATERIAL\n float csm_Clearcoat;\n float csm_ClearcoatRoughness;\n vec3 csm_ClearcoatNormal;\n float csm_Transmission;\n float csm_Thickness;\n #endif\n #endif\n\n // csm_AO\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHBASICMATERIAL || defined IS_MESHLAMBERTMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHTOONMATERIAL\n float csm_AO;\n #endif\n\n // csm_Bump\n #if defined IS_MESHLAMBERTMATERIAL || defined IS_MESHMATCAPMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHSTANDARDMATERIAL || defined IS_MESHTOONMATERIAL || defined IS_SHADOWMATERIAL \n vec3 csm_Bump;\n #endif\n\n float csm_DepthAlpha;\n#endif\n"; | ||
export declare const defaultCsmMainDefinitions = "\n\n#ifdef IS_VERTEX\n // csm_Position & csm_PositionRaw\n #ifdef IS_UNKNOWN\n csm_Position = vec3(0.0);\n csm_PositionRaw = vec4(0.0);\n csm_Normal = vec3(0.0);\n #else\n csm_Position = position;\n csm_PositionRaw = projectionMatrix * modelViewMatrix * vec4(position, 1.);\n csm_Normal = normal;\n #endif\n\n // csm_PointSize\n #ifdef IS_POINTSMATERIAL\n csm_PointSize = size;\n #endif\n#else\n csm_FragColorInfluence = 0.0;\n\n // csm_DiffuseColor & csm_FragColor\n #if defined IS_UNKNOWN || defined IS_SHADERMATERIAL || defined IS_MESHDEPTHMATERIAL || defined IS_MESHDISTANCEMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_SHADOWMATERIAL\n csm_DiffuseColor = vec4(1.0, 0.0, 1.0, 1.0);\n csm_FragColor = vec4(1.0, 0.0, 1.0, 1.0);\n #else\n #ifdef USE_MAP\n vec4 _csm_sampledDiffuseColor = texture2D(map, vMapUv);\n\n #ifdef DECODE_VIDEO_TEXTURE\n // inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n _csm_sampledDiffuseColor = vec4(mix(pow(_csm_sampledDiffuseColor.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), _csm_sampledDiffuseColor.rgb * 0.0773993808, vec3(lessThanEqual(_csm_sampledDiffuseColor.rgb, vec3(0.04045)))), _csm_sampledDiffuseColor.w);\n #endif\n\n csm_DiffuseColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;\n csm_FragColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;\n #else\n csm_DiffuseColor = vec4(diffuse, opacity);\n csm_FragColor = vec4(diffuse, opacity);\n #endif\n #endif\n\n // csm_Emissive, csm_Roughness, csm_Metalness\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL\n csm_Emissive = emissive;\n csm_Roughness = roughness;\n csm_Metalness = metalness;\n\n #ifdef USE_IRIDESCENCE\n csm_Iridescence = iridescence;\n #else\n csm_Iridescence = 0.0;\n #endif\n\n #if defined IS_MESHPHYSICALMATERIAL\n #ifdef USE_CLEARCOAT\n csm_Clearcoat = clearcoat;\n csm_ClearcoatRoughness = clearcoatRoughness;\n #else\n csm_Clearcoat = 0.0;\n csm_ClearcoatRoughness = 0.0;\n #endif\n\n #ifdef USE_TRANSMISSION\n csm_Transmission = transmission;\n csm_Thickness = thickness;\n #else\n csm_Transmission = 0.0;\n csm_Thickness = 0.0;\n #endif\n #endif\n #endif\n\n // csm_AO\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHBASICMATERIAL || defined IS_MESHLAMBERTMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHTOONMATERIAL\n csm_AO = 0.0;\n #endif\n\n // csm_Bump\n #if defined IS_MESHLAMBERTMATERIAL || defined IS_MESHMATCAPMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHSTANDARDMATERIAL || defined IS_MESHTOONMATERIAL || defined IS_SHADOWMATERIAL \n csm_Bump = vec3(0.0);\n #endif\n\n csm_DepthAlpha = 1.0;\n#endif\n"; | ||
export declare const defaultVertDefinitions = "\n varying mat4 csm_internal_vModelViewMatrix;\n"; | ||
export declare const defaultVertMain = "\n csm_internal_vModelViewMatrix = modelViewMatrix;\n"; | ||
export declare const defaultFragDefinitions = "\n varying mat4 csm_internal_vModelViewMatrix;\n"; | ||
export declare const defaultFragMain = "\n \n"; |
Oops, something went wrong.