@galacean/engine-core 2.0.0-alpha.5 → 2.0.0-alpha.51
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/dist/main.js +23869 -20445
- package/dist/main.js.map +1 -1
- package/dist/module.js +23857 -20437
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/assembler/ISpriteAssembler.d.ts +1 -0
- package/types/2d/assembler/ISpriteRenderer.d.ts +3 -2
- package/types/2d/assembler/SimpleSpriteAssembler.d.ts +1 -0
- package/types/2d/assembler/SlicedSpriteAssembler.d.ts +1 -0
- package/types/2d/assembler/TiledSpriteAssembler.d.ts +1 -0
- package/types/2d/atlas/FontAtlas.d.ts +23 -1
- package/types/2d/atlas/SpriteAtlas.d.ts +8 -0
- package/types/2d/sprite/Sprite.d.ts +30 -4
- package/types/2d/sprite/SpriteMask.d.ts +49 -1
- package/types/2d/sprite/SpriteRenderer.d.ts +35 -1
- package/types/2d/text/CharInfo.d.ts +20 -1
- package/types/2d/text/CharRenderInfo.d.ts +15 -1
- package/types/2d/text/Font.d.ts +11 -1
- package/types/2d/text/ITextRenderer.d.ts +3 -0
- package/types/2d/text/SubFont.d.ts +35 -1
- package/types/2d/text/TextRenderer.d.ts +54 -1
- package/types/2d/text/TextUtils.d.ts +89 -1
- package/types/Background.d.ts +19 -2
- package/types/BasicResources.d.ts +52 -0
- package/types/Camera.d.ts +73 -1
- package/types/Canvas.d.ts +36 -7
- package/types/Component.d.ts +35 -2
- package/types/ComponentsDependencies.d.ts +38 -1
- package/types/ComponentsManager.d.ts +17 -0
- package/types/Engine.d.ts +110 -4
- package/types/EngineEventType.d.ts +13 -0
- package/types/Entity.d.ts +112 -21
- package/types/Polyfill.d.ts +12 -1
- package/types/RenderPipeline/BasicRenderPipeline.d.ts +4 -1
- package/types/RenderPipeline/BatcherManager.d.ts +23 -1
- package/types/RenderPipeline/Blitter.d.ts +1 -1
- package/types/RenderPipeline/CullingResults.d.ts +17 -1
- package/types/RenderPipeline/DepthOnlyPass.d.ts +18 -1
- package/types/RenderPipeline/InstanceBuffer.d.ts +28 -0
- package/types/RenderPipeline/MaskManager.d.ts +36 -1
- package/types/RenderPipeline/OpaqueTexturePass.d.ts +16 -1
- package/types/RenderPipeline/PipelineUtils.d.ts +11 -1
- package/types/RenderPipeline/PrimitiveChunk.d.ts +27 -1
- package/types/RenderPipeline/PrimitiveChunkManager.d.ts +16 -1
- package/types/RenderPipeline/RenderContext.d.ts +46 -1
- package/types/RenderPipeline/RenderElement.d.ts +26 -6
- package/types/RenderPipeline/RenderQueue.d.ts +23 -1
- package/types/RenderPipeline/RenderTargetPool.d.ts +17 -1
- package/types/RenderPipeline/SubPrimitiveChunk.d.ts +14 -1
- package/types/RenderPipeline/VertexArea.d.ts +10 -1
- package/types/RenderPipeline/VertexMergeBatcher.d.ts +11 -0
- package/types/RenderPipeline/enums/RenderQueueMaskType.d.ts +9 -1
- package/types/RenderPipeline/index.d.ts +4 -1
- package/types/Renderer.d.ts +81 -18
- package/types/Scene.d.ts +34 -7
- package/types/SceneManager.d.ts +18 -6
- package/types/Script.d.ts +41 -0
- package/types/Signal.d.ts +69 -0
- package/types/SystemInfo.d.ts +13 -0
- package/types/Transform.d.ts +26 -1
- package/types/UpdateFlag.d.ts +4 -1
- package/types/UpdateFlagManager.d.ts +41 -1
- package/types/Utils.d.ts +20 -0
- package/types/VirtualCamera.d.ts +16 -1
- package/types/animation/AnimationClip.d.ts +13 -2
- package/types/animation/AnimationClipCurveBinding.d.ts +17 -2
- package/types/animation/AnimationEvent.d.ts +2 -2
- package/types/animation/Animator.d.ts +49 -10
- package/types/animation/AnimatorController.d.ts +20 -2
- package/types/animation/AnimatorControllerLayer.d.ts +17 -2
- package/types/animation/AnimatorControllerParameter.d.ts +4 -0
- package/types/animation/AnimatorState.d.ts +46 -2
- package/types/animation/AnimatorStateInstance.d.ts +46 -0
- package/types/animation/AnimatorStateMachine.d.ts +17 -2
- package/types/animation/AnimatorStateTransition.d.ts +9 -0
- package/types/animation/AnimatorStateTransitionCollection.d.ts +23 -1
- package/types/animation/Keyframe.d.ts +1 -1
- package/types/animation/StateMachineScript.d.ts +2 -0
- package/types/animation/animationCurve/AnimationArrayCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationBoolCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationColorCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationCurve.d.ts +9 -1
- package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +38 -0
- package/types/animation/animationCurve/AnimationFloatCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationQuaternionCurve.d.ts +41 -0
- package/types/animation/animationCurve/AnimationRectCurve.d.ts +18 -0
- package/types/animation/animationCurve/AnimationRefCurve.d.ts +20 -2
- package/types/animation/animationCurve/AnimationStringCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationVector2Curve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationVector3Curve.d.ts +43 -0
- package/types/animation/animationCurve/AnimationVector4Curve.d.ts +39 -0
- package/types/animation/animationCurve/interfaces/IAnimationCurveCalculator.d.ts +18 -1
- package/types/animation/enums/AnimatorStatePlayState.d.ts +8 -1
- package/types/animation/index.d.ts +1 -0
- package/types/animation/internal/AnimationCurveLayerOwner.d.ts +15 -1
- package/types/animation/internal/AnimationEventHandler.d.ts +8 -1
- package/types/animation/internal/AnimatorLayerData.d.ts +28 -1
- package/types/animation/internal/AnimatorStateData.d.ts +14 -1
- package/types/animation/internal/AnimatorStatePlayData.d.ts +27 -1
- package/types/animation/internal/AnimatorTempValue.d.ts +12 -1
- package/types/animation/internal/animationCurveOwner/AnimationCurveOwner.d.ts +39 -0
- package/types/animation/internal/animationCurveOwner/assembler/BlendShapeWeightsAnimationCurveOwnerAssembler.d.ts +12 -1
- package/types/animation/internal/animationCurveOwner/assembler/IAnimationCurveOwnerAssembler.d.ts +10 -1
- package/types/animation/internal/animationCurveOwner/assembler/PositionAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/RotationAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/ScaleAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/UniversalAnimationCurveOwnerAssembler.d.ts +23 -1
- package/types/asset/AssetPromise.d.ts +4 -4
- package/types/asset/AssetType.d.ts +7 -9
- package/types/asset/GraphicsResource.d.ts +10 -0
- package/types/asset/IReferable.d.ts +8 -0
- package/types/asset/JSONAsset.d.ts +1 -1
- package/types/asset/LoadItem.d.ts +1 -1
- package/types/asset/Loader.d.ts +2 -2
- package/types/asset/ReferResource.d.ts +28 -0
- package/types/asset/RenderingStatistics.d.ts +8 -0
- package/types/asset/ResourceManager.d.ts +117 -9
- package/types/audio/AudioClip.d.ts +8 -0
- package/types/audio/AudioManager.d.ts +18 -0
- package/types/audio/AudioSource.d.ts +20 -2
- package/types/base/DataObject.d.ts +6 -0
- package/types/base/EngineObject.d.ts +4 -0
- package/types/base/Time.d.ts +13 -0
- package/types/base/index.d.ts +1 -0
- package/types/clone/CloneDecorators.d.ts +37 -0
- package/types/clone/CloneUtil.d.ts +30 -0
- package/types/clone/ComponentCloner.d.ts +4 -10
- package/types/clone/ICloneHook.d.ts +12 -0
- package/types/enums/CameraType.d.ts +9 -1
- package/types/env-probe/CubeProbe.d.ts +2 -0
- package/types/env-probe/Probe.d.ts +1 -1
- package/types/graphic/Buffer.d.ts +23 -3
- package/types/graphic/BufferUtil.d.ts +8 -0
- package/types/graphic/IndexBufferBinding.d.ts +4 -0
- package/types/graphic/Mesh.d.ts +58 -1
- package/types/graphic/Primitive.d.ts +50 -1
- package/types/graphic/TransformFeedback.d.ts +46 -0
- package/types/graphic/TransformFeedbackPrimitive.d.ts +67 -0
- package/types/graphic/TransformFeedbackSimulator.d.ts +55 -0
- package/types/graphic/VertexBufferBinding.d.ts +4 -0
- package/types/graphic/VertexElement.d.ts +1 -0
- package/types/graphic/enums/BufferBindFlag.d.ts +5 -3
- package/types/index.d.ts +7 -4
- package/types/input/InputManager.d.ts +25 -6
- package/types/input/enums/PointerButton.d.ts +8 -0
- package/types/input/keyboard/KeyboardManager.d.ts +41 -1
- package/types/input/pointer/Pointer.d.ts +37 -1
- package/types/input/pointer/PointerEventData.d.ts +4 -0
- package/types/input/pointer/PointerManager.d.ts +58 -0
- package/types/input/pointer/emitter/IHitResult.d.ts +11 -1
- package/types/input/pointer/emitter/PhysicsPointerEventEmitter.d.ts +20 -1
- package/types/input/wheel/WheelManager.d.ts +34 -1
- package/types/lighting/AmbientLight.d.ts +9 -8
- package/types/lighting/DirectLight.d.ts +17 -0
- package/types/lighting/KHR_lights.d.ts +13 -1
- package/types/lighting/Light.d.ts +2 -0
- package/types/lighting/LightManager.d.ts +57 -0
- package/types/lighting/PointLight.d.ts +17 -0
- package/types/lighting/SpotLight.d.ts +17 -0
- package/types/lighting/ambientOcclusion/AmbientOcclusion.d.ts +4 -0
- package/types/lighting/ambientOcclusion/ScalableAmbientObscurancePass.d.ts +38 -1
- package/types/material/BaseMaterial.d.ts +15 -11
- package/types/material/Material.d.ts +5 -9
- package/types/mesh/BlendShape.d.ts +14 -1
- package/types/mesh/BlendShapeFrame.d.ts +11 -4
- package/types/mesh/BlendShapeManager.d.ts +101 -1
- package/types/mesh/BufferMesh.d.ts +2 -2
- package/types/mesh/MeshRenderer.d.ts +42 -0
- package/types/mesh/ModelMesh.d.ts +23 -4
- package/types/mesh/PrimitiveMesh.d.ts +38 -4
- package/types/mesh/PrimitiveMeshRestorer.d.ts +107 -0
- package/types/mesh/Skin.d.ts +12 -3
- package/types/mesh/SkinnedMeshRenderer.d.ts +27 -1
- package/types/particle/ParticleBufferUtils.d.ts +26 -1
- package/types/particle/ParticleGenerator.d.ts +147 -2
- package/types/particle/ParticleMaterial.d.ts +3 -1
- package/types/particle/ParticleRenderer.d.ts +61 -1
- package/types/particle/ParticleTransformFeedbackSimulator.d.ts +52 -0
- package/types/particle/enums/ParticleRandomSubSeeds.d.ts +25 -1
- package/types/particle/enums/ParticleScaleMode.d.ts +5 -5
- package/types/particle/enums/ParticleSubEmitterInheritProperty.d.ts +17 -0
- package/types/particle/enums/ParticleSubEmitterType.d.ts +9 -0
- package/types/particle/enums/attributes/BillboardParticleVertexAttribute.d.ts +6 -1
- package/types/particle/enums/attributes/ParticleFeedbackVertexAttribute.d.ts +8 -0
- package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +17 -1
- package/types/particle/index.d.ts +7 -0
- package/types/particle/modules/Burst.d.ts +23 -2
- package/types/particle/modules/ColorOverLifetimeModule.d.ts +19 -0
- package/types/particle/modules/CustomDataModule.d.ts +90 -0
- package/types/particle/modules/EmissionModule.d.ts +36 -0
- package/types/particle/modules/ForceOverLifetimeModule.d.ts +16 -1
- package/types/particle/modules/LimitVelocityOverLifetimeModule.d.ts +164 -0
- package/types/particle/modules/MainModule.d.ts +45 -6
- package/types/particle/modules/NoiseModule.d.ts +114 -0
- package/types/particle/modules/ParticleCompositeCurve.d.ts +42 -4
- package/types/particle/modules/ParticleCompositeGradient.d.ts +8 -2
- package/types/particle/modules/ParticleCurve.d.ts +31 -2
- package/types/particle/modules/ParticleGeneratorModule.d.ts +9 -3
- package/types/particle/modules/ParticleGradient.d.ts +22 -5
- package/types/particle/modules/RotationOverLifetimeModule.d.ts +27 -3
- package/types/particle/modules/SizeOverLifetimeModule.d.ts +25 -0
- package/types/particle/modules/SubEmitter.d.ts +31 -0
- package/types/particle/modules/SubEmittersModule.d.ts +57 -0
- package/types/particle/modules/TextureSheetAnimationModule.d.ts +14 -1
- package/types/particle/modules/VelocityOverLifetimeModule.d.ts +120 -0
- package/types/particle/modules/shape/BaseShape.d.ts +65 -2
- package/types/particle/modules/shape/BoxShape.d.ts +13 -2
- package/types/particle/modules/shape/CircleShape.d.ts +13 -1
- package/types/particle/modules/shape/ConeShape.d.ts +13 -4
- package/types/particle/modules/shape/HemisphereShape.d.ts +13 -0
- package/types/particle/modules/shape/MeshShape.d.ts +26 -3
- package/types/particle/modules/shape/ShapeUtils.d.ts +13 -1
- package/types/particle/modules/shape/SphereShape.d.ts +13 -0
- package/types/physics/CharacterController.d.ts +21 -0
- package/types/physics/Collider.d.ts +47 -2
- package/types/physics/Collision.d.ts +3 -0
- package/types/physics/DynamicCollider.d.ts +28 -1
- package/types/physics/HitResult.d.ts +2 -2
- package/types/physics/PhysicsMaterial.d.ts +3 -0
- package/types/physics/PhysicsScene.d.ts +56 -6
- package/types/physics/StaticCollider.d.ts +5 -0
- package/types/physics/enums/ColliderShapeChangeFlag.d.ts +8 -1
- package/types/physics/enums/HingeJointFlag.d.ts +14 -1
- package/types/physics/joint/HingeJoint.d.ts +4 -0
- package/types/physics/joint/Joint.d.ts +22 -2
- package/types/physics/joint/JointLimits.d.ts +2 -1
- package/types/physics/joint/JointMotor.d.ts +2 -1
- package/types/physics/shape/ColliderShape.d.ts +26 -3
- package/types/physics/shape/MeshColliderShape.d.ts +11 -5
- package/types/postProcess/FinalPass.d.ts +19 -1
- package/types/postProcess/PostProcess.d.ts +11 -6
- package/types/postProcess/PostProcessEffect.d.ts +6 -1
- package/types/postProcess/PostProcessEffectParameter.d.ts +23 -3
- package/types/postProcess/PostProcessManager.d.ts +43 -0
- package/types/postProcess/PostProcessPass.d.ts +3 -2
- package/types/postProcess/PostProcessUberPass.d.ts +2 -1
- package/types/postProcess/effects/BloomEffect.d.ts +26 -1
- package/types/postProcess/effects/TonemappingEffect.d.ts +3 -0
- package/types/renderingHardwareInterface/IPlatformBuffer.d.ts +1 -0
- package/types/renderingHardwareInterface/IPlatformTransformFeedback.d.ts +36 -0
- package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +40 -0
- package/types/renderingHardwareInterface/index.d.ts +2 -0
- package/types/shader/Shader.d.ts +38 -22
- package/types/shader/ShaderBlockProperty.d.ts +19 -0
- package/types/shader/ShaderData.d.ts +43 -4
- package/types/shader/ShaderFactory.d.ts +78 -0
- package/types/shader/ShaderMacro.d.ts +17 -2
- package/types/shader/ShaderMacroCollection.d.ts +57 -1
- package/types/shader/ShaderMacroProcessor.d.ts +72 -0
- package/types/shader/ShaderPass.d.ts +46 -13
- package/types/shader/ShaderProgram.d.ts +91 -1
- package/types/shader/ShaderProgramMap.d.ts +20 -0
- package/types/shader/ShaderProperty.d.ts +17 -0
- package/types/shader/ShaderTagKey.d.ts +2 -0
- package/types/shader/ShaderUniform.d.ts +49 -1
- package/types/shader/ShaderUniformBlock.d.ts +9 -1
- package/types/shader/enums/ConstantBufferBindingPoint.d.ts +7 -0
- package/types/shader/enums/ShaderPreprocessorDirective.d.ts +16 -0
- package/types/shader/index.d.ts +1 -1
- package/types/shader/state/BlendState.d.ts +16 -1
- package/types/shader/state/DepthState.d.ts +16 -1
- package/types/shader/state/RasterState.d.ts +19 -1
- package/types/shader/state/RenderState.d.ts +13 -2
- package/types/shader/state/RenderTargetBlendState.d.ts +2 -1
- package/types/shader/state/StencilState.d.ts +15 -1
- package/types/shadow/CascadedShadowCasterPass.d.ts +5 -0
- package/types/shadow/ShadowSliceData.d.ts +13 -1
- package/types/shadow/ShadowUtils.d.ts +43 -1
- package/types/sky/Sky.d.ts +13 -4
- package/types/sky/SkyBoxMaterial.d.ts +0 -7
- package/types/texture/RenderTarget.d.ts +28 -3
- package/types/texture/Texture.d.ts +21 -0
- package/types/texture/Texture2D.d.ts +4 -0
- package/types/texture/Texture2DArray.d.ts +4 -0
- package/types/texture/TextureCube.d.ts +4 -0
- package/types/texture/TextureUtils.d.ts +16 -1
- package/types/trail/TrailRenderer.d.ts +13 -8
- package/types/ui/IUICanvas.d.ts +16 -1
- package/types/utils/DisorderedArray.d.ts +3 -1
- package/types/xr/XRManager.d.ts +28 -0
- package/types/RenderPipeline/BatchUtils.d.ts +0 -1
- package/types/RenderPipeline/SubRenderElement.d.ts +0 -22
- package/types/clone/CloneManager.d.ts +0 -31
- package/types/clone/enums/CloneMode.d.ts +0 -13
- package/types/shader/ShaderPool.d.ts +0 -1
- package/types/shader/ShaderProgramPool.d.ts +0 -1
- package/types/shader/state/index.d.ts +0 -6
- package/types/shaderlib/ShaderFactory.d.ts +0 -20
- package/types/shaderlib/ShaderLib.d.ts +0 -73
- package/types/shaderlib/index.d.ts +0 -1
- package/types/shaderlib/particle/index.d.ts +0 -15
- package/types/shaderlib/pbr/index.d.ts +0 -11
- package/types/shaderlib/shadow/index.d.ts +0 -8
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Engine } from "../Engine";
|
|
2
|
+
import { ShaderProperty } from "./ShaderProperty";
|
|
3
|
+
/**
|
|
4
|
+
* Shader registry and GLSL utilities. Holds the `#include` lookup table
|
|
5
|
+
* the runtime preprocessor reads, the GLSL ES 100 → 300 syntax converter
|
|
6
|
+
* the WebGL2 path uses, and the GPU-instancing UBO injector that
|
|
7
|
+
* `ShaderPass` runs over compiled GLSL source.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ShaderFactory {
|
|
10
|
+
static readonly RENDERER_INSTANCE_BLOCK_NAME = "RendererInstanceData";
|
|
11
|
+
static readonly uniformBlockBindingMap: Record<number, number>;
|
|
12
|
+
static readonly includeMap: Record<string, string>;
|
|
13
|
+
static readonly shaderExtension: string;
|
|
14
|
+
private static readonly _std140TypeInfoMap;
|
|
15
|
+
private static readonly _has300OutInFragReg;
|
|
16
|
+
private static readonly _derivedDefines;
|
|
17
|
+
private static readonly _builtinRendererUniforms;
|
|
18
|
+
private static readonly _cameraMatrixCandidates;
|
|
19
|
+
private static readonly _uboUniformRegex;
|
|
20
|
+
private static _packFuncMap;
|
|
21
|
+
/**
|
|
22
|
+
* Register a chunk source so `#include` resolves it.
|
|
23
|
+
* @param includeName - The path key referenced in `#include "..."`.
|
|
24
|
+
* @param includeSource - GLSL chunk source text.
|
|
25
|
+
*/
|
|
26
|
+
static registerInclude(includeName: string, includeSource: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a registered shader chunk.
|
|
29
|
+
* @param includeName - The path key passed to `registerInclude`.
|
|
30
|
+
*/
|
|
31
|
+
static unRegisterInclude(includeName: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Convert lower GLSL version to GLSL 300 es.
|
|
34
|
+
* @param shader - code
|
|
35
|
+
* @param isFrag - Whether it is a fragment shader.
|
|
36
|
+
*/
|
|
37
|
+
static convertTo300(shader: string, isFrag?: boolean): string;
|
|
38
|
+
/**
|
|
39
|
+
* Scan VS/FS for renderer-group `uniform` declarations, replace them with a shared
|
|
40
|
+
* std140 UBO (instanced array), and emit `#define` remapping so original uniform
|
|
41
|
+
* names resolve to `rendererData[instanceID].field`.
|
|
42
|
+
*
|
|
43
|
+
* Inputs are expected to be already preprocessor-evaluated (no `#ifdef` left).
|
|
44
|
+
*/
|
|
45
|
+
static injectInstanceUBO(engine: Engine, vertexSource: string, fragmentSource: string): {
|
|
46
|
+
vertexSource: string;
|
|
47
|
+
fragmentSource: string;
|
|
48
|
+
instanceLayout: InstanceBufferLayout | null;
|
|
49
|
+
};
|
|
50
|
+
private static _scanInstanceUniforms;
|
|
51
|
+
private static _buildLayout;
|
|
52
|
+
private static _buildMissingCameraDecls;
|
|
53
|
+
private static _buildUBODeclaration;
|
|
54
|
+
private static _buildFieldDefines;
|
|
55
|
+
private static _replaceMRTShader;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export interface InstanceFieldInfo {
|
|
61
|
+
property: ShaderProperty;
|
|
62
|
+
type: string;
|
|
63
|
+
offset: number;
|
|
64
|
+
/** offset / 4, precomputed to avoid repeated division in upload loop */
|
|
65
|
+
offsetInElements: number;
|
|
66
|
+
useIntView: boolean;
|
|
67
|
+
pack: InstancePackFunc;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export interface InstanceBufferLayout {
|
|
73
|
+
instanceFields: InstanceFieldInfo[];
|
|
74
|
+
instanceMaxCount: number;
|
|
75
|
+
structSize: number;
|
|
76
|
+
}
|
|
77
|
+
type InstancePackFunc = (view: Float32Array | Int32Array, offset: number, value: any) => void;
|
|
78
|
+
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { ShaderMacroCollection } from "./ShaderMacroCollection";
|
|
1
2
|
/**
|
|
2
3
|
* Shader macro。
|
|
3
4
|
*/
|
|
4
5
|
export declare class ShaderMacro {
|
|
6
|
+
/** @internal */
|
|
7
|
+
static _macroMaskMap: ShaderMacro[][];
|
|
8
|
+
/** @internal */
|
|
9
|
+
static _macroNameIdMap: Record<string, number>;
|
|
5
10
|
private static _macroNameCounter;
|
|
6
11
|
private static _macroCounter;
|
|
7
12
|
private static _macroMap;
|
|
@@ -17,10 +22,20 @@ export declare class ShaderMacro {
|
|
|
17
22
|
* @param value - Value of the shader macro
|
|
18
23
|
* @returns Shader macro
|
|
19
24
|
*/
|
|
20
|
-
static getByName(name: string, value: string): ShaderMacro;
|
|
25
|
+
static getByName(name: string, value: string | undefined): ShaderMacro;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
static _getMacrosElements(macros: ShaderMacroCollection, out: ShaderMacro[]): void;
|
|
21
30
|
/** Name. */
|
|
22
31
|
readonly name: string;
|
|
23
32
|
/** Value. */
|
|
24
|
-
readonly value: string;
|
|
33
|
+
readonly value: string | undefined;
|
|
34
|
+
/** @internal */
|
|
35
|
+
_nameId: number;
|
|
36
|
+
/** @internal */
|
|
37
|
+
_maskIndex: number;
|
|
38
|
+
/** @internal */
|
|
39
|
+
_maskValue: number;
|
|
25
40
|
private constructor();
|
|
26
41
|
}
|
|
@@ -1 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
import { ShaderMacro } from "./ShaderMacro";
|
|
2
|
+
/**
|
|
3
|
+
* Shader macro collection.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class ShaderMacroCollection {
|
|
7
|
+
/**
|
|
8
|
+
* Union of two macro collection.
|
|
9
|
+
* @param left - input macro collection
|
|
10
|
+
* @param right - input macro collection
|
|
11
|
+
* @param out - union output macro collection
|
|
12
|
+
*/
|
|
13
|
+
static unionCollection(left: ShaderMacroCollection, right: ShaderMacroCollection, out: ShaderMacroCollection): void;
|
|
14
|
+
/** @internal */
|
|
15
|
+
_mask: number[];
|
|
16
|
+
/** @internal */
|
|
17
|
+
_length: number;
|
|
18
|
+
/**
|
|
19
|
+
* Enable one macro in this macro collection.
|
|
20
|
+
* @param macro - ShaderMacro
|
|
21
|
+
*/
|
|
22
|
+
enable(macro: ShaderMacro): void;
|
|
23
|
+
/**
|
|
24
|
+
* Disable one macro in this macro collection.
|
|
25
|
+
* @param macro - ShaderMacro
|
|
26
|
+
*/
|
|
27
|
+
disable(macro: ShaderMacro): void;
|
|
28
|
+
/**
|
|
29
|
+
* Union of this and other macro collection.
|
|
30
|
+
* @param macroCollection - macro collection
|
|
31
|
+
*/
|
|
32
|
+
unionCollection(macroCollection: ShaderMacroCollection): void;
|
|
33
|
+
/**
|
|
34
|
+
* Complementarity of this and other macro collection.
|
|
35
|
+
* @param macroCollection - macro collection
|
|
36
|
+
*/
|
|
37
|
+
complementaryCollection(macroCollection: ShaderMacroCollection): void;
|
|
38
|
+
/**
|
|
39
|
+
* Intersection of this and other macro collection.
|
|
40
|
+
* @param macroCollection - macro collection
|
|
41
|
+
*/
|
|
42
|
+
intersectionCollection(macroCollection: ShaderMacroCollection): void;
|
|
43
|
+
/**
|
|
44
|
+
* Whether macro is enabled in this macro collection.
|
|
45
|
+
* @param macro - ShaderMacro
|
|
46
|
+
*/
|
|
47
|
+
isEnable(macro: ShaderMacro): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this macro collection is equal to another.
|
|
50
|
+
* @param other - macro collection to compare
|
|
51
|
+
*/
|
|
52
|
+
isEqual(other: ShaderMacroCollection): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Clear this macro collection.
|
|
55
|
+
*/
|
|
56
|
+
clear(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ShaderInstruction } from "@galacean/engine-design";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class ShaderMacroProcessor {
|
|
6
|
+
private static _valueMacros;
|
|
7
|
+
private static _funcMacros;
|
|
8
|
+
private static _shaderChunks;
|
|
9
|
+
private static _out;
|
|
10
|
+
private static _expandedNames;
|
|
11
|
+
private static _macroFirstChars;
|
|
12
|
+
private static _macroFirstCharsDirty;
|
|
13
|
+
private static _replaceWordParts;
|
|
14
|
+
private static _parsedFuncArgs;
|
|
15
|
+
/**
|
|
16
|
+
* Evaluate a flat instruction array with active macros.
|
|
17
|
+
* Macros are expanded immediately when text chunks are collected,
|
|
18
|
+
* using the current macro state at that point (conforming to GLSL/C99 §6.10 standard).
|
|
19
|
+
* @param instructions - Pre-parsed instruction array
|
|
20
|
+
* @param macros - Active runtime macros
|
|
21
|
+
* @returns Pure GLSL string with all conditionals resolved and macros expanded
|
|
22
|
+
*/
|
|
23
|
+
static evaluate(instructions: ShaderInstruction[], macros: Map<string, string>): string;
|
|
24
|
+
/**
|
|
25
|
+
* Expand macros in a single text chunk using the current macro state.
|
|
26
|
+
* Returns the chunk as-is if no expandable macros exist.
|
|
27
|
+
*/
|
|
28
|
+
private static _expandChunk;
|
|
29
|
+
/**
|
|
30
|
+
* Recursively expand macro substitution results until no more macros remain.
|
|
31
|
+
* @param macroExpansion - Intermediate text from a macro substitution that may contain further macro references
|
|
32
|
+
* @param valueMacros - Current value macro definitions
|
|
33
|
+
* @param funcMacros - Current function macro definitions
|
|
34
|
+
* @param expandedNames - Macro names already on the expansion chain, prevents circular references (C99 §6.10.3.4)
|
|
35
|
+
*/
|
|
36
|
+
private static _recursiveExpandMacro;
|
|
37
|
+
/**
|
|
38
|
+
* Substitute function macro params in body.
|
|
39
|
+
*/
|
|
40
|
+
private static _expandFuncBody;
|
|
41
|
+
/**
|
|
42
|
+
* Evaluate a compound condition tree.
|
|
43
|
+
*/
|
|
44
|
+
private static _evalCondition;
|
|
45
|
+
/**
|
|
46
|
+
* Evaluate a comparison operator.
|
|
47
|
+
*/
|
|
48
|
+
private static _compareValues;
|
|
49
|
+
/**
|
|
50
|
+
* Parse function macro call arguments.
|
|
51
|
+
* Returns reusable static result object to avoid allocation.
|
|
52
|
+
*/
|
|
53
|
+
private static _parseFuncArgs;
|
|
54
|
+
/**
|
|
55
|
+
* Replace all whole-word occurrences of `word` in `text` with `replacement`.
|
|
56
|
+
*/
|
|
57
|
+
private static _replaceWord;
|
|
58
|
+
/**
|
|
59
|
+
* Concatenate shader chunks with consecutive blank lines collapsed to a single newline.
|
|
60
|
+
*/
|
|
61
|
+
private static _concatChunks;
|
|
62
|
+
/**
|
|
63
|
+
* Check if char code is a valid identifier start.
|
|
64
|
+
* Matches: [A-Z] | [a-z] | _
|
|
65
|
+
*/
|
|
66
|
+
private static _isIdentifierStart;
|
|
67
|
+
/**
|
|
68
|
+
* Check if char code is a valid identifier part.
|
|
69
|
+
* Matches: [A-Z] | [a-z] | [0-9] | _
|
|
70
|
+
*/
|
|
71
|
+
private static _isIdentifierPart;
|
|
72
|
+
}
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
+
import type { ShaderInstruction } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../Engine";
|
|
3
|
+
import { ShaderMacroCollection } from "./ShaderMacroCollection";
|
|
1
4
|
import { ShaderPart } from "./ShaderPart";
|
|
5
|
+
import { ShaderProgramMap } from "./ShaderProgramMap";
|
|
6
|
+
import { ShaderProgram } from "./ShaderProgram";
|
|
7
|
+
import { ShaderProperty } from "./ShaderProperty";
|
|
8
|
+
import { ShaderLanguage } from "./enums/ShaderLanguage";
|
|
9
|
+
import { RenderState } from "./state/RenderState";
|
|
2
10
|
/**
|
|
3
11
|
* Shader pass containing vertex and fragment source.
|
|
4
12
|
*/
|
|
5
13
|
export declare class ShaderPass extends ShaderPart {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
/** @internal */
|
|
15
|
+
static _shaderPassCounter: number;
|
|
16
|
+
/** @internal */
|
|
17
|
+
static _shaderRootPath: string;
|
|
18
|
+
/** @internal */
|
|
19
|
+
_platformTarget: ShaderLanguage;
|
|
20
|
+
/** @internal - Flat instruction array for vertex shader. */
|
|
21
|
+
_vertexShaderInstructions: ShaderInstruction[];
|
|
22
|
+
/** @internal */
|
|
23
|
+
_fragmentShaderInstructions: ShaderInstruction[];
|
|
24
|
+
/** @internal */
|
|
25
|
+
_shaderPassId: number;
|
|
26
|
+
/** @internal Pass-level render state — always present, populated from ShaderLab declarations. */
|
|
27
|
+
_renderState: RenderState;
|
|
28
|
+
/** @internal */
|
|
29
|
+
_renderStateDataMap: Record<number, ShaderProperty>;
|
|
30
|
+
/** @internal */
|
|
31
|
+
_shaderProgramMaps: ShaderProgramMap[];
|
|
32
|
+
/** @internal Transform feedback output varyings (WebGL2 only). */
|
|
33
|
+
_feedbackVaryings?: string[];
|
|
34
|
+
private static _shaderMacroList;
|
|
35
|
+
private static _macroMap;
|
|
9
36
|
/**
|
|
10
|
-
* Create a shader pass.
|
|
37
|
+
* Create a shader pass from precompiled instructions.
|
|
11
38
|
* @param name - Shader pass name
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
39
|
+
* @param vertexShaderInstructions - Precompiled vertex instruction array
|
|
40
|
+
* @param fragmentShaderInstructions - Precompiled fragment instruction array
|
|
41
|
+
* @param platformTarget - Target shader language
|
|
14
42
|
* @param tags - Tags
|
|
15
43
|
*/
|
|
16
|
-
constructor(name: string,
|
|
44
|
+
constructor(name: string, vertexShaderInstructions: ShaderInstruction[], fragmentShaderInstructions: ShaderInstruction[], platformTarget: ShaderLanguage, tags?: Record<string, number | string | boolean>);
|
|
17
45
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
_getShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
_destroy(): void;
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
22
55
|
*/
|
|
23
|
-
|
|
24
|
-
private
|
|
56
|
+
_compileShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
|
|
57
|
+
private _compileShaderSource;
|
|
25
58
|
}
|
|
@@ -1 +1,91 @@
|
|
|
1
|
-
|
|
1
|
+
import { Engine } from "../Engine";
|
|
2
|
+
import { ShaderData } from "./ShaderData";
|
|
3
|
+
import { ShaderUniformBlock } from "./ShaderUniformBlock";
|
|
4
|
+
import { InstanceBufferLayout } from "./ShaderFactory";
|
|
5
|
+
/**
|
|
6
|
+
* Shader program, corresponding to the GPU shader program.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class ShaderProgram {
|
|
10
|
+
private static _counter;
|
|
11
|
+
private static _addLineNum;
|
|
12
|
+
id: number;
|
|
13
|
+
readonly sceneUniformBlock: ShaderUniformBlock;
|
|
14
|
+
readonly cameraUniformBlock: ShaderUniformBlock;
|
|
15
|
+
readonly rendererUniformBlock: ShaderUniformBlock;
|
|
16
|
+
readonly materialUniformBlock: ShaderUniformBlock;
|
|
17
|
+
readonly renderElementUniformBlock: ShaderUniformBlock;
|
|
18
|
+
readonly otherUniformBlock: ShaderUniformBlock;
|
|
19
|
+
/** @internal */
|
|
20
|
+
_uploadRenderCount: number;
|
|
21
|
+
/** @internal */
|
|
22
|
+
_uploadSceneId: number;
|
|
23
|
+
/** @internal */
|
|
24
|
+
_uploadCameraId: number;
|
|
25
|
+
/** @internal */
|
|
26
|
+
_uploadRendererId: number;
|
|
27
|
+
/** @internal */
|
|
28
|
+
_uploadMaterialId: number;
|
|
29
|
+
/** @internal */
|
|
30
|
+
_instanceLayout: InstanceBufferLayout | null;
|
|
31
|
+
attributeLocation: Record<string, GLint>;
|
|
32
|
+
uniformBlockIds: number[];
|
|
33
|
+
private _isValid;
|
|
34
|
+
private _engine;
|
|
35
|
+
private _gl;
|
|
36
|
+
private _glProgram;
|
|
37
|
+
private _activeTextureUint;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this shader program is valid.
|
|
40
|
+
*/
|
|
41
|
+
get isValid(): boolean;
|
|
42
|
+
constructor(engine: Engine, vertexSource: string, fragmentSource: string, transformFeedbackVaryings?: string[]);
|
|
43
|
+
/**
|
|
44
|
+
* Upload all shader data in shader uniform block.
|
|
45
|
+
* @param uniformBlock - shader Uniform block
|
|
46
|
+
* @param shaderData - shader data
|
|
47
|
+
*/
|
|
48
|
+
uploadAll(uniformBlock: ShaderUniformBlock, shaderData: ShaderData): void;
|
|
49
|
+
/**
|
|
50
|
+
* Upload constant shader data in shader uniform block.
|
|
51
|
+
* @param uniformBlock - shader Uniform block
|
|
52
|
+
* @param shaderData - shader data
|
|
53
|
+
*/
|
|
54
|
+
uploadUniforms(uniformBlock: ShaderUniformBlock, shaderData: ShaderData): void;
|
|
55
|
+
/**
|
|
56
|
+
* Upload texture shader data in shader uniform block.
|
|
57
|
+
* @param uniformBlock - shader Uniform block
|
|
58
|
+
* @param shaderData - shader data
|
|
59
|
+
*/
|
|
60
|
+
uploadTextures(uniformBlock: ShaderUniformBlock, shaderData: ShaderData): void;
|
|
61
|
+
/**
|
|
62
|
+
* Upload ungroup texture shader data in shader uniform block.
|
|
63
|
+
*/
|
|
64
|
+
uploadUnGroupTextures(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Grouping other data.
|
|
67
|
+
*/
|
|
68
|
+
groupingOtherUniformBlock(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Bind this shader program.
|
|
71
|
+
* @returns Whether the shader program is switched.
|
|
72
|
+
*/
|
|
73
|
+
bind(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Destroy this shader program.
|
|
76
|
+
*/
|
|
77
|
+
destroy(): void;
|
|
78
|
+
private _groupingSubOtherUniforms;
|
|
79
|
+
private _groupingUniform;
|
|
80
|
+
/**
|
|
81
|
+
* Init and link program with shader.
|
|
82
|
+
*/
|
|
83
|
+
private _createProgram;
|
|
84
|
+
private _createShader;
|
|
85
|
+
/**
|
|
86
|
+
* record the location of uniform/attribute.
|
|
87
|
+
*/
|
|
88
|
+
private _recordLocation;
|
|
89
|
+
private _getUniformInfos;
|
|
90
|
+
private _getAttributeInfos;
|
|
91
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Engine } from "../Engine";
|
|
2
|
+
import { ShaderMacroCollection } from "./ShaderMacroCollection";
|
|
3
|
+
import { ShaderProgram } from "./ShaderProgram";
|
|
4
|
+
/**
|
|
5
|
+
* Map keyed by ShaderMacroCollection bitmask, caching ShaderProgram instances.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class ShaderProgramMap {
|
|
9
|
+
engine: Engine;
|
|
10
|
+
private _cacheHierarchyDepth;
|
|
11
|
+
private _cacheMap;
|
|
12
|
+
private _lastQueryMap;
|
|
13
|
+
private _lastQueryKey;
|
|
14
|
+
constructor(engine: Engine);
|
|
15
|
+
get(macros: ShaderMacroCollection): ShaderProgram | null;
|
|
16
|
+
cache(value: ShaderProgram): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
private _recursiveForEach;
|
|
19
|
+
private _resizeCacheMapHierarchy;
|
|
20
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { ShaderDataGroup } from "./enums/ShaderDataGroup";
|
|
1
2
|
import { ShaderPropertyType } from "./enums/ShaderPropertyType";
|
|
2
3
|
/**
|
|
3
4
|
* Shader property.
|
|
4
5
|
*/
|
|
5
6
|
export declare class ShaderProperty {
|
|
7
|
+
/** @internal */
|
|
8
|
+
static _propertyIdMap: Record<number, ShaderProperty>;
|
|
6
9
|
private static _propertyNameCounter;
|
|
7
10
|
private static _propertyNameMap;
|
|
8
11
|
/**
|
|
@@ -11,10 +14,24 @@ export declare class ShaderProperty {
|
|
|
11
14
|
* @returns Shader property
|
|
12
15
|
*/
|
|
13
16
|
static getByName(name: string): ShaderProperty;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
static _getShaderPropertyGroup(propertyName: string): ShaderDataGroup | null;
|
|
21
|
+
/** @internal */
|
|
22
|
+
_uniqueId: number;
|
|
23
|
+
/** @internal */
|
|
24
|
+
_group: ShaderDataGroup;
|
|
25
|
+
/** @internal */
|
|
26
|
+
_type: ShaderPropertyType;
|
|
14
27
|
/** Shader property name. */
|
|
15
28
|
readonly name: string;
|
|
16
29
|
/**
|
|
17
30
|
* Shader property type.
|
|
18
31
|
*/
|
|
19
32
|
get type(): ShaderPropertyType;
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
constructor(name: string);
|
|
20
37
|
}
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
import { Color, Matrix, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
|
|
2
|
+
import { Engine } from "../Engine";
|
|
3
|
+
import { Texture } from "../texture/Texture";
|
|
4
|
+
import { ShaderPropertyValueType } from "./ShaderData";
|
|
5
|
+
/**
|
|
6
|
+
* Shader uniform。
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class ShaderUniform {
|
|
10
|
+
name: string;
|
|
11
|
+
propertyId: number;
|
|
12
|
+
location: WebGLUniformLocation;
|
|
13
|
+
applyFunc: (shaderUniform: ShaderUniform, value: ShaderPropertyValueType) => void;
|
|
14
|
+
cacheValue: number | Vector2 | Vector3 | Vector4;
|
|
15
|
+
textureIndex: GLenum | GLenum[];
|
|
16
|
+
textureDefault: Texture | Texture[];
|
|
17
|
+
textureUseCompareMode: boolean;
|
|
18
|
+
private _rhi;
|
|
19
|
+
private _gl;
|
|
20
|
+
constructor(engine: Engine);
|
|
21
|
+
upload1f(shaderUniform: ShaderUniform, value: number): void;
|
|
22
|
+
upload1fv(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
23
|
+
upload2f(shaderUniform: ShaderUniform, value: Vector2 | Vector3 | Vector4 | Color): void;
|
|
24
|
+
upload2fv(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
25
|
+
upload3f(shaderUniform: ShaderUniform, value: Vector3 | Vector4 | Color): void;
|
|
26
|
+
upload3fv(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
27
|
+
upload4f(shaderUniform: ShaderUniform, value: Vector4 | Color): void;
|
|
28
|
+
upload4fv(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
29
|
+
upload1i(shaderUniform: ShaderUniform, value: number): void;
|
|
30
|
+
upload1iv(shaderUniform: ShaderUniform, value: Int32Array): void;
|
|
31
|
+
upload2i(shaderUniform: ShaderUniform, value: Vector2 | Vector3 | Vector4 | Color): void;
|
|
32
|
+
upload2iv(shaderUniform: ShaderUniform, value: Int32Array): void;
|
|
33
|
+
upload3i(shaderUniform: ShaderUniform, value: Vector3 | Vector4 | Color): void;
|
|
34
|
+
upload3iv(shaderUniform: ShaderUniform, value: Int32Array): void;
|
|
35
|
+
upload4i(shaderUniform: ShaderUniform, value: Vector4 | Color): void;
|
|
36
|
+
upload4iv(shaderUniform: ShaderUniform, value: Int32Array): void;
|
|
37
|
+
uploadMat2(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
38
|
+
uploadMat3(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
39
|
+
uploadMat4(shaderUniform: ShaderUniform, value: Matrix): void;
|
|
40
|
+
uploadMat4v(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
41
|
+
uploadMat2x3(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
42
|
+
uploadMat2x4(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
43
|
+
uploadMat3x2(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
44
|
+
uploadMat3x4(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
45
|
+
uploadMat4x2(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
46
|
+
uploadMat4x3(shaderUniform: ShaderUniform, value: Float32Array): void;
|
|
47
|
+
uploadTexture(shaderUniform: ShaderUniform, value: Texture): void;
|
|
48
|
+
uploadTextureArray(shaderUniform: ShaderUniform, value: Texture[]): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directive types for shader preprocessor instructions.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ShaderPreprocessorDirective {
|
|
5
|
+
Text = 0,
|
|
6
|
+
IfDef = 1,
|
|
7
|
+
IfNdef = 2,
|
|
8
|
+
IfCmp = 3,
|
|
9
|
+
IfExpr = 4,
|
|
10
|
+
Else = 5,
|
|
11
|
+
Endif = 6,
|
|
12
|
+
Define = 7,
|
|
13
|
+
DefineVal = 8,
|
|
14
|
+
DefineFunc = 9,
|
|
15
|
+
Undef = 10
|
|
16
|
+
}
|
package/types/shader/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export { ShaderPropertyType } from "./enums/ShaderPropertyType";
|
|
|
11
11
|
export { StencilOperation } from "./enums/StencilOperation";
|
|
12
12
|
export { Shader } from "./Shader";
|
|
13
13
|
export { ShaderData } from "./ShaderData";
|
|
14
|
+
export { ShaderFactory } from "./ShaderFactory";
|
|
14
15
|
export { ShaderMacro } from "./ShaderMacro";
|
|
15
16
|
export { ShaderPass } from "./ShaderPass";
|
|
16
17
|
export { ShaderProperty } from "./ShaderProperty";
|
|
17
18
|
export { ShaderTagKey } from "./ShaderTagKey";
|
|
18
|
-
export * from "./state";
|
|
19
19
|
export { SubShader } from "./SubShader";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { DataObject } from "../../base/DataObject";
|
|
2
|
+
import { IHardwareRenderer } from "@galacean/engine-design";
|
|
1
3
|
import { Color } from "@galacean/engine-math";
|
|
4
|
+
import { RenderStateElementMap } from "../../BasicResources";
|
|
5
|
+
import { ShaderData } from "../ShaderData";
|
|
6
|
+
import { ShaderProperty } from "../ShaderProperty";
|
|
7
|
+
import { RenderState } from "./RenderState";
|
|
2
8
|
import { RenderTargetBlendState } from "./RenderTargetBlendState";
|
|
3
9
|
/**
|
|
4
10
|
* Blend state.
|
|
5
11
|
*/
|
|
6
|
-
export declare class BlendState {
|
|
12
|
+
export declare class BlendState extends DataObject {
|
|
7
13
|
private static _getGLBlendFactor;
|
|
8
14
|
private static _getGLBlendOperation;
|
|
9
15
|
/** The blend state of the render target. */
|
|
@@ -12,5 +18,14 @@ export declare class BlendState {
|
|
|
12
18
|
readonly blendColor: Color;
|
|
13
19
|
/** Whether to use (Alpha-to-Coverage) technology. */
|
|
14
20
|
alphaToCoverage: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
_applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData): void;
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
* Apply the current blend state by comparing with the last blend state.
|
|
28
|
+
*/
|
|
29
|
+
_apply(hardwareRenderer: IHardwareRenderer, lastRenderState: RenderState, customStates?: RenderStateElementMap | null): void;
|
|
15
30
|
private _platformApply;
|
|
16
31
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { DataObject } from "../../base/DataObject";
|
|
2
|
+
import { IHardwareRenderer } from "@galacean/engine-design";
|
|
3
|
+
import { RenderStateElementMap } from "../../BasicResources";
|
|
4
|
+
import { ShaderData } from "../ShaderData";
|
|
5
|
+
import { ShaderProperty } from "../ShaderProperty";
|
|
1
6
|
import { CompareFunction } from "../enums/CompareFunction";
|
|
7
|
+
import { RenderState } from "./RenderState";
|
|
2
8
|
/**
|
|
3
9
|
* Depth state.
|
|
4
10
|
*/
|
|
5
|
-
export declare class DepthState {
|
|
11
|
+
export declare class DepthState extends DataObject {
|
|
6
12
|
private static _getGLCompareFunction;
|
|
7
13
|
/** Whether to enable the depth test. */
|
|
8
14
|
enabled: boolean;
|
|
@@ -10,5 +16,14 @@ export declare class DepthState {
|
|
|
10
16
|
compareFunction: CompareFunction;
|
|
11
17
|
/** Whether the depth value can be written.*/
|
|
12
18
|
writeEnabled: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
_applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData): void;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
* Apply the current depth state by comparing with the last depth state.
|
|
26
|
+
*/
|
|
27
|
+
_apply(hardwareRenderer: IHardwareRenderer, lastRenderState: RenderState, customStates?: RenderStateElementMap | null): void;
|
|
13
28
|
private _platformApply;
|
|
14
29
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
import { DataObject } from "../../base/DataObject";
|
|
2
|
+
import { IHardwareRenderer } from "@galacean/engine-design";
|
|
3
|
+
import { RenderStateElementMap } from "../../BasicResources";
|
|
4
|
+
import { ShaderData } from "../ShaderData";
|
|
5
|
+
import { ShaderProperty } from "../ShaderProperty";
|
|
1
6
|
import { CullMode } from "../enums/CullMode";
|
|
7
|
+
import { RenderState } from "./RenderState";
|
|
2
8
|
/**
|
|
3
9
|
* Raster state.
|
|
4
10
|
*/
|
|
5
|
-
export declare class RasterState {
|
|
11
|
+
export declare class RasterState extends DataObject {
|
|
6
12
|
/** Specifies whether or not front- and/or back-facing polygons can be culled. */
|
|
7
13
|
cullMode: CullMode;
|
|
8
14
|
/** The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. */
|
|
9
15
|
depthBias: number;
|
|
10
16
|
/** The scale factor for the variable depth offset for each polygon. */
|
|
11
17
|
slopeScaledDepthBias: number;
|
|
18
|
+
/** @internal */
|
|
19
|
+
_cullFaceEnable: boolean;
|
|
20
|
+
/** @internal */
|
|
21
|
+
_frontFaceInvert: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
_applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData): void;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
_apply(hardwareRenderer: IHardwareRenderer, lastRenderState: RenderState, frontFaceInvert: boolean, customStates?: RenderStateElementMap | null): void;
|
|
12
30
|
private _platformApply;
|
|
13
31
|
}
|