@carbonenginejs/runtime-resource 0.9.1 → 0.10.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/NOTICE +3 -2
- package/README.md +47 -6
- package/dist/CjsMotherLode.js +88 -88
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +718 -229
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManFetchProvider.js +94 -0
- package/dist/CjsResManFetchProvider.js.map +1 -0
- package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
- package/dist/CjsResManWorkQueue.js.map +1 -0
- package/dist/format/CjsBlueReader.js +91 -2
- package/dist/format/CjsBlueReader.js.map +1 -1
- package/dist/format/CjsFormat.js +47 -21
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +4 -0
- package/dist/format/CjsReader.js.map +1 -1
- package/dist/format/CjsResourceProbe.js +4 -2
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +20 -0
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +15 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +62 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
- package/dist/formats/black/core/CjsBlackReader.js +127 -2
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
- package/dist/formats/black/core/helpers.js +17 -0
- package/dist/formats/black/core/helpers.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +8 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +20 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +40 -3
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +71 -0
- package/dist/formats/cmf/core/binary.js.map +1 -1
- package/dist/formats/cmf/core/buffers.js +4 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -1
- package/dist/formats/cmf/core/helpers.js +31 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -1
- package/dist/formats/cmf/core/schema.js +10 -0
- package/dist/formats/cmf/core/schema.js.map +1 -1
- package/dist/formats/cmf/core/shared.js +9 -0
- package/dist/formats/cmf/core/shared.js.map +1 -1
- package/dist/formats/cmf/core/writer.js +54 -0
- package/dist/formats/cmf/core/writer.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +10 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -1
- package/dist/formats/dds/core/bc7.js +16 -0
- package/dist/formats/dds/core/bc7.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +47 -0
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +22 -1
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +49 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +20 -0
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/gif/CjsGifFormat.js +49 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +20 -0
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +18 -3
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/parser.js +13 -0
- package/dist/formats/gltf/core/parser.js.map +1 -1
- package/dist/formats/gltf/core/targets.js +10 -0
- package/dist/formats/gltf/core/targets.js.map +1 -1
- package/dist/formats/gr2/core/bitknit2.js +2 -0
- package/dist/formats/gr2/core/bitknit2.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +20 -0
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/tangents.js +9 -9
- package/dist/formats/gr2/core/tangents.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +10 -0
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/index.js +4 -4
- package/dist/formats/jpeg/core/helpers.js +52 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +93 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +37 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +35 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +2 -2
- package/dist/formats/obj/core/helpers.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +49 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +23 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/ogg/core/vorbis.js +13 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/formats/png/core/helpers.js +52 -0
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +3 -1
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +52 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/helpers.js +19 -0
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/stl.js +10 -2
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +10 -0
- package/dist/formats/stl/core/targets.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +47 -0
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +37 -0
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +35 -0
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +49 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +23 -0
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +8 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +2 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +20 -0
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +45 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +10 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +57 -44
- package/dist/index.js.map +1 -1
- package/dist/{CjsResource.js → resource/CjsResource.js} +234 -19
- package/dist/resource/CjsResource.js.map +1 -0
- package/dist/{resources → resource}/Tr2LightProfileRes.js +5 -4
- package/dist/resource/Tr2LightProfileRes.js.map +1 -0
- package/dist/{resources → resource/audio}/AudioGeometryResData.js +4 -4
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
- package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
- package/dist/resource/audio/CjsAudioRes.js +213 -0
- package/dist/resource/audio/CjsAudioRes.js.map +1 -0
- package/dist/resource/audio/index.js +4 -0
- package/dist/resource/audio/index.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalData.js +3 -3
- package/dist/resource/geometry/MeshDecalData.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalLodData.js +3 -3
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
- package/dist/resource/geometry/TriGeometryRes.js +656 -0
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +4 -4
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +4 -4
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +3 -3
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +5 -5
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +3 -3
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriJointBinding.js +4 -4
- package/dist/resource/geometry/TriJointBinding.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +3 -3
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +3 -3
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +3 -3
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +5 -5
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +7 -6
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +7 -6
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
- package/dist/resource/geometry/granny/enums.js.map +1 -0
- package/dist/resource/geometry/granny/index.js +6 -0
- package/dist/resource/geometry/granny/index.js.map +1 -0
- package/dist/resource/geometry/index.js +17 -0
- package/dist/resource/geometry/index.js.map +1 -0
- package/dist/resource/index.js +52 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/resourceBoundary.js +64 -0
- package/dist/resource/resourceBoundary.js.map +1 -0
- package/dist/resource/shader/Tr2EffectRes.js +420 -0
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialArea.js +11 -6
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialMesh.js +10 -5
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialRes.js +12 -6
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
- package/dist/resource/shader/Tr2Shader.js +250 -0
- package/dist/resource/shader/Tr2Shader.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2ShaderPermutation.js +15 -9
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
- package/dist/resource/shader/index.js +17 -0
- package/dist/resource/shader/index.js.map +1 -0
- package/dist/resource/shader/portable.js +33 -0
- package/dist/resource/shader/portable.js.map +1 -0
- package/dist/resource/shader/portableValidation.js +461 -0
- package/dist/resource/shader/portableValidation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +100 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +34 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +113 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +141 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +107 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js +90 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +235 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +71 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2Pass.js +111 -0
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +80 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
- package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +84 -7
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +57 -11
- package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2ImageRes.js +7 -5
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +5 -3
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +3 -3
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +3 -3
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +8 -6
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/{resources → resource/texture}/TriTextureRes.js +43 -27
- package/dist/resource/texture/TriTextureRes.js.map +1 -0
- package/dist/resource/texture/index.js +15 -0
- package/dist/resource/texture/index.js.map +1 -0
- package/dist/{resources → resource/texture}/texturePipelineBehavior.js +61 -61
- package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
- package/dist/worker/CjsResManMainThreadLoader.js +87 -0
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
- package/dist/worker/CjsResManWorker.js +217 -0
- package/dist/worker/CjsResManWorker.js.map +1 -0
- package/dist/worker/CjsResManWorkerLoader.js +434 -0
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
- package/dist/worker/protocol.js +12 -0
- package/dist/worker/protocol.js.map +1 -0
- package/docs/README.md +18 -5
- package/docs/architecture.md +40 -17
- package/docs/concepts/resource-lifecycle.md +2 -1
- package/docs/formats/README.md +4 -0
- package/docs/reference/classes/README.md +6 -4
- package/docs/reference/classes/audio.md +30 -0
- package/docs/reference/classes/core.md +31 -11
- package/docs/reference/classes/formats.md +1 -1
- package/docs/reference/classes/resources.md +151 -41
- package/docs/reference/classes/texture.md +7 -7
- package/docs/reference/events.md +1 -1
- package/docs/reference/motherlode-cache.md +17 -0
- package/docs/reference/queues.md +9 -1
- package/docs/reference/workers.md +135 -0
- package/docs/roadmap.md +27 -1
- package/format-notices/black/NOTICE +1 -1
- package/package.json +9 -4
- package/dist/CjsResManQueue.js.map +0 -1
- package/dist/CjsResource.js.map +0 -1
- package/dist/CjsResourceSource.js +0 -68
- package/dist/CjsResourceSource.js.map +0 -1
- package/dist/resourcePath.js +0 -18
- package/dist/resourcePath.js.map +0 -1
- package/dist/resourceStates.js +0 -9
- package/dist/resourceStates.js.map +0 -1
- package/dist/resources/AudioGeometryResData.js.map +0 -1
- package/dist/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/resources/MeshDecalData.js.map +0 -1
- package/dist/resources/MeshDecalLodData.js.map +0 -1
- package/dist/resources/Tr2EffectRes.js +0 -71
- package/dist/resources/Tr2EffectRes.js.map +0 -1
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
- package/dist/resources/Tr2ImageRes.js.map +0 -1
- package/dist/resources/Tr2LightProfileRes.js.map +0 -1
- package/dist/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/resources/TriGeometryRes.js +0 -239
- package/dist/resources/TriGeometryRes.js.map +0 -1
- package/dist/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/resources/TriGrannyRes.js.map +0 -1
- package/dist/resources/TriJointBinding.js.map +0 -1
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/resources/TriTextureRes.js.map +0 -1
- package/dist/resources/enums.js.map +0 -1
- package/dist/resources/resourceBoundary.js +0 -47
- package/dist/resources/resourceBoundary.js.map +0 -1
- package/dist/resources/texturePipelineBehavior.js.map +0 -1
- package/dist/texture/CjsTextureArrayRes.js.map +0 -1
- package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type, impl, schema } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
import { isPlainObject, isUint32 } from '@carbonenginejs/runtime-utils/is';
|
|
5
|
+
|
|
6
|
+
let _initStatic, _initClass, _init_name, _init_extra_name, _init_offset, _init_extra_offset, _init_size, _init_extra_size, _init_type, _init_extra_type, _init_dimension, _init_extra_dimension, _init_elements, _init_extra_elements, _init_isSRGB, _init_extra_isSRGB, _init_isAutoregister, _init_extra_isAutoregister;
|
|
7
|
+
|
|
8
|
+
/** Reflected shader constant metadata. */
|
|
9
|
+
let _Tr2EffectConstant;
|
|
10
|
+
new class extends _identity {
|
|
11
|
+
static [class Tr2EffectConstant extends CjsModel {
|
|
12
|
+
static {
|
|
13
|
+
({
|
|
14
|
+
e: [_init_name, _init_extra_name, _init_offset, _init_extra_offset, _init_size, _init_extra_size, _init_type, _init_extra_type, _init_dimension, _init_extra_dimension, _init_elements, _init_extra_elements, _init_isSRGB, _init_extra_isSRGB, _init_isAutoregister, _init_extra_isAutoregister, _initStatic],
|
|
15
|
+
c: [_Tr2EffectConstant, _initClass]
|
|
16
|
+
} = _applyDecs2311(this, [type.define({
|
|
17
|
+
className: "Tr2EffectConstant",
|
|
18
|
+
family: "shader"
|
|
19
|
+
})], [[[type, type.string], 16, "name"], [[type, type.uint32], 16, "offset"], [[type, type.uint32], 16, "size"], [[type, type.int32, void 0, schema.enum("Type")], 16, "type"], [[type, type.uint32], 16, "dimension"], [[type, type.uint32], 16, "elements"], [[type, type.boolean], 16, "isSRGB"], [[type, type.boolean], 16, "isAutoregister"], [[impl, impl.custom, void 0, impl.reason("Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.")], 26, "fromPortable"]], 0, void 0, CjsModel));
|
|
20
|
+
_initStatic(this);
|
|
21
|
+
}
|
|
22
|
+
constructor(...args) {
|
|
23
|
+
super(...args);
|
|
24
|
+
_init_extra_isAutoregister(this);
|
|
25
|
+
}
|
|
26
|
+
/** name (BlueSharedString) */
|
|
27
|
+
name = _init_name(this, "");
|
|
28
|
+
|
|
29
|
+
/** offset (unsigned) */
|
|
30
|
+
offset = (_init_extra_name(this), _init_offset(this, 0));
|
|
31
|
+
|
|
32
|
+
/** size (unsigned) */
|
|
33
|
+
size = (_init_extra_offset(this), _init_size(this, 0));
|
|
34
|
+
|
|
35
|
+
/** type (Type - enum Type) */
|
|
36
|
+
type = (_init_extra_size(this), _init_type(this, 0));
|
|
37
|
+
|
|
38
|
+
/** dimension (unsigned) */
|
|
39
|
+
dimension = (_init_extra_type(this), _init_dimension(this, 0));
|
|
40
|
+
|
|
41
|
+
/** elements (unsigned) */
|
|
42
|
+
elements = (_init_extra_dimension(this), _init_elements(this, 0));
|
|
43
|
+
|
|
44
|
+
/** isSRGB (bool) */
|
|
45
|
+
isSRGB = (_init_extra_elements(this), _init_isSRGB(this, false));
|
|
46
|
+
|
|
47
|
+
/** isAutoregister (bool) */
|
|
48
|
+
isAutoregister = (_init_extra_isSRGB(this), _init_isAutoregister(this, false));
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Build one constant from its portable JSON reflection record.
|
|
52
|
+
*
|
|
53
|
+
* @param {object} value Portable constant record.
|
|
54
|
+
* @returns {Tr2EffectConstant} Reflected constant.
|
|
55
|
+
*/
|
|
56
|
+
static fromPortable(value) {
|
|
57
|
+
if (!isPlainObject(value)) {
|
|
58
|
+
throw new TypeError("Portable effect constant must be an object");
|
|
59
|
+
}
|
|
60
|
+
if (!isUint32(value.offset)) {
|
|
61
|
+
throw new RangeError("Portable constant offset must fit uint32");
|
|
62
|
+
}
|
|
63
|
+
if (!isUint32(value.size)) {
|
|
64
|
+
throw new RangeError("Portable constant size must fit uint32");
|
|
65
|
+
}
|
|
66
|
+
if (!isUint32(value.type)) {
|
|
67
|
+
throw new RangeError("Portable constant type must fit uint32");
|
|
68
|
+
}
|
|
69
|
+
if (!isUint32(value.dimension)) {
|
|
70
|
+
throw new RangeError("Portable constant dimension must fit uint32");
|
|
71
|
+
}
|
|
72
|
+
if (!isUint32(value.elements)) {
|
|
73
|
+
throw new RangeError("Portable constant element count must fit uint32");
|
|
74
|
+
}
|
|
75
|
+
const constant = new this();
|
|
76
|
+
constant.name = String(value.name ?? "");
|
|
77
|
+
constant.offset = value.offset;
|
|
78
|
+
constant.size = value.size;
|
|
79
|
+
constant.type = value.type;
|
|
80
|
+
constant.dimension = value.dimension;
|
|
81
|
+
constant.elements = value.elements;
|
|
82
|
+
constant.isSRGB = !!value.isSRGB;
|
|
83
|
+
constant.isAutoregister = !!value.isAutoregister;
|
|
84
|
+
return constant;
|
|
85
|
+
}
|
|
86
|
+
}];
|
|
87
|
+
Type = Object.freeze({
|
|
88
|
+
FLOAT: 0,
|
|
89
|
+
INT: 1,
|
|
90
|
+
UINT: 2,
|
|
91
|
+
BOOL: 3,
|
|
92
|
+
OTHER: 4
|
|
93
|
+
});
|
|
94
|
+
constructor() {
|
|
95
|
+
super(_Tr2EffectConstant), _initClass();
|
|
96
|
+
}
|
|
97
|
+
}();
|
|
98
|
+
|
|
99
|
+
export { _Tr2EffectConstant as Tr2EffectConstant };
|
|
100
|
+
//# sourceMappingURL=Tr2EffectConstant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectConstant.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectConstant.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { impl, schema, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\n\n/** Reflected shader constant metadata. */\n@type.define({ className: \"Tr2EffectConstant\", family: \"shader\" })\nexport class Tr2EffectConstant extends CjsModel\n{\n\n /** name (BlueSharedString) */\n @type.string\n name = \"\";\n\n /** offset (unsigned) */\n @type.uint32\n offset = 0;\n\n /** size (unsigned) */\n @type.uint32\n size = 0;\n\n /** type (Type - enum Type) */\n @type.int32\n @schema.enum(\"Type\")\n type = 0;\n\n /** dimension (unsigned) */\n @type.uint32\n dimension = 0;\n\n /** elements (unsigned) */\n @type.uint32\n elements = 0;\n\n /** isSRGB (bool) */\n @type.boolean\n isSRGB = false;\n\n /** isAutoregister (bool) */\n @type.boolean\n isAutoregister = false;\n\n /**\n * Build one constant from its portable JSON reflection record.\n *\n * @param {object} value Portable constant record.\n * @returns {Tr2EffectConstant} Reflected constant.\n */\n @impl.custom\n @impl.reason(\"Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.\")\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect constant must be an object\");\n }\n if (!isUint32(value.offset))\n {\n throw new RangeError(\"Portable constant offset must fit uint32\");\n }\n if (!isUint32(value.size))\n {\n throw new RangeError(\"Portable constant size must fit uint32\");\n }\n if (!isUint32(value.type))\n {\n throw new RangeError(\"Portable constant type must fit uint32\");\n }\n if (!isUint32(value.dimension))\n {\n throw new RangeError(\"Portable constant dimension must fit uint32\");\n }\n if (!isUint32(value.elements))\n {\n throw new RangeError(\n \"Portable constant element count must fit uint32\"\n );\n }\n\n const constant = new this();\n constant.name = String(value.name ?? \"\");\n constant.offset = value.offset;\n constant.size = value.size;\n constant.type = value.type;\n constant.dimension = value.dimension;\n constant.elements = value.elements;\n constant.isSRGB = !!value.isSRGB;\n constant.isAutoregister = !!value.isAutoregister;\n return constant;\n }\n\n static Type = Object.freeze({\n FLOAT: 0,\n INT: 1,\n UINT: 2,\n BOOL: 3,\n OTHER: 4\n });\n\n}\n"],"names":["_Tr2EffectConstant","_identity","Tr2EffectConstant","CjsModel","e","_init_name","_init_extra_name","_init_offset","_init_extra_offset","_init_size","_init_extra_size","_init_type","_init_extra_type","_init_dimension","_init_extra_dimension","_init_elements","_init_extra_elements","_init_isSRGB","_init_extra_isSRGB","_init_isAutoregister","_init_extra_isAutoregister","_initStatic","c","_initClass","_applyDecs","type","define","className","family","string","uint32","int32","schema","enum","boolean","impl","custom","reason","constructor","args","name","offset","size","dimension","elements","isSRGB","isAutoregister","fromPortable","value","isPlainObject","TypeError","isUint32","RangeError","constant","String","Type","Object","freeze","FLOAT","INT","UINT","BOOL","OTHER"],"mappings":";;;;;;;AAQA;AAAA,IAAAA;AAAA,IAAA,cAAAC,SAAA,CAAA;AAAA,EAAA,QACA,MAAAC,iBAAA,SACuCC,QAAQ,CAC/C;AAAA,IAAA;AAAA,MAAA,CAAA;AAAAC,QAAAA,CAAA,EAAA,CAAAC,UAAA,EAAAC,gBAAA,EAAAC,YAAA,EAAAC,kB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AAA,KAAK,EAAE;AACT,GAAC,CAAC;EAACxB,WAAAA,GAAA;IAAA,KAAA,CAAAtC,kBAAA,GAAAuB,UAAA,EAAA;AAAA,EAAA;AAAA,CAAA,EAAA;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
|
|
5
|
+
let _initClass, _init_name, _init_extra_name, _init_value, _init_extra_value;
|
|
6
|
+
|
|
7
|
+
/** Effect compile define retained as source metadata. */
|
|
8
|
+
let _Tr2EffectDefine;
|
|
9
|
+
class Tr2EffectDefine extends CjsModel {
|
|
10
|
+
static {
|
|
11
|
+
({
|
|
12
|
+
e: [_init_name, _init_extra_name, _init_value, _init_extra_value],
|
|
13
|
+
c: [_Tr2EffectDefine, _initClass]
|
|
14
|
+
} = _applyDecs2311(this, [type.define({
|
|
15
|
+
className: "Tr2EffectDefine",
|
|
16
|
+
family: "shader"
|
|
17
|
+
})], [[[type, type.string], 16, "name"], [[type, type.string], 16, "value"]], 0, void 0, CjsModel));
|
|
18
|
+
}
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
super(...args);
|
|
21
|
+
_init_extra_value(this);
|
|
22
|
+
}
|
|
23
|
+
/** name (const char*) */
|
|
24
|
+
name = _init_name(this, "");
|
|
25
|
+
|
|
26
|
+
/** value (const char*) */
|
|
27
|
+
value = (_init_extra_name(this), _init_value(this, ""));
|
|
28
|
+
static {
|
|
29
|
+
_initClass();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { _Tr2EffectDefine as Tr2EffectDefine };
|
|
34
|
+
//# sourceMappingURL=Tr2EffectDefine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectDefine.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectDefine.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\n\n/** Effect compile define retained as source metadata. */\n@type.define({ className: \"Tr2EffectDefine\", family: \"shader\" })\nexport class Tr2EffectDefine extends CjsModel\n{\n\n /** name (const char*) */\n @type.string\n name = \"\";\n\n /** value (const char*) */\n @type.string\n value = \"\";\n\n}\n"],"names":["_Tr2EffectDefine","Tr2EffectDefine","CjsModel","e","_init_name","_init_extra_name","_init_value","_init_extra_value","c","_initClass","_applyDecs","type","define","className","family","string","constructor","args","name","value"],"mappings":";;;;;;AAIA;AAAA,IAAAA;AACA,MAAAC,eAAA,SACqCC,QAAQ,CAC7C;AAAA,EAAA;AAAA,IAAA,CAAA;AAAAC,MAAAA,CAAA,GAAAC,UAAA,EAAAC,gBAAA,EAAAC,WAAA,EAAAC,iBAAA,CAAA;MAAAC,CAAA,EAAA,CAAAR,gBAAA,EAAAS,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,iBAAiB;AAAEC,MAAAA,MAAM,EAAE;AAAS,KAAC,CAAC,CAAA,EAAA,CAAA,CAAA,CAK7DH,IAAI,EAAJA,IAAI,CAACI,MAAM,CAAA,EAAA,EAAA,EAAA,MAAA,CAAA,EAAA,CAAA,CAIXJ,IAAI,EAAJA,IAAI,CAACI,MAAM,6BARuBb,QAAQ,CAAA;AAAA;AAAAc,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAV,iBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAG3C;EAEAW,IAAI,GAAAd,UAAA,CAAA,IAAA,EAAG,EAAE,CAAA;;AAET;AAEAe,EAAAA,KAAK,IAAAd,gBAAA,CAAA,IAAA,CAAA,EAAAC,WAAA,OAAG,EAAE,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAEb;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { impl, type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
import { isPlainObject, isArray } from '@carbonenginejs/runtime-utils/is';
|
|
5
|
+
import { Tr2EffectParameterAnnotation as _Tr2EffectParameterAn } from './Tr2EffectParameterAnnotation.js';
|
|
6
|
+
import { Tr2EffectTechnique as _Tr2EffectTechnique } from './Tr2EffectTechnique.js';
|
|
7
|
+
|
|
8
|
+
let _initStatic, _initClass, _init_techniques, _init_extra_techniques, _init_annotations, _init_extra_annotations;
|
|
9
|
+
|
|
10
|
+
/** Complete device-free effect description for one selected shader body. */
|
|
11
|
+
let _Tr2EffectDescription;
|
|
12
|
+
class Tr2EffectDescription extends CjsModel {
|
|
13
|
+
static {
|
|
14
|
+
({
|
|
15
|
+
e: [_init_techniques, _init_extra_techniques, _init_annotations, _init_extra_annotations, _initStatic],
|
|
16
|
+
c: [_Tr2EffectDescription, _initClass]
|
|
17
|
+
} = _applyDecs2311(this, [type.define({
|
|
18
|
+
className: "Tr2EffectDescription",
|
|
19
|
+
family: "shader"
|
|
20
|
+
})], [[type.list("Tr2EffectTechnique"), 0, "techniques"], [type.map("Tr2EffectParameterAnnotationMap"), 0, "annotations"], [[impl, impl.custom, void 0, impl.reason("Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.")], 26, "fromPortable"], [[impl, impl.custom, void 0, impl.reason("Carbon reads annotation groups from compiled bytes; CarbonEngineJS indexes the validated portable groups into canonical maps.")], 26, "readPortableAnnotationGroups"]], 0, void 0, CjsModel));
|
|
21
|
+
_initStatic(this);
|
|
22
|
+
}
|
|
23
|
+
constructor(...args) {
|
|
24
|
+
super(...args);
|
|
25
|
+
_init_extra_annotations(this);
|
|
26
|
+
}
|
|
27
|
+
/** techniques (TrackableStdVector<Tr2EffectTechnique>) */
|
|
28
|
+
techniques = _init_techniques(this, []);
|
|
29
|
+
|
|
30
|
+
/** annotations (Tr2EffectAnnotationMap) */
|
|
31
|
+
annotations = (_init_extra_techniques(this), _init_annotations(this, new Map()));
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Construct a canonical effect description from JS/JSON model values.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} values Canonical model values.
|
|
37
|
+
* @param {object} options CjsModel import options.
|
|
38
|
+
* @returns {Tr2EffectDescription} Hydrated description.
|
|
39
|
+
*/
|
|
40
|
+
static from(values = {}, options = {}) {
|
|
41
|
+
let normalized = values;
|
|
42
|
+
let annotations = null;
|
|
43
|
+
if (values && Object.hasOwn(values, "annotations")) {
|
|
44
|
+
const entries = values.annotations instanceof Map ? values.annotations : Object.entries(values.annotations ?? {});
|
|
45
|
+
annotations = new Map();
|
|
46
|
+
for (const [parameterName, records] of entries) {
|
|
47
|
+
if (!Array.isArray(records)) {
|
|
48
|
+
throw new TypeError(`Effect annotations for "${parameterName}" must be an array`);
|
|
49
|
+
}
|
|
50
|
+
annotations.set(String(parameterName), records.map(record => record instanceof _Tr2EffectParameterAn ? record : _Tr2EffectParameterAn.from(record, options)));
|
|
51
|
+
}
|
|
52
|
+
normalized = {
|
|
53
|
+
...values,
|
|
54
|
+
annotations
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const effect = super.from(normalized, options);
|
|
58
|
+
if (annotations) {
|
|
59
|
+
effect.annotations = annotations;
|
|
60
|
+
}
|
|
61
|
+
return effect;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Build one complete effect description from its portable JSON record.
|
|
66
|
+
*
|
|
67
|
+
* @param {object} value Portable effect-description record.
|
|
68
|
+
* @returns {Tr2EffectDescription} Reflected description.
|
|
69
|
+
*/
|
|
70
|
+
static fromPortable(value) {
|
|
71
|
+
if (!isPlainObject(value)) {
|
|
72
|
+
throw new TypeError("Portable effect description must be an object");
|
|
73
|
+
}
|
|
74
|
+
if (!isArray(value.annotations)) {
|
|
75
|
+
throw new TypeError("Portable effect annotation groups must be an array");
|
|
76
|
+
}
|
|
77
|
+
if (!isArray(value.techniques)) {
|
|
78
|
+
throw new TypeError("Portable effect techniques must be an array");
|
|
79
|
+
}
|
|
80
|
+
if (value.annotationGroupCount !== value.annotations.length || value.techniqueCount !== value.techniques.length) {
|
|
81
|
+
throw new Error("Portable effect description counts disagree with its collections");
|
|
82
|
+
}
|
|
83
|
+
const effect = new this();
|
|
84
|
+
effect.annotations = this.readPortableAnnotationGroups(value.annotations);
|
|
85
|
+
effect.techniques = value.techniques.map(entry => _Tr2EffectTechnique.fromPortable(entry));
|
|
86
|
+
return effect;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Build parameter-name-indexed annotation groups. */
|
|
90
|
+
static readPortableAnnotationGroups(values) {
|
|
91
|
+
const result = new Map();
|
|
92
|
+
for (const value of values) {
|
|
93
|
+
if (!isPlainObject(value)) {
|
|
94
|
+
throw new TypeError("Portable effect annotation group must be an object");
|
|
95
|
+
}
|
|
96
|
+
const parameterName = String(value.parameterName ?? "");
|
|
97
|
+
if (!isArray(value.annotations)) {
|
|
98
|
+
throw new TypeError(`Portable annotations for parameter "${parameterName}" must be an array`);
|
|
99
|
+
}
|
|
100
|
+
if (result.has(parameterName)) {
|
|
101
|
+
throw new Error(`Portable effect annotation group "${parameterName}" is duplicated`);
|
|
102
|
+
}
|
|
103
|
+
result.set(parameterName, value.annotations.map(entry => _Tr2EffectParameterAn.fromPortable(entry)));
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
static {
|
|
108
|
+
_initClass();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { _Tr2EffectDescription as Tr2EffectDescription };
|
|
113
|
+
//# sourceMappingURL=Tr2EffectDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectDescription.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectDescription.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\n// Source: trinity/trinity/Shader/Tr2EffectDescription.cpp\nimport { impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isArray,\n isPlainObject\n} from \"@carbonenginejs/runtime-utils/is\";\nimport { Tr2EffectParameterAnnotation } from \"./Tr2EffectParameterAnnotation.js\";\nimport { Tr2EffectTechnique } from \"./Tr2EffectTechnique.js\";\n\n/** Complete device-free effect description for one selected shader body. */\n@type.define({ className: \"Tr2EffectDescription\", family: \"shader\" })\nexport class Tr2EffectDescription extends CjsModel\n{\n\n /** techniques (TrackableStdVector<Tr2EffectTechnique>) */\n @type.list(\"Tr2EffectTechnique\")\n techniques = [];\n\n /** annotations (Tr2EffectAnnotationMap) */\n @type.map(\"Tr2EffectParameterAnnotationMap\")\n annotations = new Map();\n\n /**\n * Construct a canonical effect description from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2EffectDescription} Hydrated description.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n let annotations = null;\n if (values && Object.hasOwn(values, \"annotations\"))\n {\n const entries = values.annotations instanceof Map\n ? values.annotations\n : Object.entries(values.annotations ?? {});\n annotations = new Map();\n for (const [ parameterName, records ] of entries)\n {\n if (!Array.isArray(records))\n {\n throw new TypeError(\n `Effect annotations for \"${parameterName}\" must be an array`\n );\n }\n annotations.set(\n String(parameterName),\n records.map(record => record instanceof Tr2EffectParameterAnnotation\n ? record\n : Tr2EffectParameterAnnotation.from(record, options))\n );\n }\n normalized = { ...values, annotations };\n }\n const effect = super.from(normalized, options);\n if (annotations)\n {\n effect.annotations = annotations;\n }\n return effect;\n }\n\n /**\n * Build one complete effect description from its portable JSON record.\n *\n * @param {object} value Portable effect-description record.\n * @returns {Tr2EffectDescription} Reflected description.\n */\n @impl.custom\n @impl.reason(\"Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.\")\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect description must be an object\");\n }\n if (!isArray(value.annotations))\n {\n throw new TypeError(\n \"Portable effect annotation groups must be an array\"\n );\n }\n if (!isArray(value.techniques))\n {\n throw new TypeError(\"Portable effect techniques must be an array\");\n }\n if (value.annotationGroupCount !== value.annotations.length\n || value.techniqueCount !== value.techniques.length)\n {\n throw new Error(\n \"Portable effect description counts disagree with its collections\"\n );\n }\n\n const effect = new this();\n effect.annotations = this.readPortableAnnotationGroups(\n value.annotations\n );\n effect.techniques = value.techniques.map(\n entry => Tr2EffectTechnique.fromPortable(entry)\n );\n return effect;\n }\n\n /** Build parameter-name-indexed annotation groups. */\n @impl.custom\n @impl.reason(\"Carbon reads annotation groups from compiled bytes; CarbonEngineJS indexes the validated portable groups into canonical maps.\")\n static readPortableAnnotationGroups(values)\n {\n const result = new Map();\n for (const value of values)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\n \"Portable effect annotation group must be an object\"\n );\n }\n const parameterName = String(value.parameterName ?? \"\");\n if (!isArray(value.annotations))\n {\n throw new TypeError(\n `Portable annotations for parameter \"${parameterName}\" must be an array`\n );\n }\n if (result.has(parameterName))\n {\n throw new Error(\n `Portable effect annotation group \"${parameterName}\" is duplicated`\n );\n }\n result.set(\n parameterName,\n value.annotations.map(\n entry => Tr2EffectParameterAnnotation.fromPortable(entry)\n )\n );\n }\n return result;\n }\n\n}\n"],"names":["_Tr2EffectDescription","Tr2EffectDescription","CjsModel","e","_init_techniques","_init_extra_techniques","_init_annotations","_init_extra_annotations","_initStatic","c","_initClass","_applyDecs","type","define","className","family","list","map","impl","custom","reason","constructor","args","techniques","annotations","Map","from","values","options","normalized","Object","hasOwn","entries","parameterName","records","Array","isArray","TypeError","set","String","record","Tr2EffectParameterAnnotation","effect","fromPortable","value","isPlainObject","annotationGroupCount","length","techniqueCount","Error","readPortableAnnotationGroups","entry","Tr2EffectTechnique","result","has"],"mappings":";;;;;;;;;AAWA;AAAA,IAAAA;AACA,MAAAC,oBAAA,SAC0CC,QAAQ,CAClD;AAAA,EAAA;AAAA,IAAA,CAAA;MAAAC,CAAA,EAAA,CAAAC,gBAAA,EAAAC,sBAAA,EAAAC,iBAAA,EAAAC,uBAAA,EAAAC,WAAA,CAAA;MAAAC,CAAA,EAAA,CAAAT,qBAAA,EAAAU,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,sBAAsB;AAAEC,MAAAA,MAAM,EAAE;AAAS,KAAC,CAAC,CAAA,EAAA,CAAA,CAKlEH,IAAI,CAACI,IAAI,CAAC,oBAAoB,CAAC,EAAA,CAAA,EAAA,YAAA,CAAA,EAAA,CAI/BJ,IAAI,CAACK,GAAG,CAAC,iCAAiC,CAAC,uBAmD3CC,IAAI,EAAJA,IAAI,CAACC,MAAM,EAAA,MAAA,EACXD,IAAI,CAACE,MAAM,CAAC,0IAA0I,CAAC,CAAA,EAAA,EAAA,EAAA,cAAA,CAAA,EAAA,CAAA,CAoCvJF,IAAI,EAAJA,IAAI,CAACC,MAAM,EAAA,MAAA,EACXD,IAAI,CAACE,MAAM,CAAC,+HAA+H,CAAC,oDAjGrGlB,QAAQ,CAAA;IAAAM,WAAA,CAAA,IAAA,CAAA;AAAA;AAAAa,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAf,uBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAGhD;EAEAgB,UAAU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I,CAACkB,aAAa,CAACD,KAAK,CAAC,EACzB;AACE,QAAA,MAAM,IAAIP,SAAS,CACjB,oDACF,CAAC;AACH,MAAA;MACA,MAAMJ,aAAa,GAAGM,MAAM,CAACK,KAAK,CAACX,aAAa,IAAI,EAAE,CAAC;AACvD,MAAA,IAAI,CAACG,OAAO,CAACQ,KAAK,CAACpB,WAAW,CAAC,EAC/B;AACE,QAAA,MAAM,IAAIa,SAAS,CACjB,CAAA,oCAAA,EAAuCJ,aAAa,oBACtD,CAAC;AACH,MAAA;AACA,MAAA,IAAIoB,MAAM,CAACC,GAAG,CAACrB,aAAa,CAAC,EAC7B;AACE,QAAA,MAAM,IAAIgB,KAAK,CACb,CAAA,kCAAA,EAAqChB,aAAa,iBACpD,CAAC;AACH,MAAA;MACAoB,MAAM,CAACf,GAAG,CACRL,aAAa,EACbW,KAAK,CAACpB,WAAW,CAACP,GAAG,CACnBkC,KAAK,IAAIV,qBAA4B,CAACE,YAAY,CAACQ,KAAK,CAC1D,CACF,CAAC;AACH,IAAA;AACA,IAAA,OAAOE,MAAM;AACf,EAAA;AAAC,EAAA;IAAA3C,UAAA,EAAA;AAAA;AAEH;;;;"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type, impl } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
import { isPlainObject, isArray, isUint32 } from '@carbonenginejs/runtime-utils/is';
|
|
5
|
+
import { clonePortableSourceProgram } from '../portable.js';
|
|
6
|
+
import { Tr2EffectStageInput as _Tr2EffectStageInput } from './Tr2EffectStageInput.js';
|
|
7
|
+
|
|
8
|
+
let _initStatic, _initClass, _init_payloadSize, _init_extra_payloadSize, _init_libraryHandle, _init_extra_libraryHandle, _init_rayGenName, _init_extra_rayGenName, _init_missName, _init_extra_missName, _init_closestHitName, _init_extra_closestHitName, _init_anyHitName, _init_extra_anyHitName, _init_intersectionName, _init_extra_intersectionName, _init_hitGroupName, _init_extra_hitGroupName, _init_globalInput, _init_extra_globalInput, _init_localInput, _init_extra_localInput, _init_globalResourceSetDesc, _init_extra_globalResourceSetDesc, _init_sourceProgram, _init_extra_sourceProgram, _init_exports, _init_extra_exports;
|
|
9
|
+
|
|
10
|
+
/** Reflected shader-library metadata. */
|
|
11
|
+
let _Tr2EffectLibrary;
|
|
12
|
+
class Tr2EffectLibrary extends CjsModel {
|
|
13
|
+
static {
|
|
14
|
+
({
|
|
15
|
+
e: [_init_payloadSize, _init_extra_payloadSize, _init_libraryHandle, _init_extra_libraryHandle, _init_rayGenName, _init_extra_rayGenName, _init_missName, _init_extra_missName, _init_closestHitName, _init_extra_closestHitName, _init_anyHitName, _init_extra_anyHitName, _init_intersectionName, _init_extra_intersectionName, _init_hitGroupName, _init_extra_hitGroupName, _init_globalInput, _init_extra_globalInput, _init_localInput, _init_extra_localInput, _init_globalResourceSetDesc, _init_extra_globalResourceSetDesc, _init_sourceProgram, _init_extra_sourceProgram, _init_exports, _init_extra_exports, _initStatic],
|
|
16
|
+
c: [_Tr2EffectLibrary, _initClass]
|
|
17
|
+
} = _applyDecs2311(this, [type.define({
|
|
18
|
+
className: "Tr2EffectLibrary",
|
|
19
|
+
family: "shader"
|
|
20
|
+
})], [[[type, type.uint32], 16, "payloadSize"], [[type, type.uint32], 16, "libraryHandle"], [[type, type.string], 16, "rayGenName"], [[type, type.string], 16, "missName"], [[type, type.string], 16, "closestHitName"], [[type, type.string], 16, "anyHitName"], [[type, type.string], 16, "intersectionName"], [[type, type.string], 16, "hitGroupName"], [type.rawStruct("Tr2EffectStageInput"), 0, "globalInput"], [type.rawStruct("Tr2EffectStageInput"), 0, "localInput"], [type.rawStruct("Tr2ResourceSetDescriptionAL"), 0, "globalResourceSetDesc"], [[impl, impl.adapted, void 0, impl.reason("Carbon registers the library with the renderer while reading; the device-free graph retains the source program for later engine realization."), void 0, type.rawStruct("CjsEffectSourceProgram")], 16, "sourceProgram"], [[impl, impl.adapted, void 0, impl.reason("Carbon resolves these exports into a renderer library handle; the device-free graph keeps the declarative export list."), void 0, type.rawStruct("CjsEffectLibraryExports")], 16, "exports"], [[impl, impl.custom, void 0, impl.reason("Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.")], 26, "fromPortable"]], 0, void 0, CjsModel));
|
|
21
|
+
_initStatic(this);
|
|
22
|
+
}
|
|
23
|
+
constructor(...args) {
|
|
24
|
+
super(...args);
|
|
25
|
+
_init_extra_exports(this);
|
|
26
|
+
}
|
|
27
|
+
/** payloadSize (uint32_t) */
|
|
28
|
+
payloadSize = _init_payloadSize(this, 0);
|
|
29
|
+
|
|
30
|
+
/** libraryHandle (uint32_t) */
|
|
31
|
+
libraryHandle = (_init_extra_payloadSize(this), _init_libraryHandle(this, 0));
|
|
32
|
+
|
|
33
|
+
/** rayGenName (BlueSharedStringW) */
|
|
34
|
+
rayGenName = (_init_extra_libraryHandle(this), _init_rayGenName(this, ""));
|
|
35
|
+
|
|
36
|
+
/** missName (BlueSharedStringW) */
|
|
37
|
+
missName = (_init_extra_rayGenName(this), _init_missName(this, ""));
|
|
38
|
+
|
|
39
|
+
/** closestHitName (BlueSharedStringW) */
|
|
40
|
+
closestHitName = (_init_extra_missName(this), _init_closestHitName(this, ""));
|
|
41
|
+
|
|
42
|
+
/** anyHitName (BlueSharedStringW) */
|
|
43
|
+
anyHitName = (_init_extra_closestHitName(this), _init_anyHitName(this, ""));
|
|
44
|
+
|
|
45
|
+
/** intersectionName (BlueSharedStringW) */
|
|
46
|
+
intersectionName = (_init_extra_anyHitName(this), _init_intersectionName(this, ""));
|
|
47
|
+
|
|
48
|
+
/** hitGroupName (BlueSharedStringW) */
|
|
49
|
+
hitGroupName = (_init_extra_intersectionName(this), _init_hitGroupName(this, ""));
|
|
50
|
+
|
|
51
|
+
/** globalInput (Tr2EffectStageInput) */
|
|
52
|
+
globalInput = (_init_extra_hitGroupName(this), _init_globalInput(this, null));
|
|
53
|
+
|
|
54
|
+
/** localInput (Tr2EffectStageInput) */
|
|
55
|
+
localInput = (_init_extra_globalInput(this), _init_localInput(this, null));
|
|
56
|
+
|
|
57
|
+
/** globalResourceSetDesc (Tr2ResourceSetDescriptionAL) */
|
|
58
|
+
globalResourceSetDesc = (_init_extra_localInput(this), _init_globalResourceSetDesc(this, null));
|
|
59
|
+
|
|
60
|
+
/** Exact source library program metadata and owned bytes. */
|
|
61
|
+
sourceProgram = (_init_extra_globalResourceSetDesc(this), _init_sourceProgram(this, null));
|
|
62
|
+
|
|
63
|
+
/** Portable export records retained before backend library registration. */
|
|
64
|
+
exports = (_init_extra_sourceProgram(this), _init_exports(this, []));
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Construct one canonical library from JS/JSON model values.
|
|
68
|
+
*
|
|
69
|
+
* @param {object} values Canonical model values.
|
|
70
|
+
* @param {object} options CjsModel import options.
|
|
71
|
+
* @returns {Tr2EffectLibrary} Hydrated library.
|
|
72
|
+
*/
|
|
73
|
+
static from(values = {}, options = {}) {
|
|
74
|
+
let normalized = values;
|
|
75
|
+
const inputs = new Map();
|
|
76
|
+
for (const field of ["globalInput", "localInput"]) {
|
|
77
|
+
if (values?.[field] && !(values[field] instanceof _Tr2EffectStageInput)) {
|
|
78
|
+
normalized = normalized === values ? {
|
|
79
|
+
...values
|
|
80
|
+
} : normalized;
|
|
81
|
+
normalized[field] = _Tr2EffectStageInput.from(values[field], options);
|
|
82
|
+
inputs.set(field, normalized[field]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const library = super.from(normalized, options);
|
|
86
|
+
for (const [field, value] of inputs) {
|
|
87
|
+
library[field] = value;
|
|
88
|
+
}
|
|
89
|
+
return library;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Build one shader library from its portable JSON reflection record.
|
|
94
|
+
*
|
|
95
|
+
* @param {object} value Portable library record.
|
|
96
|
+
* @returns {Tr2EffectLibrary} Reflected library.
|
|
97
|
+
*/
|
|
98
|
+
static fromPortable(value) {
|
|
99
|
+
if (!isPlainObject(value)) {
|
|
100
|
+
throw new TypeError("Portable effect library must be an object");
|
|
101
|
+
}
|
|
102
|
+
if (!isArray(value.exports)) {
|
|
103
|
+
throw new TypeError("Portable effect library exports must be an array");
|
|
104
|
+
}
|
|
105
|
+
if (value.exportCount !== value.exports.length) {
|
|
106
|
+
throw new Error("Portable effect library export count disagrees with its collection");
|
|
107
|
+
}
|
|
108
|
+
const library = new this();
|
|
109
|
+
if (!isUint32(value.payloadSize)) {
|
|
110
|
+
throw new RangeError("Portable effect library payload size must fit uint32");
|
|
111
|
+
}
|
|
112
|
+
library.payloadSize = value.payloadSize;
|
|
113
|
+
library.hitGroupName = String(value.hitGroupName ?? "");
|
|
114
|
+
library.exports = value.exports.map(entry => {
|
|
115
|
+
if (!isUint32(entry?.type)) {
|
|
116
|
+
throw new RangeError("Portable effect library export type must fit uint32");
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
type: entry.type,
|
|
120
|
+
name: String(entry?.name ?? "")
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
for (const entry of library.exports) {
|
|
124
|
+
if (entry.type === 0) library.rayGenName = entry.name;
|
|
125
|
+
if (entry.type === 1) library.missName = entry.name;
|
|
126
|
+
if (entry.type === 2) library.closestHitName = entry.name;
|
|
127
|
+
if (entry.type === 3) library.anyHitName = entry.name;
|
|
128
|
+
if (entry.type === 4) library.intersectionName = entry.name;
|
|
129
|
+
}
|
|
130
|
+
library.sourceProgram = clonePortableSourceProgram(value.sourceProgram, "library");
|
|
131
|
+
library.globalInput = _Tr2EffectStageInput.fromPortableInput(value.globalInput);
|
|
132
|
+
library.localInput = _Tr2EffectStageInput.fromPortableInput(value.localInput);
|
|
133
|
+
return library;
|
|
134
|
+
}
|
|
135
|
+
static {
|
|
136
|
+
_initClass();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { _Tr2EffectLibrary as Tr2EffectLibrary };
|
|
141
|
+
//# sourceMappingURL=Tr2EffectLibrary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectLibrary.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectLibrary.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isArray,\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\nimport { clonePortableSourceProgram } from \"../portable.js\";\nimport { Tr2EffectStageInput } from \"./Tr2EffectStageInput.js\";\n\n/** Reflected shader-library metadata. */\n@type.define({ className: \"Tr2EffectLibrary\", family: \"shader\" })\nexport class Tr2EffectLibrary extends CjsModel\n{\n\n /** payloadSize (uint32_t) */\n @type.uint32\n payloadSize = 0;\n\n /** libraryHandle (uint32_t) */\n @type.uint32\n libraryHandle = 0;\n\n /** rayGenName (BlueSharedStringW) */\n @type.string\n rayGenName = \"\";\n\n /** missName (BlueSharedStringW) */\n @type.string\n missName = \"\";\n\n /** closestHitName (BlueSharedStringW) */\n @type.string\n closestHitName = \"\";\n\n /** anyHitName (BlueSharedStringW) */\n @type.string\n anyHitName = \"\";\n\n /** intersectionName (BlueSharedStringW) */\n @type.string\n intersectionName = \"\";\n\n /** hitGroupName (BlueSharedStringW) */\n @type.string\n hitGroupName = \"\";\n\n /** globalInput (Tr2EffectStageInput) */\n @type.rawStruct(\"Tr2EffectStageInput\")\n globalInput = null;\n\n /** localInput (Tr2EffectStageInput) */\n @type.rawStruct(\"Tr2EffectStageInput\")\n localInput = null;\n\n /** globalResourceSetDesc (Tr2ResourceSetDescriptionAL) */\n @type.rawStruct(\"Tr2ResourceSetDescriptionAL\")\n globalResourceSetDesc = null;\n\n /** Exact source library program metadata and owned bytes. */\n @impl.adapted\n @impl.reason(\"Carbon registers the library with the renderer while reading; the device-free graph retains the source program for later engine realization.\")\n @type.rawStruct(\"CjsEffectSourceProgram\")\n sourceProgram = null;\n\n /** Portable export records retained before backend library registration. */\n @impl.adapted\n @impl.reason(\"Carbon resolves these exports into a renderer library handle; the device-free graph keeps the declarative export list.\")\n @type.rawStruct(\"CjsEffectLibraryExports\")\n exports = [];\n\n /**\n * Construct one canonical library from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2EffectLibrary} Hydrated library.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n const inputs = new Map();\n for (const field of [ \"globalInput\", \"localInput\" ])\n {\n if (values?.[field]\n && !(values[field] instanceof Tr2EffectStageInput))\n {\n normalized = normalized === values ? { ...values } : normalized;\n normalized[field] = Tr2EffectStageInput.from(\n values[field],\n options\n );\n inputs.set(field, normalized[field]);\n }\n }\n const library = super.from(normalized, options);\n for (const [ field, value ] of inputs)\n {\n library[field] = value;\n }\n return library;\n }\n\n /**\n * Build one shader library from its portable JSON reflection record.\n *\n * @param {object} value Portable library record.\n * @returns {Tr2EffectLibrary} Reflected library.\n */\n @impl.custom\n @impl.reason(\"Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract after format parsing.\")\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect library must be an object\");\n }\n if (!isArray(value.exports))\n {\n throw new TypeError(\n \"Portable effect library exports must be an array\"\n );\n }\n if (value.exportCount !== value.exports.length)\n {\n throw new Error(\n \"Portable effect library export count disagrees with its collection\"\n );\n }\n\n const library = new this();\n if (!isUint32(value.payloadSize))\n {\n throw new RangeError(\n \"Portable effect library payload size must fit uint32\"\n );\n }\n library.payloadSize = value.payloadSize;\n library.hitGroupName = String(value.hitGroupName ?? \"\");\n library.exports = value.exports.map(entry =>\n {\n if (!isUint32(entry?.type))\n {\n throw new RangeError(\n \"Portable effect library export type must fit uint32\"\n );\n }\n return {\n type: entry.type,\n name: String(entry?.name ?? \"\")\n };\n });\n for (const entry of library.exports)\n {\n if (entry.type === 0) library.rayGenName = entry.name;\n if (entry.type === 1) library.missName = entry.name;\n if (entry.type === 2) library.closestHitName = entry.name;\n if (entry.type === 3) library.anyHitName = entry.name;\n if (entry.type === 4) library.intersectionName = entry.name;\n }\n library.sourceProgram = clonePortableSourceProgram(\n value.sourceProgram,\n \"library\"\n );\n library.globalInput = Tr2EffectStageInput.fromPortableInput(\n value.globalInput\n );\n library.localInput = Tr2EffectStageInput.fromPortableInput(\n value.localInput\n );\n return library;\n }\n\n}\n"],"names":["_Tr2EffectLibrary","Tr2EffectLibrary","CjsModel","e","_init_payloadSize","_init_extra_payloadSize","_init_libraryHandle","_init_extra_libraryHandle","_init_rayGenName","_init_extra_rayGenName","_init_missName","_init_extra_missName","_init_closestHitName","_init_extra_closestHitName","_init_anyHitName","_init_extra_anyHitName","_init_intersectionName","_init_extra_intersectionName","_init_hitGroupName","_init_extra_hitGroupName","_init_globalInput","_init_extra_globalInput","_init_localInput","_init_extra_localInput","_init_globalResourceSetDesc","_init_extra_globalResourceSetDesc","_init_sourceProgram","_init_extra_sourceProgram","_init_exports","_init_extra_exports","_initStatic","c","_initClass","_applyDecs","type","define","className","family","uint32","string","rawStruct","impl","adapted","reason","custom","constructor","args","payloadSize","libraryHandle","rayGenName","missName","closestHitName","anyHitName","intersectionName","hitGroupName","globalInput","localInput","globalResourceSetDesc","sourceProgram","exports","from","values","options","normalized","inputs","Map","field","Tr2EffectStageInput","set","library","value","fromPortable","isPlainObject","TypeError","isArray","exportCount","length","Error","isUint32","RangeError","String","map","entry","name","clonePortableSourceProgram","fromPortableInput"],"mappings":";;;;;;;;;AAWA;AAAA,IAAAA;AACA,MAAAC,gBAAA,SACsCC,QAAQ,CAC9C;AAAA,EAAA;AAAA,IAAA,CAAA;MAAAC,CAAA,EAAA,CAAAC,iBAAA,EAAAC,uBAAA,E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7D,IAAA;IACAd,OAAO,CAACX,aAAa,GAAG0B,0BAA0B,CAChDd,KAAK,CAACZ,aAAa,EACnB,SACF,CAAC;IACDW,OAAO,CAACd,WAAW,GAAGY,oBAAmB,CAACkB,iBAAiB,CACzDf,KAAK,CAACf,WACR,CAAC;IACDc,OAAO,CAACb,UAAU,GAAGW,oBAAmB,CAACkB,iBAAiB,CACxDf,KAAK,CAACd,UACR,CAAC;AACD,IAAA,OAAOa,OAAO;AAChB,EAAA;AAAC,EAAA;IAAArC,UAAA,EAAA;AAAA;AAEH;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type, impl, schema } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
import { dwordToFloat } from '@carbonenginejs/runtime-utils/math/num';
|
|
5
|
+
import { isPlainObject, isUint32 } from '@carbonenginejs/runtime-utils/is';
|
|
6
|
+
|
|
7
|
+
let _initStatic, _initClass, _init_name, _init_extra_name, _init_type, _init_extra_type, _init_boolValue, _init_extra_boolValue, _init_rawValue, _init_extra_rawValue, _init_intValue, _init_extra_intValue, _init_floatValue, _init_extra_floatValue, _init_stringValue, _init_extra_stringValue;
|
|
8
|
+
|
|
9
|
+
/** Typed annotation attached to a reflected effect parameter. */
|
|
10
|
+
let _Tr2EffectParameterAn;
|
|
11
|
+
new class extends _identity {
|
|
12
|
+
static [class Tr2EffectParameterAnnotation extends CjsModel {
|
|
13
|
+
static {
|
|
14
|
+
({
|
|
15
|
+
e: [_init_name, _init_extra_name, _init_type, _init_extra_type, _init_boolValue, _init_extra_boolValue, _init_rawValue, _init_extra_rawValue, _init_intValue, _init_extra_intValue, _init_floatValue, _init_extra_floatValue, _init_stringValue, _init_extra_stringValue, _initStatic],
|
|
16
|
+
c: [_Tr2EffectParameterAn, _initClass]
|
|
17
|
+
} = _applyDecs2311(this, [type.define({
|
|
18
|
+
className: "Tr2EffectParameterAnnotation",
|
|
19
|
+
family: "shader"
|
|
20
|
+
})], [[[type, type.string], 16, "name"], [[type, type.int32, void 0, schema.enum("Type")], 16, "type"], [[type, type.boolean], 16, "boolValue"], [[impl, impl.adapted, void 0, impl.reason("Carbon reads numeric annotations into typed values; the portable source contract retains the exact uint32 payload so NaN, negative zero, and integer bit patterns round-trip losslessly."), type, type.uint32], 16, "rawValue"], [[type, type.int32], 16, "intValue"], [[type, type.float32], 16, "floatValue"], [[type, type.string], 16, "stringValue"], [[impl, impl.custom, void 0, impl.reason("Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract while retaining exact numeric bits.")], 26, "fromPortable"]], 0, void 0, CjsModel));
|
|
21
|
+
_initStatic(this);
|
|
22
|
+
}
|
|
23
|
+
constructor(...args) {
|
|
24
|
+
super(...args);
|
|
25
|
+
_init_extra_stringValue(this);
|
|
26
|
+
}
|
|
27
|
+
/** name (const char*) */
|
|
28
|
+
name = _init_name(this, "");
|
|
29
|
+
|
|
30
|
+
/** type (Type - enum Type) */
|
|
31
|
+
type = (_init_extra_name(this), _init_type(this, 0));
|
|
32
|
+
|
|
33
|
+
/** boolValue (bool) */
|
|
34
|
+
boolValue = (_init_extra_type(this), _init_boolValue(this, false));
|
|
35
|
+
|
|
36
|
+
/** Exact serialized BOOL, INT, or FLOAT payload bits. */
|
|
37
|
+
rawValue = (_init_extra_boolValue(this), _init_rawValue(this, 0));
|
|
38
|
+
|
|
39
|
+
/** intValue (int) */
|
|
40
|
+
intValue = (_init_extra_rawValue(this), _init_intValue(this, 0));
|
|
41
|
+
|
|
42
|
+
/** floatValue (float) */
|
|
43
|
+
floatValue = (_init_extra_intValue(this), _init_floatValue(this, 0));
|
|
44
|
+
|
|
45
|
+
/** stringValue (const char*) */
|
|
46
|
+
stringValue = (_init_extra_floatValue(this), _init_stringValue(this, ""));
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Build one typed annotation from its portable JSON reflection record.
|
|
50
|
+
*
|
|
51
|
+
* @param {object} value Portable annotation record.
|
|
52
|
+
* @returns {Tr2EffectParameterAnnotation} Reflected annotation.
|
|
53
|
+
*/
|
|
54
|
+
static fromPortable(value) {
|
|
55
|
+
if (!isPlainObject(value)) {
|
|
56
|
+
throw new TypeError("Portable effect annotation must be an object");
|
|
57
|
+
}
|
|
58
|
+
if (!isUint32(value.type)) {
|
|
59
|
+
throw new RangeError("Portable annotation type must fit uint32");
|
|
60
|
+
}
|
|
61
|
+
const annotation = new this();
|
|
62
|
+
annotation.name = String(value.name ?? "");
|
|
63
|
+
annotation.type = value.type;
|
|
64
|
+
switch (annotation.type) {
|
|
65
|
+
case this.Type.BOOL:
|
|
66
|
+
if (!isUint32(value.rawValue)) {
|
|
67
|
+
throw new RangeError("Portable boolean annotation must fit uint32");
|
|
68
|
+
}
|
|
69
|
+
annotation.rawValue = value.rawValue;
|
|
70
|
+
annotation.boolValue = annotation.rawValue !== 0;
|
|
71
|
+
break;
|
|
72
|
+
case this.Type.INT:
|
|
73
|
+
if (!isUint32(value.rawValue)) {
|
|
74
|
+
throw new RangeError("Portable integer annotation must fit uint32");
|
|
75
|
+
}
|
|
76
|
+
annotation.rawValue = value.rawValue;
|
|
77
|
+
annotation.intValue = annotation.rawValue | 0;
|
|
78
|
+
break;
|
|
79
|
+
case this.Type.FLOAT:
|
|
80
|
+
if (!isUint32(value.rawValue)) {
|
|
81
|
+
throw new RangeError("Portable float annotation must fit uint32");
|
|
82
|
+
}
|
|
83
|
+
annotation.rawValue = value.rawValue;
|
|
84
|
+
annotation.floatValue = dwordToFloat(annotation.rawValue);
|
|
85
|
+
break;
|
|
86
|
+
case this.Type.STRING:
|
|
87
|
+
annotation.stringValue = String(value.stringValue ?? "");
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
throw new Error(`Portable annotation type ${annotation.type} is unsupported`);
|
|
91
|
+
}
|
|
92
|
+
return annotation;
|
|
93
|
+
}
|
|
94
|
+
}];
|
|
95
|
+
Type = Object.freeze({
|
|
96
|
+
BOOL: 0,
|
|
97
|
+
INT: 1,
|
|
98
|
+
FLOAT: 2,
|
|
99
|
+
STRING: 3
|
|
100
|
+
});
|
|
101
|
+
constructor() {
|
|
102
|
+
super(_Tr2EffectParameterAn), _initClass();
|
|
103
|
+
}
|
|
104
|
+
}();
|
|
105
|
+
|
|
106
|
+
export { _Tr2EffectParameterAn as Tr2EffectParameterAnnotation };
|
|
107
|
+
//# sourceMappingURL=Tr2EffectParameterAnnotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2EffectParameterAnnotation.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectParameterAnnotation.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { impl, schema, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport { dwordToFloat } from \"@carbonenginejs/runtime-utils/math/num\";\nimport {\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\n\n/** Typed annotation attached to a reflected effect parameter. */\n@type.define({ className: \"Tr2EffectParameterAnnotation\", family: \"shader\" })\nexport class Tr2EffectParameterAnnotation extends CjsModel\n{\n\n /** name (const char*) */\n @type.string\n name = \"\";\n\n /** type (Type - enum Type) */\n @type.int32\n @schema.enum(\"Type\")\n type = 0;\n\n /** boolValue (bool) */\n @type.boolean\n boolValue = false;\n\n /** Exact serialized BOOL, INT, or FLOAT payload bits. */\n @impl.adapted\n @impl.reason(\"Carbon reads numeric annotations into typed values; the portable source contract retains the exact uint32 payload so NaN, negative zero, and integer bit patterns round-trip losslessly.\")\n @type.uint32\n rawValue = 0;\n\n /** intValue (int) */\n @type.int32\n intValue = 0;\n\n /** floatValue (float) */\n @type.float32\n floatValue = 0;\n\n /** stringValue (const char*) */\n @type.string\n stringValue = \"\";\n\n /**\n * Build one typed annotation from its portable JSON reflection record.\n *\n * @param {object} value Portable annotation record.\n * @returns {Tr2EffectParameterAnnotation} Reflected annotation.\n */\n @impl.custom\n @impl.reason(\"Carbon reads compiled effect bytes directly; CarbonEngineJS hydrates the browser-safe portable-reflection contract while retaining exact numeric bits.\")\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect annotation must be an object\");\n }\n if (!isUint32(value.type))\n {\n throw new RangeError(\"Portable annotation type must fit uint32\");\n }\n\n const annotation = new this();\n annotation.name = String(value.name ?? \"\");\n annotation.type = value.type;\n\n switch (annotation.type)\n {\n case this.Type.BOOL:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable boolean annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.boolValue = annotation.rawValue !== 0;\n break;\n\n case this.Type.INT:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable integer annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.intValue = annotation.rawValue | 0;\n break;\n\n case this.Type.FLOAT:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable float annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.floatValue = dwordToFloat(annotation.rawValue);\n break;\n\n case this.Type.STRING:\n annotation.stringValue = String(value.stringValue ?? \"\");\n break;\n\n default:\n throw new Error(\n `Portable annotation type ${annotation.type} is unsupported`\n );\n }\n\n return annotation;\n }\n\n static Type = Object.freeze({\n BOOL: 0,\n INT: 1,\n FLOAT: 2,\n STRING: 3\n });\n\n}\n"],"names":["_Tr2EffectParameterAn","_identity","Tr2EffectParameterAnnotation","CjsModel","e","_init_name","_init_extra_name","_init_type","_init_extra_type","_init_boolValue","_init_extra_boolValue","_init_rawValue","_init_extra_rawValue","_init_intValue","_init_extra_intValue","_init_floatValue","_init_extra_floatValue","_init_stringValue","_init_extra_stringValue","_initStatic","c","_initClass","_applyDecs","type","define","className","family","string","int32","schema","enum","boolean","impl","adapted","reason","uint32","float32","custom","constructor","args","name","boolValue","rawValue","intValue","floatValue","stringValue","fromPortable","value","isPlainObject","TypeError","isUint32","RangeError","annotation","String","Type","BOOL","INT","FLOAT","dwordToFloat","STRING","Error","Object","freeze"],"mappings":";;;;;;;;AASA;AAAA,IAAAA;AAAA,IAAA,cAAAC,SAAA,CAAA;AAAA,EAAA,QACA,MAAAC,4BAAA,SACkDC,QAAQ,CAC1D;AAAA,IAAA;AAAA,MAAA,CAAA;AAAAC,QAAAA,CAAA,EAAA,CAAAC,UAAA,EAAAC,gBAAA,EAAAC,UAAA,EAAAC,gBAAA,EAAAC,eAAA,EAAAC,qBAAA,EAAAC,cAAA,EAAAC,oBAAA,EAAAC,cAAA,EAAAC,oBAAA,EAAAC,gBAAA,EAAAC,sBAAA,EAAAC,iBAAA,EAAAC,uBAAA,EAAAC,WAAA,CAAA;QAAAC,CAAA,EAAA,CAAApB,qBAAA,EAAAqB,UAAA;AAAA,OAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,QAAAA,SAAS,EAAE,8BAA8B;AAAEC,QAAAA,MAAM,EAAE;AAAS,OAAC,CAAC,CAAA,EAAA,CAAA,CAAA,CAK1EH,IAAI,EAAJA,IAAI,CAACI,MAAM,CAAA,EAAA,EAAA,EAAA,MAAA,CAAA,EAAA,CAAA,CAIXJ,IAAI,EAAJA,IAAI,CAACK,KAAK,EAAA,MAAA,EACVC,MAAM,CAACC,IAAI,CAAC,MAAM,CAAC,kBAInBP,IAAI,EAAJA,IAAI,CAACQ,OAAO,CAAA,EAAA,EAAA,EAAA,WAAA,CAAA,EAAA,CAAA,CAIZC,IAAI,EAAJA,IAAI,CAACC,OAAO,EAAA,MAAA,EACZD,IAAI,CAACE,MAAM,CAAC,0LAA0L,CAAC,EACvMX,IAAI,EAAJA,IAAI,CAACY,MAAM,sBAIXZ,IAAI,EAAJA,IAAI,C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